more work on tape support
This commit is contained in:
1 parent
46aacc4ef0
commit
c32fbadc7c
6 files changed
+147
-38
No files matched your search
@@ -15,6 +15,10 @@
|
|||||||
.label __MSG_KERNAL_FROM_HEX = __msg_kernalfrom_hex - __msg_kernal_first
|
.label __MSG_KERNAL_FROM_HEX = __msg_kernalfrom_hex - __msg_kernal_first
|
||||||
.label __MSG_KERNAL_TO_HEX = __msg_kernalto_hex - __msg_kernal_first
|
.label __MSG_KERNAL_TO_HEX = __msg_kernalto_hex - __msg_kernal_first
|
||||||
|
|
||||||
|
#if CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO
|
||||||
|
.label __MSG_KERNAL_PRESS_PLAY = __msg_kernalplay - __msg_kernal_first
|
||||||
|
#endif
|
||||||
|
|
||||||
#if CONFIG_SHOW_PAL_NTSC
|
#if CONFIG_SHOW_PAL_NTSC
|
||||||
.label __MSG_KERNAL_PAL = __msg_kernalpal - __msg_kernal_first
|
.label __MSG_KERNAL_PAL = __msg_kernalpal - __msg_kernal_first
|
||||||
.label __MSG_KERNAL_NTSC = __msg_kernalntsc - __msg_kernal_first
|
.label __MSG_KERNAL_NTSC = __msg_kernalntsc - __msg_kernal_first
|
||||||
@@ -59,6 +63,15 @@ __msg_kernalto_hex:
|
|||||||
.text " TO "
|
.text " TO "
|
||||||
.byte $80 + $24 // end of string mark + '$'
|
.byte $80 + $24 // end of string mark + '$'
|
||||||
|
|
||||||
|
#if CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO
|
||||||
|
|
||||||
|
__msg_kernalplay:
|
||||||
|
.byte $0D
|
||||||
|
.text "PRESS PLAY ON TAPE"
|
||||||
|
.byte $80 + $0D // end of string mark + return
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#if CONFIG_SHOW_PAL_NTSC
|
#if CONFIG_SHOW_PAL_NTSC
|
||||||
|
|
||||||
__msg_kernalpal:
|
__msg_kernalpal:
|
||||||
|
|||||||
@@ -16,10 +16,11 @@ IOINIT:
|
|||||||
// (https://www.c64-wiki.com/wiki/Zeropage)
|
// (https://www.c64-wiki.com/wiki/Zeropage)
|
||||||
// Work around for VICE bug: Writing $00 before $01 results in rubbish in $01
|
// Work around for VICE bug: Writing $00 before $01 results in rubbish in $01
|
||||||
// after. https://sourceforge.net/p/vice-emu/bugs/1057/
|
// after. https://sourceforge.net/p/vice-emu/bugs/1057/
|
||||||
|
|
||||||
lda #$27
|
lda #$27
|
||||||
ldx #$2F
|
ldx #$EF
|
||||||
sta CPU_R6510
|
sta CPU_R6510
|
||||||
stx CPU_D6510
|
stx CPU_D6510 // [CM64] page 4
|
||||||
|
|
||||||
// Silence the SID chips, depending on the configuration
|
// Silence the SID chips, depending on the configuration
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,9 @@ lvs_advance_pointer:
|
|||||||
clc
|
clc
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
lvs_display_searching_for:
|
lvs_display_searching_for:
|
||||||
|
|
||||||
lda MSGFLG
|
lda MSGFLG
|
||||||
bpl lvs_display_end
|
bpl lvs_display_end
|
||||||
|
|
||||||
@@ -117,7 +119,9 @@ lvs_display_searching_for:
|
|||||||
lvs_display_end:
|
lvs_display_end:
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
lvs_display_loading_verifying:
|
lvs_display_loading_verifying:
|
||||||
|
|
||||||
// Display LOADING / VERIFYING and start address
|
// Display LOADING / VERIFYING and start address
|
||||||
lda MSGFLG
|
lda MSGFLG
|
||||||
bpl lvs_display_end
|
bpl lvs_display_end
|
||||||
@@ -132,6 +136,7 @@ lvs_display_loading_verifying:
|
|||||||
// FALLTHROUGH
|
// FALLTHROUGH
|
||||||
|
|
||||||
lvs_display_start_addr:
|
lvs_display_start_addr:
|
||||||
|
|
||||||
ldx #__MSG_KERNAL_FROM_HEX
|
ldx #__MSG_KERNAL_FROM_HEX
|
||||||
!:
|
!:
|
||||||
jsr print_kernal_message
|
jsr print_kernal_message
|
||||||
@@ -142,6 +147,7 @@ lvs_display_start_addr:
|
|||||||
jmp print_hex_byte
|
jmp print_hex_byte
|
||||||
|
|
||||||
lvs_display_done:
|
lvs_display_done:
|
||||||
|
|
||||||
// Display end address
|
// Display end address
|
||||||
lda MSGFLG
|
lda MSGFLG
|
||||||
bpl lvs_display_end
|
bpl lvs_display_end
|
||||||
@@ -150,14 +156,18 @@ lvs_display_done:
|
|||||||
jmp !-
|
jmp !-
|
||||||
|
|
||||||
lvs_wrap_around_error:
|
lvs_wrap_around_error:
|
||||||
|
|
||||||
// This error is probably not even detected by C64 Kernal;
|
// This error is probably not even detected by C64 Kernal;
|
||||||
// report BASIC error code that looks the most sane
|
// report BASIC error code that looks the most sane
|
||||||
lda #B_ERR_OVERFLOW
|
lda #B_ERR_OVERFLOW
|
||||||
|
|
||||||
lvs_error_end:
|
lvs_error_end:
|
||||||
|
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
|
|
||||||
lvs_return_last_address:
|
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 STAL+0
|
||||||
@@ -165,6 +175,7 @@ lvs_return_last_address:
|
|||||||
// FALLTHROUGH
|
// FALLTHROUGH
|
||||||
|
|
||||||
lvs_success_end:
|
lvs_success_end:
|
||||||
|
|
||||||
clc
|
clc
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
|
||||||
|
//
|
||||||
|
// Helper routines to blank/show screen
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#if CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO
|
||||||
|
|
||||||
|
|
||||||
|
screen_blank:
|
||||||
|
|
||||||
|
lda VIC_SCROLY
|
||||||
|
and #($FF - $10)
|
||||||
|
sta VIC_SCROLY
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
screen_show:
|
||||||
|
|
||||||
|
lda VIC_SCROLY
|
||||||
|
ora #$10
|
||||||
|
sta VIC_SCROLY
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -10,53 +10,23 @@
|
|||||||
#if CONFIG_TAPE_TURBO
|
#if CONFIG_TAPE_TURBO
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
tape_ask_play:
|
|
||||||
|
|
||||||
sei // timing is critical for tape loading
|
|
||||||
|
|
||||||
lda #$1D
|
|
||||||
sta CPU_R6510 // motor on XXX make it more system friendly
|
|
||||||
|
|
||||||
ror VIC_SCROLY // screen blanked to VIC_EXTCOL color XXX make it more system friendly
|
|
||||||
|
|
||||||
// XXX finish the implementation
|
|
||||||
|
|
||||||
rts
|
|
||||||
|
|
||||||
tape_load_success:
|
|
||||||
|
|
||||||
rol VIC_SCROLY // screen back on
|
|
||||||
lda #$37 // default setting
|
|
||||||
sta CPU_R6510
|
|
||||||
|
|
||||||
// XXX finish this routine
|
|
||||||
|
|
||||||
rts
|
|
||||||
|
|
||||||
tape_load_error:
|
|
||||||
|
|
||||||
// XXX finish this routine
|
|
||||||
|
|
||||||
rts
|
|
||||||
|
|
||||||
|
|
||||||
load_tape_turbo:
|
load_tape_turbo:
|
||||||
|
|
||||||
// XXX if VERIFY asked - error
|
jsr tape_ditch_verify // only LOAD is supported, no VERIFY
|
||||||
|
|
||||||
ldy #$00
|
ldy #$00
|
||||||
sty PRTY // initial checksum value
|
sty PRTY // initial checksum value
|
||||||
|
|
||||||
jsr tape_ask_play
|
sty CIA2_TIMAHI
|
||||||
|
|
||||||
sty CIA2_TIMAHI // .Y still 0
|
|
||||||
lda #$FE // timer threshold for TurboTape
|
lda #$FE // timer threshold for TurboTape
|
||||||
sta CIA2_TIMALO
|
sta CIA2_TIMALO
|
||||||
|
|
||||||
|
jsr tape_ask_play
|
||||||
|
|
||||||
// Read file header
|
// Read file header
|
||||||
|
|
||||||
|
ldy #$00
|
||||||
|
|
||||||
jsr tape_turbo_sync // .X gets set to 0
|
jsr tape_turbo_sync // .X gets set to 0
|
||||||
|
|
||||||
stx STAL+0 // instead of a later lda, sta
|
stx STAL+0 // instead of a later lda, sta
|
||||||
|
|||||||
@@ -0,0 +1,86 @@
|
|||||||
|
|
||||||
|
//
|
||||||
|
// Common routines for tape support
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#if CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO
|
||||||
|
|
||||||
|
|
||||||
|
tape_ditch_verify:
|
||||||
|
|
||||||
|
lda VERCKK
|
||||||
|
bne !+
|
||||||
|
rts
|
||||||
|
!:
|
||||||
|
pla
|
||||||
|
pla
|
||||||
|
jmp lvs_device_not_found_error
|
||||||
|
|
||||||
|
|
||||||
|
tape_motor_off:
|
||||||
|
|
||||||
|
lda CPU_R6510
|
||||||
|
ora #$20
|
||||||
|
sta CPU_R6510
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
tape_motor_on:
|
||||||
|
|
||||||
|
lda CPU_R6510
|
||||||
|
and #($FF - $20)
|
||||||
|
sta CPU_R6510
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
tape_ask_play:
|
||||||
|
|
||||||
|
sei // timing is critical for tape loading
|
||||||
|
|
||||||
|
jsr tape_motor_off
|
||||||
|
|
||||||
|
ldx #__MSG_KERNAL_PRESS_PLAY
|
||||||
|
jsr print_kernal_message
|
||||||
|
|
||||||
|
tape_wait_button_loop:
|
||||||
|
|
||||||
|
jsr udtim_keyboard
|
||||||
|
jsr STOP
|
||||||
|
bcc !+
|
||||||
|
|
||||||
|
// Stop key pressed
|
||||||
|
pla
|
||||||
|
pla
|
||||||
|
cli
|
||||||
|
jmp kernalerror_ROUTINE_TERMINATED
|
||||||
|
!:
|
||||||
|
lda CPU_R6510
|
||||||
|
and #$10 // check for pressed button
|
||||||
|
bne tape_wait_button_loop
|
||||||
|
|
||||||
|
jsr screen_blank
|
||||||
|
jsr tape_motor_on
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
tape_load_success:
|
||||||
|
|
||||||
|
jsr screen_show
|
||||||
|
jsr tape_motor_off
|
||||||
|
|
||||||
|
jmp lvs_success_end
|
||||||
|
|
||||||
|
|
||||||
|
tape_load_error:
|
||||||
|
|
||||||
|
jsr screen_show
|
||||||
|
jsr tape_motor_off
|
||||||
|
|
||||||
|
jmp lvs_load_verify_error
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in new issue
Block a user