apps/memt: new app

This commit is contained in:
Virgil Dupras 2019-06-16 20:53:21 -04:00
parent 7c23e5a9ef
commit 5e31de0bac
2 changed files with 53 additions and 0 deletions

20
apps/memt/glue.asm Normal file
View File

@ -0,0 +1,20 @@
; memt
;
; Write all possible values in all possible addresses that follow the end of
; this program. That means we don't test all available RAM, but well, still
; better than nothing...
;
; If there's an error, prints out where.
;
; *** Requirements ***
; printstr
; printHexPair
;
; *** Includes ***
#include "user.h"
.org USER_CODE
jp memtMain
#include "memt/main.asm"

33
apps/memt/main.asm Normal file
View File

@ -0,0 +1,33 @@
memtMain:
ld de, memtEnd
.loop:
ld b, 0
.iloop:
ld a, b
ld (de), a
ld a, (de)
cp b
jr nz, .notMatching
djnz .iloop
inc de
xor a
cp d
jr nz, .loop
cp e
jr nz, .loop
; we rolled over 0xffff, stop
ld hl, .sOk
xor a
jp printstr ; returns
.notMatching:
ld hl, .sNotMatching
call printstr
ex de, hl
ld a, 1
jp printHexPair ; returns
.sNotMatching:
.db "Not matching at pos ", 0xd, 0xa, 0
.sOk:
.db "OK", 0xd, 0xa, 0
memtEnd: