After being semi-successful with C, I am trying my hand at assembler again. I am running into an issue loading data directly into VRAM. Using the emulator's debugging feature, I see my load function is using the correct address. and I have the bank hard coded to "2" right now. I am using Kick Assembler with Visual Studio Code.
My function is as follows:
Quote
//**********************************************
// Function: load_vram
// Args: A = VRAM Low Byte
// X = VRAM High Byte
// Y = filename (7:0)
// Brief: Loads a file into VRAM
//**********************************************
load_file_into_vram: {
clc
stz ROM_BANK
sta ZP_PTR_1 // Store Low Byte
stx ZP_PTR_1+1// Store High Byte
sty ZP_PTR_2 // Store file name low byte
// SETLFS
lda #1
ldx #HOST_DEVICE
ldy #0
jsr SETLFS
// SETNAM
ldy #>filenames
sty ZP_PTR_2+1
ldy #0
!: lda (ZP_PTR_2),y
beq !+
iny
jmp !-
!: tya// Filename size
ldx ZP_PTR_2 // Filename (Low Byte)
ldy #>filenames
jsr SETNAM
// LOAD
lda #2// Bank
ldx ZP_PTR_1
ldy ZP_PTR_1+1
clc// Clear the carry
jsr LOAD
bcs err
rts
err: cmp#$05
beq dev_error
cmp#$04
beq file_error
cmp#$1D
beq load_error
dev_error:
lda #<dev_error_msg
ldx #>dev_error_msg
ldy #(end_dev_error_msg-dev_error_msg)
jmp prt
file_error:
lda #<file_error_msg
ldx #>file_error_msg
ldy #(end_file_error_msg-file_error_msg)
jmp prt
load_error:
lda #<load_error_msg
ldx #>load_error_msg
ldy #(end_load_error_msg-load_error_msg)
jmp prt
prt: jsr print_string
rts
}
My function call, looks like this:
Quote
lda #>(VRAM_palette & $FFFF)
ldx #<(VRAM_palette & $FFFF)
ldy #<pal_fn
jsr load_file_into_vram
I keep getting a "FILE NOT FOUND" error ($04) and static on the screen. Any help would be appreciated.
Question
paradoxnj
After being semi-successful with C, I am trying my hand at assembler again.
I am running into an issue loading data directly into VRAM. Using the emulator's debugging feature, I see my load function is using the correct address. and I have the bank hard coded to "2" right now. I am using Kick Assembler with Visual Studio Code.
My function is as follows:
My function call, looks like this:
I keep getting a "FILE NOT FOUND" error ($04) and static on the screen. Any help would be appreciated.
Edited by paradoxnjLink to comment
Share on other sites
20 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.