Skip to content

Commit

Permalink
new test for branching, fails
Browse files Browse the repository at this point in the history
  • Loading branch information
ahl27 committed Feb 2, 2023
1 parent fc2a0a1 commit e2b1946
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 0 deletions.
57 changes: 57 additions & 0 deletions tests/arithmetic.asm
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,66 @@ main:
sbc $21
sta $22 ; Should store E6

; increment/decrement
lda #$05
sta $30
inc $30 ; inc, should store $06
tax
inx
inx
stx $31 ; inx, should store $07
txa
dex
stx $32 ; dex, should store $06
tay
iny
sty $33 ; iny, should store $08
dey
dey
sty $34 ; dey, should store $06
sty $35
dec $35 ; dec, should store $05

; shifts
clc
lda #08 ; 0000 1000 = $08
sta $40
asl
sta $41 ; store $10
lsr
sta $42 ; store $08
sec
ror
sta $43 ; 1000 0100 = $84
sec
asl
rol
sta $44 ; 0001 0001 = $11 (carry bit should shift correctly)

; Logical operations
lda #$0F
sta $50 ; 0000 1111, lower nibble bitmask
lda #$19
and $50
sta $51 ; 0000 1111 & 0001 1001 = 0000 1001 = $09
eor $50
sta $52 ; 0000 1111 ^ 0000 1001 = 0000 0110 = $06
lda #$E0
ora $50
sta $53 ; 0000 1111 | 1110 0000 = 1110 1111 = $EF
brk


;;; Expected Ending Memory Map:
;; 0000 0B 70 7B 00 00 00 00 00 00 00 00 00 00 00 00 00
;; 0010 AB B7 62 00 00 00 00 00 00 00 00 00 00 00 00 00
;; 0020 F0 0A E6 00 00 00 00 00 00 00 00 00 00 00 00 00
;; 0030 06 07 06 08 06 05 00 00 00 00 00 00 00 00 00 00
;; 0040 08 10 08 84 11 00 00 00 00 00 00 00 00 00 00 00
;; 0050 0F 09 06 EF 00 00 00 00 00 00 00 00 00 00 00 00
;; 0060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00



.dsb $fffa-*,$ff
.word $00
Expand Down
Binary file modified tests/arithmetic.o65
Binary file not shown.
54 changes: 54 additions & 0 deletions tests/branching.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
* = $C000

;; Jump/Branching operations

main:
lda #$0

; Testing jmp, should store $45 at $00
; Obviously jsr/rts is better, but trying to test jmp
;; TODO: There's a bug here, I'm double decoding address--basically using indirect when it shouldn't be
;; Not sure if I can change it without affecting other stuff
jmp setA45
lda #$0
returnfromjmp:
sta $00

; Testing jsr/rts/bne
jsr testSubroutine
brk

;4c = 010 011 00



setA45:
lda #$45
jmp returnfromjmp

testSubroutine:
; Should store $20 at positions $0010-0015
ldx #$05
lda #$20
.(
loop:
sta $10,X
dey
bne loop
rts
.)


;;; Expected Ending Memory Map:
;; 0000 00 00 00 00 00 00 00 00 06 00 00 00 0e 00 10 00 |................|
;; 0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
;; 0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
;; 0030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
;; 0040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
;; 0050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
;; 0060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|

.dsb $fffa-*,$ff
.word $00
.word $C000
.word $00
Binary file added tests/branching.o65
Binary file not shown.

0 comments on commit e2b1946

Please sign in to comment.