added some debug code
This commit is contained in:
1 parent
5c556c3b75
commit
521d0e7994
3 files changed
+97
-9
No files matched your search
@@ -0,0 +1,82 @@
|
|||||||
|
|
||||||
|
|
||||||
|
DBG_print_PC_opcode:
|
||||||
|
|
||||||
|
php
|
||||||
|
pha
|
||||||
|
phx
|
||||||
|
phy
|
||||||
|
phz
|
||||||
|
|
||||||
|
pha
|
||||||
|
|
||||||
|
jsr PRIMM
|
||||||
|
!pet $0D, "PC: ", 0
|
||||||
|
|
||||||
|
dew REG_PC
|
||||||
|
lda REG_PC+1
|
||||||
|
jsr DBGINT_print_hex_byte
|
||||||
|
lda REG_PC+0
|
||||||
|
jsr DBGINT_print_hex_byte
|
||||||
|
inw REG_PC
|
||||||
|
|
||||||
|
jsr PRIMM
|
||||||
|
!pet " opcode: ", 0
|
||||||
|
|
||||||
|
pla
|
||||||
|
@1:
|
||||||
|
beq @1
|
||||||
|
jsr DBGINT_print_hex_byte
|
||||||
|
|
||||||
|
; FALLTROUGH
|
||||||
|
|
||||||
|
DBGINT_end:
|
||||||
|
|
||||||
|
plz
|
||||||
|
ply
|
||||||
|
plx
|
||||||
|
pla
|
||||||
|
plp
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
DBG_print_hex:
|
||||||
|
|
||||||
|
php
|
||||||
|
pha
|
||||||
|
phx
|
||||||
|
phy
|
||||||
|
phz
|
||||||
|
|
||||||
|
pha
|
||||||
|
lda #' '
|
||||||
|
jsr CHROUT
|
||||||
|
pla
|
||||||
|
jsr DBGINT_print_hex_byte
|
||||||
|
jmp DBGINT_end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
DBGINT_print_hex_byte:
|
||||||
|
|
||||||
|
pha
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
ora #$30
|
||||||
|
cmp #$3A
|
||||||
|
bcc @1
|
||||||
|
adc #6
|
||||||
|
@1:
|
||||||
|
jsr CHROUT
|
||||||
|
pla
|
||||||
|
and #$0f
|
||||||
|
ora #$30
|
||||||
|
cmp #$3A
|
||||||
|
bcc @2
|
||||||
|
adc #6
|
||||||
|
@2:
|
||||||
|
jmp CHROUT
|
||||||
@@ -8,6 +8,9 @@
|
|||||||
; Fetch and execute next opcode
|
; Fetch and execute next opcode
|
||||||
|
|
||||||
+Z80_FETCH_VIA_PC_INC
|
+Z80_FETCH_VIA_PC_INC
|
||||||
|
|
||||||
|
; jsr DBG_print_PC_opcode
|
||||||
|
|
||||||
asl
|
asl
|
||||||
tax
|
tax
|
||||||
bcs @1
|
bcs @1
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ ZVM_cputest:
|
|||||||
|
|
||||||
; XXX move loading code to separate routine(s)
|
; XXX move loading code to separate routine(s)
|
||||||
|
|
||||||
|
|
||||||
; Copy file name to RAM
|
; Copy file name to RAM
|
||||||
|
|
||||||
ldx #$FF
|
ldx #$FF
|
||||||
@@ -30,7 +31,7 @@ ZVM_cputest:
|
|||||||
|
|
||||||
; Try to find the file
|
; Try to find the file
|
||||||
|
|
||||||
lda #$34
|
lda #$34 ; dos_findfile
|
||||||
sta HTRAP00
|
sta HTRAP00
|
||||||
+nop
|
+nop
|
||||||
+bcc @end
|
+bcc @end
|
||||||
@@ -38,13 +39,15 @@ ZVM_cputest:
|
|||||||
jsr PRIMM
|
jsr PRIMM
|
||||||
!pet "Loading Z80TEST.COM", 0
|
!pet "Loading Z80TEST.COM", 0
|
||||||
|
|
||||||
; Open the file
|
; Close all the files, to make sure handle is available
|
||||||
|
|
||||||
lda #$00
|
lda #$22 ; dos_closeall
|
||||||
sta HTRAP00
|
sta HTRAP00
|
||||||
+nop
|
+nop
|
||||||
|
|
||||||
lda #$18
|
; Open the file
|
||||||
|
|
||||||
|
lda #$18 ; dos_openfile
|
||||||
sta HTRAP00
|
sta HTRAP00
|
||||||
+nop
|
+nop
|
||||||
|
|
||||||
@@ -55,9 +58,9 @@ ZVM_cputest:
|
|||||||
|
|
||||||
; Prepare pointers
|
; Prepare pointers
|
||||||
|
|
||||||
lda #$FF
|
lda #$0F
|
||||||
sta BIOS_IOBUFERPTR+3
|
sta BIOS_IOBUFERPTR+3
|
||||||
lda #$D6
|
lda #$FD
|
||||||
sta BIOS_IOBUFERPTR+2
|
sta BIOS_IOBUFERPTR+2
|
||||||
|
|
||||||
lda #$00 ; $0005:0100 - from CP/M point of view this is start of page 1 in bank 1
|
lda #$00 ; $0005:0100 - from CP/M point of view this is start of page 1 in bank 1
|
||||||
@@ -89,7 +92,7 @@ ZVM_cputest:
|
|||||||
|
|
||||||
; Read up to 512 bytes
|
; Read up to 512 bytes
|
||||||
|
|
||||||
lda #$1A
|
lda #$1A ; dos_readfile
|
||||||
sta HTRAP00
|
sta HTRAP00
|
||||||
+nop
|
+nop
|
||||||
|
|
||||||
@@ -123,7 +126,7 @@ ZVM_cputest:
|
|||||||
|
|
||||||
; Close the file
|
; Close the file
|
||||||
|
|
||||||
lda #$20
|
lda #$20 ; dos_closefile
|
||||||
sta HTRAP00
|
sta HTRAP00
|
||||||
+nop
|
+nop
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user