From 29b6097585ddfd042990650eff92fc75b63b40e0 Mon Sep 17 00:00:00 2001 From: n loewen Date: Tue, 1 Aug 2023 15:51:59 +0100 Subject: [PATCH] Track tests --- test-programs/chp.asm | 11 +++++++++++ test-programs/fill-display.asm | 23 +++++++++++++++++++++++ test-programs/jmp-to-label.asm | 10 ++++++++++ 3 files changed, 44 insertions(+) create mode 100644 test-programs/chp.asm create mode 100644 test-programs/fill-display.asm create mode 100644 test-programs/jmp-to-label.asm diff --git a/test-programs/chp.asm b/test-programs/chp.asm new file mode 100644 index 0000000..e61d00c --- /dev/null +++ b/test-programs/chp.asm @@ -0,0 +1,11 @@ +;; test CHP instruction + +ADD 8 ; Acc = 8 +CHP 0 ; shouldn't hop (CF = 0) +ADD 1 ; Acc = 9 +ADD 8 ; Acc = 1 and CF = 1 +CHP 0 ; hop! (CF = 1) +END +SUB 1 ; Acc = 0 +CFC 0 ; CF = 0 +END \ No newline at end of file diff --git a/test-programs/fill-display.asm b/test-programs/fill-display.asm new file mode 100644 index 0000000..d52ae34 --- /dev/null +++ b/test-programs/fill-display.asm @@ -0,0 +1,23 @@ +;; Fill display with $FF + +LDA $00 +STO $21 ; Pixel index + +; store the $FF that we'll use to fill the screen +LDA $FF +STO $22 + +@copy-to-display + LDA ($22) ; A = mem[$22] = $FF + STO ($21) ; mem[mem[$21]] = A = $FF + +; increment pixel index +LDA ($21) +ADD $01 +STO $21 + +; if CF is set, then the display is full and we're done +CHP + JMP @copy-to-display + +END \ No newline at end of file diff --git a/test-programs/jmp-to-label.asm b/test-programs/jmp-to-label.asm new file mode 100644 index 0000000..258c806 --- /dev/null +++ b/test-programs/jmp-to-label.asm @@ -0,0 +1,10 @@ +;; test jumping to a label + +ADD 15 +ADD 10 ; should set CF +JMP @end +ADD 1 +ADD 2 +ADD 3 +@end +END \ No newline at end of file