From d02c8b6a3a82c4a987557522b6b21abc8429a688 Mon Sep 17 00:00:00 2001 From: Curtis F Kaylor Date: Thu, 14 Nov 2019 12:30:41 -0500 Subject: [PATCH] Added A02 Assembler test files --- work/a02.bat | 17 +++- work/a02test.a02 | 106 +++++++++++++++++++ work/opcodes.a02 | 258 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 378 insertions(+), 3 deletions(-) create mode 100644 work/a02test.a02 create mode 100644 work/opcodes.a02 diff --git a/work/a02.bat b/work/a02.bat index fcaac81..fe0619e 100644 --- a/work/a02.bat +++ b/work/a02.bat @@ -1,3 +1,14 @@ -@ECHO Assembling File %1.asm -dasm %1.asm -f3 -o%1.bin -l%1.lst -s%1.sym - +@ECHO OFF +IF "%1" == "" ( + ECHO Usage: %0 a02file + GOTO :EXIT +) +SET ASMEXT="" +IF EXIST %1.a02 SET ASMEXT=a02 +IF EXIST %1.asm SET ASMEXT=asm +IF "%ASMEXT%" == "" ( + ECHO Assembly File %1 Not Found + GOTO :EXIT +) +ECHO Assembling File %1.%ASMEXT% +..\a02.exe %1.%ASMEXT% %1.bin %1.lst >%1.out diff --git a/work/a02test.a02 b/work/a02test.a02 new file mode 100644 index 0000000..245271d --- /dev/null +++ b/work/a02test.a02 @@ -0,0 +1,106 @@ +;A02 Assembler Test File +TRUE: EQU $FF +FALSE: EQU $00 + +one equ 1 +two equ 1 + 1 +three equ one + one + one +four equ three + 1 + + +PNTR: EQU $80 +.local EQU 99 +STRUCT EQU $0FFF + +start ORG $0400 ;Start of Code + SUBROUTINE +flags: CLC + SEC + CLI + SEI + CLV + CLD +.local SED + SUBROUTINE +rgstr: DEX + DEY + INX + INY + TAX + TAY + TSX + TXA + TXS + TYA + SUBROUTINE +retrn: RTI + RTS + SUBROUTINE +stack: PHA + PHP + PHX + PHY + PLA + PLP + PLX + PLY + SUBROUTINE +other: NOP + BRK + SUBROUTINE +branch: BCC rgstr + BCS flags +.loop BEQ retrn + BNE jump + BMI .next + BPL .loop + BRA branch +.next BVC +127 + BVS -128 + SUBROUTINE +jump JMP .next + JMP (words ) + JMP (pntr,x) +.next JSR retrn + SUBROUTINE +memory: ADC #$98 ;Immediate + AND TABLE,Y ;Absolute,Y + CMP PNTR,Y ;Absolute,Y (Zero Page Address) + EOR (PNTR,X) ;(Indirect,X) + LDA (PNTR),Y ;(Indirect),Y + ORA (PNTR) ;(Indirect) + ASL ;Accumulator + DEC PNTR ;ZeroPage + INC PNTR,X ;ZeroPage,X + LSR BYTES ;Absolute + ROL BYTES,X ;Absolute,X + ROR $ABCD,X ;Absolute,X + CPX #$76 ;Immediate + CPY PNTR ;ZeroPage + STY PNTR,X ;ZeroPage,X + STZ $CDEF ;Absolute + LDY $CDEF,X ;Absolute,X + TRB PNTR ;ZeroPage + TSB $1234 ;Absolute + SUBROUTINE +exprsn LDA #PNTR+1 ;Immediate + LDA PNTR+1 ;ZeroPage + LDA (PNTR+2) ;Indirect + LDA (PNTR+4,X) ;(Indirect,X) + LDA (PNTR+6),Y ;(Indirect),Y + LDA STRUCT ;Absolute + LDX #STRUCT ;MSB Immediate + LDA STRUCT+1 + LDX #STRUCT+1 + LDA STRUCT+2 + LDX #<(STRUCT+2) + LDY #>(STRUCT+2) + +BYTES byte 99, %10101010,'~' ;Bytes + byte $12,$34 +HEXES hex 01,23,45,67,AB,CD,EF,1A,2B,3C,D4,E5,F6 ;Hexadecimal +WORDS word $3456 +TABLE word $1357,$9BDF,$2468 +TEXT byte "ABCDEFGHIJKLMNOPQRSTUVWXYZ",0 diff --git a/work/opcodes.a02 b/work/opcodes.a02 new file mode 100644 index 0000000..4ea7f35 --- /dev/null +++ b/work/opcodes.a02 @@ -0,0 +1,258 @@ + PROCESSOR 6502 + ORG $1000 +X00 BRK ;00 +X01 ORA ($10,X) ;01 +X02 BYTE $02 ;NOP #IMD +X03 BYTE $03 ;NOP +X04 TSB $40 ;04 +X05 ORA $50 ;05 +X06 ASL $60 ;06 +X07 BYTE $07 ;RMB0 +X08 PHP ;08 +X09 ORA #$90 ;09 +X0A ASL ;0A +X0B BYTE $0B ;NOP +X0C TSB $CBA9 ;0C +X0D ORA $DCBA ;0D +X0E ASL $EDCB ;0E +X0F BYTE $0F ;BBR0 +X10 BPL X11 ;10 +X11 ORA ($11),Y ;11 +X12 BYTE $12 ;NOP #IMD +X13 BYTE $13 ;NOP +X14 TRB $51 ;14 +X15 ORA $61,X ;15 +X16 ASL $71,X ;16 +X17 BYTE $17 ;RMB1 +X18 CLC ;18 +X19 ORA $A987,Y ;19 +X1A BYTE $1A ;1A +X1B BYTE $1B ;1A +X1C TRB $CBA9 ;1C +X1D ORA $DCBA,X ;1D +X1E ASL $EDCB,X ;1E +X1F BYTE $1F ;BBR1 +X20 JSR $0123 ;20 +X21 AND ($12,X) ;21 +X22 BYTE $22 ;NOP #IMD +X23 BYTE $23 ;NOP +X24 BIT $42 ;24 +X25 AND $52 ;25 +X26 ROL $62 ;26 +X27 BYTE $27 ;RMB2 +X28 PLP ;28 +X29 AND #$92 ;29 +X2A ROL ;2A +X2B BYTE $2B ;2B +X2C BIT $CBDA ;2C +X2D AND $DCBA ;2D +X2E ROL $EDCB ;2E +X2F BYTE $2F ;BBR2 +X30 BMI X33 ;30 +X31 AND ($13),Y ;31 +X32 BYTE $32 ;NOP #IMD +X33 BYTE $33 ;NOP +X34 BIT $43,X ;34 +X35 AND $53,X ;35 +X36 ROL $63,X ;36 +X37 BYTE $37 ;RMB3 +X38 SEC ;38 +X39 AND $9876,Y ;39 +X3A DEC ;3A +X3B BYTE $3B ;NOP +X3C BIT $CBA9,X ;3C +X3D AND $DCBA,X ;3D +X3E ROL $EDCB,X ;3E +X3F BYTE $3F ;BBR3 +X40 RTI ;40 +X41 EOR ($14,X) ;41 +X42 BYTE $42 ;NOP #IMD +X43 BYTE $43 ;NOP +X44 BYTE $44 ;NOP $ZP +X45 EOR $54 ;45 +X46 LSR $64 ;46 +X47 BYTE $47 ;RMB4 +X48 PHA ;48 +X49 EOR #$94 ;49 +X4A LSR ;4A +X4B BYTE $4B ;NOP +X4C JMP $CBA9 ;4C +X4D EOR $DCBA ;4D +X4E LSR $EDCB ;4E +X4F BYTE $4F ;BBR +X50 BVC X55 ;50 +X51 EOR ($15),Y ;51 +X52 EOR ($25) ;52 +X53 BYTE $53 ;NOP +X54 BYTE $54 ;NOP $ZP +X55 EOR $55,X ;55 +X56 LSR $65,X ;56 +X57 BYTE $57 ;RMB5 +X58 CLI ;58 +X59 EOR $9876,Y ;59 +X5A PHY ;5A +X5B BYTE $5B ;NOP +X5C BYTE $5C ;NOP $ABSL +X5D EOR $CBA9,X ;5C +X5E LSR $DCBA,X ;5E +X5F BYTE $5F ;BBR5 +X60 RTS ;60 +X61 ADC ($16,X) ;61 +X62 BYTE $62 ;NOP #IMD +X63 BYTE $63 ;NOP +X64 STZ $46 ;64 +X65 ADC $56 ;65 +X66 ROR $66 ;66 +X67 BYTE $67 ;RMB6 +X68 PLA ;68 +X69 ADC #$96 ;69 +X6A ROR ;6A +X6B BYTE $6B ;NOP +X6C JMP ($CDBA) ;6C +X6D ADC $DCBA ;6D +X6E ROR $EDCB ;6E +X6F BYTE $6F ;BBR6 +X70 BVS X77 ;70 +X71 ADC ($17),Y ;71 +X72 ADC ($27) ;72 +X73 BYTE $73 ;NOP +X74 STZ $47,X ;74 +X75 ADC $57,X ;75 +X76 ROR $67,X ;76 +X77 BYTE $77 ;RMB7 +X78 SEI ;78 +X79 ADC $9875,Y ;79 +X7A PLY ;7A +X7B BYTE $7B ;NOP +X7C JMP ($C7,X) ;7C +X7D ADC $DCBA,X ;7E +X7E ROR $DCBA,X ;7E +X7F BYTE $7F ;BBR7 +X80 BRA X88 ;80 +X81 STA ($18,X) ;81 +X82 BYTE $82 ;NOP #IMD +X83 BYTE $83 ;NOP +X84 STY $48 ;84 +X85 STA $58 ;85 +X86 STX $68 ;86 +X87 BYTE $87 ;SMB0 +X88 DEY ;88 +X89 BIT #$98 ;89 +X8A TXA ;8A +X8B BYTE $8B ;NOP +X8C STY $CBA9 ;8C +X8D STA $DCBA ;8D +X8E STX $EDCB ;8E +X8F BYTE $8F ;BBS0 +X90 BCC X99 ;90 +X91 STA ($19),Y ;91 +X92 STA ($29) ;92 +X93 BYTE $93 ;NOP +X94 STY $49,X ;94 +X95 STA $59,X ;95 +X96 STX $69,Y ;96 +X97 BYTE $97 ;SMB1 +X98 TYA ;98 +X99 STA $9876,Y ;99 +X9A TXS ;9A +X9B BYTE $9B ;NOP +X9C STZ $CBA9 ;9C +X9D STA $DCBA,X ;90 +X9E STZ $EDCB,X ;9E +X9F BYTE $9F ;BBS1 +XA0 LDY #$0A ;A0 +XA1 LDA ($1A,X) ;A1 +XA2 LDX #$2A ;A2 +XA3 BYTE $A3 ;NOP +XA4 LDY $4A ;A4 +XA5 LDA $5A ;A5 +XA6 LDX $6A ;A6 +XA7 BYTE $A7 ;SMB2 +XA8 TAY ;A8 +XA9 LDA #$9A ;A9 +XAA TAX ;AA +XAB BYTE $AB ;NOP +XAC LDY $CBA9 ;AC +XAD LDA $DCBA ;AD +XAE LDX $EDCB ;AE +XAF BYTE $AF ;BBS2 +XB0 BCS XBB ;B0 +XB1 LDA ($1B),Y ;B1 +XB2 LDA ($2B) ;B2 +XB3 BYTE $B3 ;NOP +XB4 LDY $B4,X ;B4 +XB5 LDA $B5,X ;BS +XB6 LDX $B6,Y ;B6 +XB7 BYTE $B7 ;SMB3 +XB8 CLV ;B8 +XB9 LDA $9876,Y ;B9 +XBA TSX ;BA +XBB BYTE $BB ;NOP +XBC STX $CBA9,Y ;BC +XBD LDA $DCBA,X ;BD +XBE LDX $EDCB,Y ;BE +XBF BYTE $BF ;BBS3 +XC0 CPY #$0C ;C0 +XC1 CMP ($1C,X) ;C1 +XC2 BYTE $C2 ;NOP #imd +XC3 BYTE $C3 ;NOP +XC4 CPY $4C ;C4 +XC5 CMP $5C ;C5 +XC6 DEC $6C ;C6 +XC7 BYTE $C7 ;SMB4 +XC8 INY ;C8 +XC9 CMP #$9C ;C9 +XCA DEX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