generally remove some debug output, add missing file, and make KERNAL LOAD routine more complete.
This commit is contained in:
1 parent
d124349e50
commit
fa55c83fff
8 files changed
+162
-31
No files matched your search
@@ -1,6 +1,4 @@
|
|||||||
iec_assert_atn:
|
iec_assert_atn:
|
||||||
jsr printf
|
|
||||||
.byte "ASSERT ATN",$0d,0
|
|
||||||
lda $dd00
|
lda $dd00
|
||||||
ora #$08
|
ora #$08
|
||||||
sta $dd00
|
sta $dd00
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
iec_release_atn:
|
iec_release_atn:
|
||||||
jsr printf
|
|
||||||
.byte "RELEASE ATN",$0d,0
|
|
||||||
lda $dd00
|
lda $dd00
|
||||||
and #$f7
|
and #$f7
|
||||||
sta $dd00
|
sta $dd00
|
||||||
|
|||||||
@@ -5,19 +5,13 @@
|
|||||||
|
|
||||||
iec_rx_byte:
|
iec_rx_byte:
|
||||||
|
|
||||||
inc $062f
|
|
||||||
|
|
||||||
;; First, we wait for the talker to release the CLK line.
|
;; First, we wait for the talker to release the CLK line.
|
||||||
jsr iec_wait_for_clock_release
|
jsr iec_wait_for_clock_release
|
||||||
|
|
||||||
inc $0630
|
|
||||||
|
|
||||||
;; We then release the data line
|
;; We then release the data line
|
||||||
;; (We can use this routine, since we weren't holding CLK, anyway)
|
;; (We can use this routine, since we weren't holding CLK, anyway)
|
||||||
jsr iec_release_clk_and_data
|
jsr iec_release_clk_and_data
|
||||||
|
|
||||||
inc $0631
|
|
||||||
|
|
||||||
;; Wait for talker to assert CLK.
|
;; Wait for talker to assert CLK.
|
||||||
;; If >200usec, then it is EOI and we have to assert the
|
;; If >200usec, then it is EOI and we have to assert the
|
||||||
;; DATA line for 60 usec to tell the TALKER that we have
|
;; DATA line for 60 usec to tell the TALKER that we have
|
||||||
@@ -99,8 +93,6 @@ iec_rx_bit_loop:
|
|||||||
dex
|
dex
|
||||||
bpl iec_rx_bit_loop
|
bpl iec_rx_bit_loop
|
||||||
|
|
||||||
inc $0637
|
|
||||||
|
|
||||||
;; Then we must within 1000usec acknowledge the frame by
|
;; Then we must within 1000usec acknowledge the frame by
|
||||||
;; asserting DATA. At this point, CLK is asserted by the
|
;; asserting DATA. At this point, CLK is asserted by the
|
||||||
;; talker and DATA by us, i.e., we are ready to receive
|
;; talker and DATA by us, i.e., we are ready to receive
|
||||||
|
|||||||
@@ -5,14 +5,12 @@ iec_turnaround_to_listen:
|
|||||||
|
|
||||||
;; Assert data and release clock
|
;; Assert data and release clock
|
||||||
lda $dd00
|
lda $dd00
|
||||||
sta $0420
|
|
||||||
and #$ef ; release clock (bit 4)
|
and #$ef ; release clock (bit 4)
|
||||||
ora #$20 ; assert data (bit 5)
|
ora #$20 ; assert data (bit 5)
|
||||||
sta $dd00
|
sta $dd00
|
||||||
|
|
||||||
;; Wait for clock line to be asserted by the drive
|
;; Wait for clock line to be asserted by the drive
|
||||||
* lda $dd00
|
* lda $dd00
|
||||||
sta $0421
|
|
||||||
and #$40
|
and #$40
|
||||||
bne -
|
bne -
|
||||||
|
|
||||||
@@ -36,8 +34,6 @@ iec_turnaround_to_listen:
|
|||||||
;; sec
|
;; sec
|
||||||
;; rts
|
;; rts
|
||||||
*
|
*
|
||||||
jsr printf
|
|
||||||
.byte "TURNAROUND SUCEEDED",$0d,$00
|
|
||||||
|
|
||||||
;; ATN turn around successful
|
;; ATN turn around successful
|
||||||
clc
|
clc
|
||||||
|
|||||||
@@ -2,13 +2,6 @@ iec_tx_byte:
|
|||||||
|
|
||||||
pha
|
pha
|
||||||
|
|
||||||
sta $0400
|
|
||||||
|
|
||||||
jsr printf
|
|
||||||
.byte "IEC TX BYTE $"
|
|
||||||
.byte $f0, <$0400,>$0400
|
|
||||||
.byte $0d,0
|
|
||||||
|
|
||||||
jsr iec_assert_clk_release_data
|
jsr iec_assert_clk_release_data
|
||||||
|
|
||||||
;; Give devices time to respond
|
;; Give devices time to respond
|
||||||
@@ -16,12 +9,10 @@ iec_tx_byte:
|
|||||||
|
|
||||||
;; Did a device respond? (DATA will be pulled if so)
|
;; Did a device respond? (DATA will be pulled if so)
|
||||||
lda $DD00
|
lda $DD00
|
||||||
sta $0418
|
|
||||||
bpl +
|
bpl +
|
||||||
|
|
||||||
;; No devices present, so we can immediately return with device not found
|
;; No devices present, so we can immediately return with device not found
|
||||||
pla
|
pla
|
||||||
inc $420
|
|
||||||
jmp kernalerror_DEVICE_NOT_FOUND
|
jmp kernalerror_DEVICE_NOT_FOUND
|
||||||
*
|
*
|
||||||
|
|
||||||
@@ -87,12 +78,10 @@ iec_tx_byte_l1:
|
|||||||
bne -
|
bne -
|
||||||
|
|
||||||
;; Timeout - DEVICE NOT PRESENT
|
;; Timeout - DEVICE NOT PRESENT
|
||||||
inc $421
|
|
||||||
jmp kernalerror_DEVICE_NOT_FOUND
|
jmp kernalerror_DEVICE_NOT_FOUND
|
||||||
*
|
*
|
||||||
;; All done.
|
;; All done.
|
||||||
;; End state is TALKER is asserting CLK, and listener is asserting DATA
|
;; End state is TALKER is asserting CLK, and listener is asserting DATA
|
||||||
;; until they are ready for the next byte.
|
;; until they are ready for the next byte.
|
||||||
inc $044f
|
|
||||||
clc
|
clc
|
||||||
rts
|
rts
|
||||||
+3
-3
@@ -5,6 +5,9 @@ load:
|
|||||||
;; Disable IRQs, since timing matters!
|
;; Disable IRQs, since timing matters!
|
||||||
SEI
|
SEI
|
||||||
|
|
||||||
|
;; Display SEARCHING FOR
|
||||||
|
jsr printf
|
||||||
|
.byte "SEARCHING FOR <INSERT FILENAME HERE>",$0d,$0
|
||||||
|
|
||||||
;; Begin sending under attention
|
;; Begin sending under attention
|
||||||
jsr iec_assert_atn
|
jsr iec_assert_atn
|
||||||
@@ -84,9 +87,6 @@ load:
|
|||||||
beq -
|
beq -
|
||||||
|
|
||||||
load_done:
|
load_done:
|
||||||
jsr printf
|
|
||||||
.byte "LOADED",$0d,0
|
|
||||||
|
|
||||||
;; Close file on drive
|
;; Close file on drive
|
||||||
|
|
||||||
;; Command drive to listen and to close the file
|
;; Command drive to listen and to close the file
|
||||||
|
|||||||
@@ -0,0 +1,158 @@
|
|||||||
|
;; printf()-like routine for simplifying debugging
|
||||||
|
|
||||||
|
;; Prints the literal zero-terminated string that follows,
|
||||||
|
;; which may also include special tokens that allow
|
||||||
|
;; printing of hex byte and word values stored at the indicated
|
||||||
|
;; addresses.
|
||||||
|
|
||||||
|
;; .byte 1,$byte = display byte as hex
|
||||||
|
;; .byte 2,$low,$hi = display word as hex
|
||||||
|
;; .byte $f0+n,$low,$hi = display byte at $hi$lo+n as hex
|
||||||
|
|
||||||
|
printf:
|
||||||
|
;; Temporary storage is between end of screen at $0400
|
||||||
|
;; and the sprite pointers at $7f8
|
||||||
|
sta $7f0
|
||||||
|
stx $7f1
|
||||||
|
sty $7f2
|
||||||
|
php
|
||||||
|
pla
|
||||||
|
sta $7f3
|
||||||
|
|
||||||
|
;; Set up read routine
|
||||||
|
lda #$ad ; LDA $nnnn
|
||||||
|
sta $7f4
|
||||||
|
lda #$60
|
||||||
|
sta $7f7 ; RTS
|
||||||
|
|
||||||
|
;; Get PC of caller from the stack, so that
|
||||||
|
;; we can parse through it
|
||||||
|
pla
|
||||||
|
clc
|
||||||
|
adc #$01
|
||||||
|
sta $7f5
|
||||||
|
pla
|
||||||
|
adc #$00
|
||||||
|
sta $7f6
|
||||||
|
|
||||||
|
printf_loop:
|
||||||
|
jsr $7f4
|
||||||
|
cmp #$00
|
||||||
|
bne printf_continues
|
||||||
|
;; Put return address on stack and restore
|
||||||
|
;; registers
|
||||||
|
lda $7f6
|
||||||
|
pha
|
||||||
|
lda $7f5
|
||||||
|
pha
|
||||||
|
lda $7f3
|
||||||
|
pha
|
||||||
|
lda $7f0
|
||||||
|
ldx $7f1
|
||||||
|
ldy $7f2
|
||||||
|
plp
|
||||||
|
rts
|
||||||
|
|
||||||
|
printf_continues:
|
||||||
|
cmp #$01
|
||||||
|
bne not_hexbyte
|
||||||
|
;; Print a hex byte
|
||||||
|
|
||||||
|
;; Skip the token
|
||||||
|
jsr printf_advance
|
||||||
|
;; Read the low byte
|
||||||
|
jsr $7f4
|
||||||
|
;; Print as hex
|
||||||
|
jsr printf_printhexbyte
|
||||||
|
jmp printf_nextchar
|
||||||
|
|
||||||
|
not_hexbyte:
|
||||||
|
cmp #$02
|
||||||
|
bne not_hexword
|
||||||
|
;; Print a hex word
|
||||||
|
|
||||||
|
;; Skip the token
|
||||||
|
jsr printf_advance
|
||||||
|
jsr printf_advance
|
||||||
|
;; Read the high byte
|
||||||
|
jsr $7f4
|
||||||
|
;; Print as hex
|
||||||
|
jsr printf_printhexbyte
|
||||||
|
;; Skip the token
|
||||||
|
jsr printf_retreat
|
||||||
|
;; Read the low byte
|
||||||
|
jsr $7f4
|
||||||
|
;; Print as hex
|
||||||
|
jsr printf_printhexbyte
|
||||||
|
jsr printf_advance
|
||||||
|
jmp printf_nextchar
|
||||||
|
|
||||||
|
not_hexword:
|
||||||
|
cmp #$f0
|
||||||
|
bcc not_pointer
|
||||||
|
|
||||||
|
;; Treat two-byte arg as base address
|
||||||
|
;; and lower 4 bits of token as offset from
|
||||||
|
;; that location.
|
||||||
|
|
||||||
|
;; Get offset
|
||||||
|
and #$0f
|
||||||
|
tay
|
||||||
|
|
||||||
|
jsr printf_advance
|
||||||
|
jsr $7f4
|
||||||
|
sta $fd
|
||||||
|
jsr printf_advance
|
||||||
|
jsr $7f4
|
||||||
|
sta $fe
|
||||||
|
|
||||||
|
lda ($fd),y
|
||||||
|
jsr printf_printhexbyte
|
||||||
|
jmp printf_nextchar
|
||||||
|
|
||||||
|
not_pointer:
|
||||||
|
;; Print character
|
||||||
|
jsr $ffd2
|
||||||
|
|
||||||
|
printf_nextchar:
|
||||||
|
jsr printf_advance
|
||||||
|
|
||||||
|
jmp printf_loop
|
||||||
|
|
||||||
|
printf_advance:
|
||||||
|
;; Advance pointer to next character
|
||||||
|
inc $7f5
|
||||||
|
bne +
|
||||||
|
inc $7f6
|
||||||
|
*
|
||||||
|
rts
|
||||||
|
|
||||||
|
printf_retreat:
|
||||||
|
;; Retreat pointer to previous char
|
||||||
|
lda $7f5
|
||||||
|
sec
|
||||||
|
sbc #1
|
||||||
|
sta $7f5
|
||||||
|
lda $7f6
|
||||||
|
sbc #0
|
||||||
|
sta $7f6
|
||||||
|
rts
|
||||||
|
|
||||||
|
printf_printhexbyte:
|
||||||
|
pha
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
ora #$30
|
||||||
|
cmp #$3A
|
||||||
|
bcc +
|
||||||
|
adc #6
|
||||||
|
* jsr $ffd2
|
||||||
|
pla
|
||||||
|
and #$0f
|
||||||
|
ora #$30
|
||||||
|
cmp #$3A
|
||||||
|
bcc +
|
||||||
|
adc #6
|
||||||
|
* jmp $ffd2
|
||||||
+1
-1
@@ -159,7 +159,7 @@ char *error_list[]={
|
|||||||
"LOAD", // https://www.discogs.com/Gimmik-Load-Error/release/482462
|
"LOAD", // https://www.discogs.com/Gimmik-Load-Error/release/482462
|
||||||
// Non-error messages
|
// Non-error messages
|
||||||
"READY.\r", // #29 // https://www.ibm.com/support/knowledgecenter/zosbasics/com.ibm.zos.zconcepts/zconc_whatistsonative.htm https://github.com/stefanhaustein/expressionparser
|
"READY.\r", // #29 // https://www.ibm.com/support/knowledgecenter/zosbasics/com.ibm.zos.zconcepts/zconc_whatistsonative.htm https://github.com/stefanhaustein/expressionparser
|
||||||
"LOADING", // https://community.tibco.com/wiki/how-show-loading-prompt-when-reloading-external-data
|
"LOADING", // #30 // https://community.tibco.com/wiki/how-show-loading-prompt-when-reloading-external-data
|
||||||
"VERIFYING", // https://discussions.apple.com/thread/8087203
|
"VERIFYING", // https://discussions.apple.com/thread/8087203
|
||||||
"SAVING",
|
"SAVING",
|
||||||
"ERROR", // #33 // Simply the word error that is attached to the other parts of messages https://fjkraan.home.xs4all.nl/comp/apple2faq/app2asoftfaq.html
|
"ERROR", // #33 // Simply the word error that is attached to the other parts of messages https://fjkraan.home.xs4all.nl/comp/apple2faq/app2asoftfaq.html
|
||||||
|
|||||||
Reference in new issue
Block a user