From 5e31de0bacad045ffb555323c6211b871af66b9e Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sun, 16 Jun 2019 20:53:21 -0400 Subject: [PATCH] apps/memt: new app --- apps/memt/glue.asm | 20 ++++++++++++++++++++ apps/memt/main.asm | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 apps/memt/glue.asm create mode 100644 apps/memt/main.asm diff --git a/apps/memt/glue.asm b/apps/memt/glue.asm new file mode 100644 index 0000000..ec1f1f0 --- /dev/null +++ b/apps/memt/glue.asm @@ -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" diff --git a/apps/memt/main.asm b/apps/memt/main.asm new file mode 100644 index 0000000..62bd30c --- /dev/null +++ b/apps/memt/main.asm @@ -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: +