mirror of
https://github.com/fadden/6502bench.git
synced 2024-11-04 15:05:03 +00:00
70ee8793ae
Created the "all ops" tests for W65C02. Filled in enough of the necessary infrastructure to be able to create the project and disassemble the file, though we're not yet handling the instructions correctly.
297 lines
6.1 KiB
ArmAsm
297 lines
6.1 KiB
ArmAsm
; Copyright 2020 faddenSoft. All Rights Reserved.
|
|
; See the LICENSE.txt file for distribution terms (Apache 2.0).
|
|
;
|
|
; Assembler: Merlin 32
|
|
|
|
; Macros for Rockwell extensions. We use the 3-arg format to
|
|
; cut down on the code size.
|
|
BBR MAC ;BBR bit,zp,label
|
|
DFB ]1*16+$0f
|
|
DFB ]2
|
|
DFB ]3-*-1
|
|
<<<
|
|
BBS MAC ;BBS bit,zp,label
|
|
DFB ]1*16+$8f
|
|
DFB ]2
|
|
DFB ]3-*-1
|
|
<<<
|
|
RMB MAC ;RMB bit,zp
|
|
DFB ]1*16+$07
|
|
DFB ]2
|
|
<<<
|
|
SMB MAC ;SMB bit,zp
|
|
DFB ]1*16+$87
|
|
DFB ]2
|
|
<<<
|
|
|
|
ORG $1000
|
|
|
|
JSR PostBRK
|
|
JSR PostRTI
|
|
JSR PostRTS
|
|
JSR PostJMPI
|
|
JSR PostJMPX
|
|
JSR PostSTP
|
|
NOP
|
|
NOP
|
|
NOP
|
|
|
|
BRK ZP ;$00
|
|
PostBRK ORA (ZP,X)
|
|
DFB $02,ZP
|
|
DFB $03
|
|
TSB ZP
|
|
ORA ZP
|
|
ASL ZP
|
|
RMB 0;ZP
|
|
PHP
|
|
ORA #ZP
|
|
ASL
|
|
DFB $0B
|
|
TSB: ABS
|
|
ORA: ABS
|
|
ASL: ABS
|
|
BBR 0;ZP;PostBBR0
|
|
PostBBR0 BPL PostBPL ;$10
|
|
PostBPL ORA (ZP),Y
|
|
ORA (ZP)
|
|
DFB $13
|
|
TRB ZP
|
|
ORA ZP,X
|
|
ASL ZP,X
|
|
RMB 1;ZP
|
|
CLC
|
|
ORA: ABS,Y
|
|
INC
|
|
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