X-Git-Url: http://git.joshuawise.com/fpgaboy.git/blobdiff_plain/30ef1ae0e1d60f55aee401ad9741cb8d5a0feef0..f2b745a710572fd5cb2b1cf97d1d05a9b74d4fe1:/diag.asm diff --git a/diag.asm b/diag.asm index 004935a..786052e 100644 --- a/diag.asm +++ b/diag.asm @@ -13,7 +13,8 @@ main: ld hl, $DF81 xor a - ld [hl], a + ld [hli], a + ld [hli], a ld hl, signon call puts @@ -44,26 +45,24 @@ irqhand: ld c, $0F ; ack the irq ld [c], a + ld hl, $DF82 + ld a, [hld] + cp 0 + jr z, .noprint ld a, $41 ; print A call putc - - ld hl, $DF81 +.noprint: ld a, [hl] - ld b, 1 - add b + add 1 ld c, $51 ld [c], a ld [hl], a - POP HL POP DE POP BC POP AF RETI - db $18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE - db $18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE - db $18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE,$18,$FE ; Memory tester: writes h ^ l to all addresses from C000 to DF80. memtest: @@ -75,11 +74,11 @@ memtest: ld a,h xor l ld [hli],a - ld a, $DF - cp h + ld a, h + cp $DF jr nz, .wr - ld a, $80 - cp l + ld a, l + cp $80 jr nz, .wr ld hl, $C001 ; Read loop @@ -91,11 +90,11 @@ memtest: cp b jr nz, .memfail - ld a, $DF - cp h + ld a, h + cp $DF jr nz, .rd - ld a, $80 - cp l + ld a, l + cp $80 jr nz, .rd ld hl, testokstr ; Say we're OK @@ -130,16 +129,12 @@ puthex: ; Put two hex nibbles to the serial console. rra rra rra - ld b,$0F - and b - ld b,$30 - add b + and $0F + add $30 call putc pop af - ld b,$0F - and b - ld b,$30 - add b + and $0F + add $30 call putc ret @@ -147,19 +142,22 @@ puthex: ; Put two hex nibbles to the serial console. waitsw: ld hl,waitswstr call puts + + ld hl,$DF82 + ld a, 1 + ld [hl], a ld c, $51 xor a ld [c],a - ld b, $0 .loop1: ld a,[c] - cp b + cp $0 jr z,.loop1 .loop2: ld a,[c] - cp b + cp $0 jr nz,.loop2 ret @@ -203,8 +201,7 @@ insntest: ; Test JR ld a, $FF - ld b, $00 - cp b + cp $0 jr nz,.jr ld hl, .jrfail jr .fail @@ -226,20 +223,17 @@ insntest: ; Test CP. ld hl, .cpfail ld a, $10 - ld b, $20 - cp b + cp $20 jr nc,.fail ld a, $20 - ld b, $10 - cp b + cp $10 jr c,.fail ; Test CPL ld hl, .cplfail ld a, $55 - ld b, $AA cpl - cp b + cp $AA jr nz,.fail ld hl, .ok @@ -275,12 +269,11 @@ insntest: ; Serial port manipulation functions. putc: - ld b, 0 ld c, $50 push af .waitport: ld a,[c] - cp b + cp $00 jr nz,.waitport pop af ld [c],a @@ -288,8 +281,7 @@ putc: puts: ld a, [hli] - ld b, $00 - cp b + cp $00 ret z call putc jr puts