diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/bit-or.s | 317 | ||||
-rw-r--r-- | test/fib2.s | 2 | ||||
-rw-r--r-- | test/popcnt2.s | 4 | ||||
-rw-r--r-- | test/reg-transfer.s | 3 | ||||
-rw-r--r-- | test/subroutine.s | 13 |
5 files changed, 327 insertions, 12 deletions
diff --git a/test/bit-or.s b/test/bit-or.s new file mode 100644 index 0000000..d87f2d2 --- /dev/null +++ b/test/bit-or.s @@ -0,0 +1,317 @@ +.org 0 +IMM = 1 << 0 ; Immediate Data. +ZM = 1 << 1 ; Zero Matrix. +ZMX = 1 << 2 ; Zero Matrix, indexed with X. +ZMY = 1 << 3 ; Zero Matrix, indexed with Y. +IND = 1 << 4 ; Indirect. +INDX = 1 << 5 ; Indexed Indirect. +INDY = 1 << 6 ; Indirect Indexed. +ABS = 1 << 7 ; Absolute. +REL = 1 << 8 ; Relative. +BREG = 1 << 9 ; B Register. +IMPL = 1 << 10 ; Implied. +INDX2 = 1 << 11 ; Special case of INDX that uses the indirect table. +ZM2 = 1 << 12 ; Special case of Zero Matrix used by JMP, and JSR. + +inst: + ; ADC + .word IMM|ZM|ABS|BREG + .byte $01 + + ; AND + .word IMM|ZM|ABS|BREG + .byte $41 + + ; ASR + .word IMM|ZM|ABS|BREG + .byte $62 + + ; BCC + .word REL + .byte $A0 + + ; BCS + .word REL + .byte $90 + + ; BEQ + .word REL + .byte $B0 + + ; BNE + .word REL + .byte $C0 + + ; BNG + .word REL + .byte $80 + + ; BPO + .word REL + .byte $70 + + ; BRA + .word REL + .byte $F0 + + ; BRK + .word IMPL + .byte $69 + + ; BVC + .word REL + .byte $E0 + + ; BVS + .word REL + .byte $D0 + + ; CLC + .word IMPL + .byte $09 + + ; CLI + .word IMPL + .byte $29 + + ; CLV + .word IMPL + .byte $49 + + ; CMP + .word IMM|ZM|IND|INDY|ABS|BREG|INDX2 + .byte $82 + + ; CPB + .word IMM|ZM|IND|INDY|ABS|INDX2 + .byte $04 + + ; CPS + .word IMPL + .byte $00 + + ; CPX + .word IMM|ZM|IND|ABS + .byte $24 + + ; CPY + .word IMM|ZM|IND|ABS + .byte $44 + + ; DEB + .word IMPL + .byte $99 + + ; DEC + .word IMPL|ZM|ABS + .byte $84 + + ; DEX + .word IMPL + .byte $B9 + + ; DEY + .word IMPL + .byte $79 + + ; DIV + .word IMM|ZM|ABS|BREG + .byte $42 + + ; INB + .word IMPL + .byte $A9 + + ; INC + .word IMPL|ZM|ABS + .byte $A4 + + ; INX + .word IMPL + .byte $C9 + + ; INY + .word IMPL + .byte $89 + + ; JMP + .word ABS|IND|ZM2 + .byte $00 + + ; JSR + .word ABS|IND|ZM2 + .byte $20 + + ; LDA + .word IMM|ZM|ZMX|ZMY|IND|INDX|INDY|ABS + .byte $C2 + + ; LDB + .word IMM|ZM|ZMX|ZMY|IND|INDX|INDY|ABS + .byte $E2 + + ; LDX + .word IMM|ZM|IND|ABS + .byte $64 + + ; LDY + .word IMM|ZM|IND|ABS + .byte $A2 + + ; LSL + .word IMM|ZM|ABS|BREG + .byte $A1 + + ; LSR + .word IMM|ZM|ABS|BREG + .byte $C1 + + ; MUL + .word IMM|ZM|ABS|BREG + .byte $22 + + ; NOP + .word IMPL + .byte $EA + + ; ORA + .word IMM|ZM|ABS|BREG + .byte $61 + + ; PHA + .word IMPL + .byte $8E + + ; PHB + .word IMPL + .byte $AE + + ; PHP + .word IMPL + .byte $6E + + ; PHX + .word IMPL + .byte $EE + + ; PHY + .word IMPL + .byte $CE + + ; PLA + .word IMPL + .byte $9E + + ; PLB + .word IMPL + .byte $BE + + ; PLP + .word IMPL + .byte $7E + + ; PLX + .word IMPL + .byte $FE + + ; PLY + .word IMPL + .byte $DE + + ; ROL + .word IMM|ZM|ABS|BREG + .byte $E1 + + ; ROR + .word IMM|ZM|ABS|BREG + .byte $02 + + ; RTI + .word IMPL + .byte $60 + + ; RTS + .word IMPL + .byte $50 + + ; SBC + .word IMM|ZM|ABS|BREG + .byte $21 + + ; SEC + .word IMPL + .byte $19 + + ; SEI + .word IMPL + .byte $39 + + ; STA + .word ZM|ZMX|ZMY|IND|INDX|INDY|ABS + .byte $28 + + ; STB + .word ZM|ZMX|ZMY|IND|INDX|INDY|ABS + .byte $48 + + ; STX + .word ZM|IND|ABS + .byte $68 + + ; STY + .word ZM|IND|ABS + .byte $08 + + ; TAB + .word IMPL + .byte $0A + + ; TAX + .word IMPL + .byte $4A + + ; TAY + .word IMPL + .byte $2A + + ; TBA + .word IMPL + .byte $1A + + ; TSX + .word IMPL + .byte $8A + + ; TXA + .word IMPL + .byte $5A + + ; TXS + .word IMPL|IMM + .byte $9A + + ; TXY + .word IMPL + .byte $7A + + ; TYA + .word IMPL + .byte $3A + + ; TYX + .word IMPL + .byte $6A + + ; WAI + .word IMPL + .byte $59 + + ; XOR + .word IMM|ZM|ABS|BREG + .byte $81 + + +a +.org 0 +v +q diff --git a/test/fib2.s b/test/fib2.s index ee58697..23f0bf5 100644 --- a/test/fib2.s +++ b/test/fib2.s @@ -18,6 +18,6 @@ fib: tab ; txa ; tay ; - jmp fib ; No, so keep looping. + bra fib ; No, so keep looping. a d diff --git a/test/popcnt2.s b/test/popcnt2.s index 503b074..3aa38f0 100644 --- a/test/popcnt2.s +++ b/test/popcnt2.s @@ -14,7 +14,7 @@ popcnt: bra @loop ; Keep looping. @end: tya ; Return the bit count. - rts ; End of popcnt. + rts.w ; End of popcnt. reset: @@ -27,7 +27,7 @@ reset: tay ; Reset Y. main: pha.q ; Save A. - jsr popcnt ; Get population count. + jsr.w popcnt ; Get population count. tay ; Save it in Y. pla.q ; Get A back. inc ; Increment A by one. diff --git a/test/reg-transfer.s b/test/reg-transfer.s index 37e0d51..b9d1280 100644 --- a/test/reg-transfer.s +++ b/test/reg-transfer.s @@ -17,5 +17,4 @@ bench: ; Execute the program. a -done - +d diff --git a/test/subroutine.s b/test/subroutine.s index d39fc15..122c34c 100644 --- a/test/subroutine.s +++ b/test/subroutine.s @@ -23,21 +23,21 @@ start: ;inb ;stb $C010 ;deb -bench: +@bench: jsr clr_buf - jmp bench + bra @bench clr_buf: tba ; Reset the Accumulator. cpy.w #$1FFF ; Did we clear all of the screen buffer? - bcs clr_buf_end ; Yes, so we're done. + bcs @end ; Yes, so we're done. sta.q (ptr), y ; No, so clear eight bytes. sta.q (ptr2), y ; Clear eight more bytes. tya ; Copy the buffer index. adc #$10 ; Increment the index by 16. tay ; Update the index. - jmp clr_buf ; Keep looping. -clr_buf_end: + bra clr_buf ; Keep looping. +@end: tay ; Set the index back to zero. rts ; End of clr_buf. @@ -46,5 +46,4 @@ clr_buf_end: .org $FFC0 .qword reset a -done - +d |