From c8ecf0160062726505440ce4a4cc35ac471464d9 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Fri, 8 Apr 2016 14:39:03 -0500 Subject: [PATCH] Add ASM instruction test. --- tests/asm/06-formatting.asm | 1 + tests/asm/08-instructions.asm | 96 ++++++++++++++++++++++++++++++++++++++++++ tests/asm/manifest | 1 + tests/asm/roms.tar.gz | Bin 1158 -> 1488 bytes 4 files changed, 98 insertions(+) diff --git a/tests/asm/06-formatting.asm b/tests/asm/06-formatting.asm index f8533d8..b15f805 100644 --- a/tests/asm/06-formatting.asm +++ b/tests/asm/06-formatting.asm @@ -12,4 +12,5 @@ foo: .inCLUde "06.inc.asm" ayy: lmao: di + InC a ret diff --git a/tests/asm/08-instructions.asm b/tests/asm/08-instructions.asm index 3ecdba0..a9859b6 100644 --- a/tests/asm/08-instructions.asm +++ b/tests/asm/08-instructions.asm @@ -5,3 +5,99 @@ ; 08-instructions.asm ; Exhaustive test of instruction syntax + +.define COUNTER $C010 +.define OFFSET 6 +.define OFFSET2 157 + +.org $1000 + +str1: .ascii "Hello, world!" + +.org $0000 +main: + di + call inst + halt + +.org $0066 +nmi: + retn + +.org $2000 +inst: + inc a + inc c + inc hl + inc sp + inc (hl) + inc ( hl ) + inc ix + inc iyl + inc (ix) + inc ( ix ) + inc (iy+0) + inc (ix+3) + inc (ix+OFFSET) + inc (ix-OFFSET) + inc ( ix + 7 ) + inc (ix-8) + inc (ix - +9) + inc (iy+127) + inc (iy-128) + + add a, e + add a, 5 + add a, $12 + add a, (hl) + add a, (ix+4) + add hl, bc + add ix, de + + adc a, e + adc a, 5 + adc a, $12 + adc a, (hl) + adc a, (ix+4) + adc hl, bc + + rlca + rrca + rla + rra + daa + cpl + scf + ccf + halt + exx + ei + di + cpd + cpdr + cpi + cpir + ind + indr + ini + inir + ldd + lddr + ldi + ldir + otdr + otir + outd + outi + rrd + rld + + ld hl, COUNTER ; H contains $C0, L contains $10 + ld d, (hl) ; D contains $FF (garbage) + ld c, $3B ; C contains $3B + ld (hl), c ; memory address $C010 contains $3B + + ld hl, str1 + ld b, (hl) ; B contains 'H' + ld hl, (str1) ; H contains 'e', L contains 'H' + ld (hl), b ; error, writing to cartridge ROM diff --git a/tests/asm/manifest b/tests/asm/manifest index 2a0f414..75a5147 100644 --- a/tests/asm/manifest +++ b/tests/asm/manifest @@ -5,3 +5,4 @@ 05-includes.asm 05-includes.gg 06-formatting.asm 06-formatting.gg 07-data.asm 07-data.gg +08-instructions.asm 08-instructions.gg diff --git a/tests/asm/roms.tar.gz b/tests/asm/roms.tar.gz index e86fb67526f6bcb7129ab7e85ca8ab1a2ab6ea5b..10d3d107b7c0b101830cf5dd1dc4aed4117e4769 100644 GIT binary patch literal 1488 zcmaizeNfVO9LH&GCwJSTuASCEF|*4DoK9y>B{+9Z#%|N|p|#Z1)4-XgBSn0`hg)lr zq+I!wIkXcWP)8b`f&xC|ktPsR6MVv_nTCqw4+IsJX}5L#BYpq;{_}plKA-moP6dN% zz~GCZ!>S=^d^O3^?6ta$r*IIR`^@M3CZZ9{#-gNdQY3ArYW`?&QLe3zv=EO!=Yo}$ zVX4-36aknzgMO%sUKYYFa>9R)CP2dYX|GOI2tEOO+Bu0*T@N4PsbIFs6Z-Y&4SuDX zjDAh-giOn#k~{&SZb~srD(O(9SlLuLh*oTu8$6%c)h<)WK`ngd>87XGaP)7d>_j#= z!WYAQ>1@>K5)Ct!sFtokIYcivT}(#7FyGqh5Xj`~KK@I5*6E4x%VF5K*~IVb<)5!O zVIHT|DaPaUW}88r^5@~cA-FR7mCNpDPYP2k?*?2gu^`S9TM!LMDnC%3UnCr(0o>l6 z<`FoJt(dAD^GIAy!LRgbVRh*~Vgu>}lkuQ#WCAPcN_k_vV_d_V?3guwUhD8GB(EmX zgWgVI4!C+h>$vLgny1XzcB#J<@#3yr!WK6ofa}{A2j*5V>5~VTFJ!^r;~r(zCi7rR zMp}!D%vX2kgPXERQySB_pl;)D``Z~1s$@}m;XdQ7cNx8GDqkR+m-?6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