Browse Source

Add ASM instruction test.

master
Ben Kurtovic 8 years ago
parent
commit
c8ecf01600
4 changed files with 98 additions and 0 deletions
  1. +1
    -0
      tests/asm/06-formatting.asm
  2. +96
    -0
      tests/asm/08-instructions.asm
  3. +1
    -0
      tests/asm/manifest
  4. BIN
     

+ 1
- 0
tests/asm/06-formatting.asm View File

@@ -12,4 +12,5 @@ foo: .inCLUde "06.inc.asm"

ayy: lmao:
di
InC a
ret

+ 96
- 0
tests/asm/08-instructions.asm View File

@@ -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

+ 1
- 0
tests/asm/manifest View File

@@ -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

BIN
View File


Loading…
Cancel
Save