more compatible STAL/EAL/MEMUSS handling

This commit is contained in:
FeralChild64 committed 2019-11-07 19:00:09 +01:00
1 parent 2e9a0b1610
commit ce68834035
5 files changed
+65 -33

No files matched your search

+13 -10
View File
@@ -69,20 +69,23 @@ load_iec:
jsr iec_turnaround_to_listen jsr iec_turnaround_to_listen
bcs load_iec_error bcs load_iec_error
// Get load address and store it if secondary address is zero // Get load address
jsr iec_rx_byte jsr iec_rx_byte
bcs load_iec_file_not_found bcs load_iec_file_not_found
sta EAL+0
ldx SA
beq !+
sta STAL+0
!:
jsr iec_rx_byte jsr iec_rx_byte
bcs load_iec_file_not_found bcs load_iec_file_not_found
sta EAL+1
ldx SA // If secondary address is 0, override EAL with STAL
beq !+
sta STAL+1 lda SA
bne !+
lda STAL+0
sta EAL+0
lda STAL+1
sta EAL+1
!: !:
// Display start address // Display start address
jsr lvs_display_loading_verifying jsr lvs_display_loading_verifying
@@ -102,7 +105,7 @@ iec_load_loop:
// Handle STOP key; it is probably an overkill to do it // Handle STOP key; it is probably an overkill to do it
// with every byte, once per 32 bytes should be enough // with every byte, once per 32 bytes should be enough
lda STAL lda EAL
and #$1F and #$1F
bne !+ bne !+
phx_trash_a phx_trash_a
+1 -1
View File
@@ -5,7 +5,7 @@
// XXX this is untested! // XXX this is untested!
// test EAL/STAL - LOAD (tape, disk), SAVE - Open ROMs vs hybrid vs original // also test STAL/EAL - Open ROMs vs hybrid vs original
+10 -10
View File
@@ -22,7 +22,7 @@ lvs_handle_byte_load_verify:
ldx #$33 ldx #$33
stx $01 stx $01
ldy #0 ldy #0
sta (STAL),y sta (EAL),y
ldx #$37 ldx #$37
stx $01 stx $01
plp plp
@@ -30,7 +30,7 @@ lvs_handle_byte_load_verify:
#else #else
ldy #0 ldy #0
sta (STAL),y sta (EAL),y
#endif #endif
@@ -55,7 +55,7 @@ lvs_handle_byte_verify:
ldx #$33 ldx #$33
stx $01 stx $01
ldy #0 ldy #0
lda (STAL),y lda (EAL),y
ldx #$37 ldx #$37
stx $01 stx $01
plp plp
@@ -66,7 +66,7 @@ lvs_handle_byte_verify:
#else #else
ldy #0 ldy #0
cmp (STAL),y cmp (EAL),y
#endif #endif
@@ -79,9 +79,9 @@ lvs_handle_byte_verify:
lvs_advance_pointer: lvs_advance_pointer:
// Advance pointer // Advance pointer
inc STAL+0 inc EAL+0
bne !+ bne !+
inc STAL+1 inc EAL+1
!: !:
rts rts
@@ -135,9 +135,9 @@ lvs_display_start_addr:
!: !:
jsr print_kernal_message jsr print_kernal_message
lda STAL+1 lda EAL+1
jsr print_hex_byte jsr print_hex_byte
lda STAL+0 lda EAL+0
jmp print_hex_byte jmp print_hex_byte
lvs_display_done: lvs_display_done:
@@ -181,8 +181,8 @@ lvs_return_last_address:
// Return last address - Compute's Mapping the 64 says without the '+1', // Return last address - Compute's Mapping the 64 says without the '+1',
// checked (short test program) on original ROMs that this is really the case // checked (short test program) on original ROMs that this is really the case
ldx STAL+0 ldx EAL+0
ldy STAL+1 ldy EAL+1
// FALLTHROUGH // FALLTHROUGH
lvs_success_end: lvs_success_end:
+19 -10
View File
@@ -61,36 +61,45 @@ load_tape_turbo_header_loop: // this strange loop puts metadata after
load_tape_turbo_payload: load_tape_turbo_payload:
// Initial checksum value
lda #$00
sta PRTY
// Read file payload // Read file payload
jsr tape_turbo_sync_payload jsr tape_turbo_sync_payload
ldy #$00
sty PRTY // initial checksum value
// FALLTROUGH // FALLTROUGH
load_tape_turbo_loop: load_tape_turbo_loop:
jsr tape_turbo_get_byte jsr tape_turbo_get_byte
sta (STAL),y sta (MEMUSS),y
eor PRTY // handle checksum eor PRTY // handle checksum
sta PRTY sta PRTY
jsr lvs_advance_pointer // Advance MEMUSS (see Mapping the C64, page 36)
inc MEMUSS+0
lda STAL+1 bne !+
inc MEMUSS+1
!:
lda MEMUSS+1
cmp EAL+1 cmp EAL+1
bne load_tape_turbo_loop bne load_tape_turbo_loop
lda STAL+0 lda MEMUSS+0
cmp EAL+0 cmp EAL+0
bne load_tape_turbo_loop bne load_tape_turbo_loop
// Verify the checksum // Get the checksum
jsr tape_turbo_get_byte jsr tape_turbo_get_byte
cmp PRTY tax
// Verify the checksum
cpx PRTY
beq_far tape_load_success beq_far tape_load_success
jmp tape_load_error jmp tape_load_error
+22 -2
View File
@@ -208,9 +208,29 @@ tape_handle_header:
adc STAL+1 adc STAL+1
sta EAL+1 sta EAL+1
!: !:
// Print LOADING // Setup MEMUSS (see Mapping the C64, page 36)
jsr lvs_display_loading_verifying lda STAL+0
sta MEMUSS+0
lda STAL+1
sta MEMUSS+1
// Print LOADING and start address
lda MSGFLG
bpl tape_handle_header_displayed
ldx #__MSG_KERNAL_LOADING
jsr print_kernal_message
ldx #__MSG_KERNAL_FROM_HEX
jsr print_kernal_message
lda STAL+1
jsr print_hex_byte
lda STAL+0
jsr print_hex_byte
tape_handle_header_displayed:
// Load the file // Load the file