From 2d767e9fe77d396cc5222be57ae0272ada31fbae Mon Sep 17 00:00:00 2001 From: Chris Pressey Date: Fri, 23 Nov 2018 23:11:06 +0000 Subject: [PATCH] Add example program that suggests we've got the arguments backwards. --- eg/rudiments/cmp.60p | 74 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 eg/rudiments/cmp.60p diff --git a/eg/rudiments/cmp.60p b/eg/rudiments/cmp.60p new file mode 100644 index 0000000..23ec7ee --- /dev/null +++ b/eg/rudiments/cmp.60p @@ -0,0 +1,74 @@ +// Should print ENLGG + +word w1 +word w2 + +define chrout routine + inputs a + trashes a + @ 65490 + +define main routine + outputs w1, w2 + trashes a, x, y, z, n, c, v +{ + copy 4000, w1 + copy 4000, w2 + + cmp w1, w2 + if z { + ld a, 69 // E + call chrout + } else { + ld a, 78 // N + call chrout + } + + copy 4000, w1 + copy 4001, w2 + + cmp w1, w2 + if z { + ld a, 69 // E + call chrout + } else { + ld a, 78 // N + call chrout + } + + copy 20000, w1 + copy 20001, w2 + + cmp w1, w2 + if c { + ld a, 71 // G + call chrout + } else { + ld a, 76 // L + call chrout + } + + copy 20001, w1 + copy 20001, w2 + + cmp w1, w2 + if c { + ld a, 71 // G + call chrout + } else { + ld a, 76 // L + call chrout + } + + copy 20002, w1 + copy 20001, w2 + + cmp w1, w2 + if c { + ld a, 71 // G + call chrout + } else { + ld a, 76 // L + call chrout + } +}