aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2014-06-01 15:15:41 -0700
committerH. Peter Anvin <hpa@zytor.com>2014-06-01 15:15:41 -0700
commit7bb2f72cc1c688447f446ccbc440310a296e22d9 (patch)
treed7d5fc5181a953bc458420ebc6531dd7056a5e64
parent78c734aef743b43c87c82eacbee3e0d2d2c9555f (diff)
downloadabc80-7bb2f72cc1c688447f446ccbc440310a296e22d9.tar.gz
abc80-7bb2f72cc1c688447f446ccbc440310a296e22d9.tar.xz
abc80-7bb2f72cc1c688447f446ccbc440310a296e22d9.zip
dumpregs: useful debugging routine
-rw-r--r--data/dumpregs.asm82
1 files changed, 82 insertions, 0 deletions
diff --git a/data/dumpregs.asm b/data/dumpregs.asm
new file mode 100644
index 0000000..c19e0f5
--- /dev/null
+++ b/data/dumpregs.asm
@@ -0,0 +1,82 @@
+; ---------------------------------------------------------------------------
+; Debug
+; ---------------------------------------------------------------------------
+
+dumpregs:
+ push iy
+ push ix
+ push hl
+ push de
+ push bc
+ push af
+
+ ld a,60
+ out (1),a
+
+ ld hl,7*2
+ add hl,sp
+ push hl ; Original value of SP
+
+ ld de,-8*2
+ add hl,de
+
+ ld de,regnames
+dr1:
+ ld a,(de)
+ call debugbyte
+ inc de
+ cp ':'
+ jr z,dr2
+ and a
+ jr nz,dr1
+
+ ld a,36
+ out (1),a
+
+ pop hl
+ pop af
+ pop bc
+ pop de
+ pop hl
+ pop ix
+ pop iy
+ ret
+
+dr2:
+ push de
+ ld c,4
+ ld e,(hl)
+ inc hl
+ ld d,(hl)
+ inc hl
+dr3:
+ ld a,3
+ ld b,4
+dr4:
+ sla e
+ rl d
+ adc a,a
+ djnz dr4
+ cp 3Ah
+ jr c,dr5
+ add 41h-3Ah
+dr5:
+ call debugbyte
+ dec c
+ jr nz,dr3
+ pop de
+ jr dr1
+
+debugbyte:
+ push af
+db1:
+ in a,(1)
+ and 20h
+ jr nz,db1
+ pop af
+ out (0),a
+ ret
+regnames:
+ defb 255,192
+ defm "SP: AF: BC: DE: HL: IX: IY: PC:"
+ defb 13, 10, 0