# HG changeset patch # User boisy # Date 1057028121 0 # Node ID 5d025106d1eadfb0175b01abb1051fd5b9eeb749 # Parent 0216c89fdd9675e7ddc95c68fb342485bd64aee6 Rodney added bitfield instructions diff -r 0216c89fdd96 -r 5d025106d1ea level1/cmds/asm.asm --- a/level1/cmds/asm.asm Tue Jul 01 02:24:36 2003 +0000 +++ b/level1/cmds/asm.asm Tue Jul 01 02:55:21 2003 +0000 @@ -11,6 +11,7 @@ * Ed. Comments Who YY/MM/DD * ------------------------------------------------------------------ * 6 Made compliant with 1900-2155 BGP 99/05/11 +* 7 Added 6309 bitfield instructions RVH 03/06/27 nam Asm ttl 6809/6309 Assembler @@ -19,10 +20,10 @@ use defsfile endc -tylg set Prgrm+Objct +tylg set Prgrm+Objct atrv set ReEnt+rev -rev set $02 -edition set $06 +rev set $00 +edition set $07 mod eom,name,tylg,atrv,asm,size @@ -36,13 +37,11 @@ PrintPC equ %00000001 Print PC flag DoNothng equ %00000000 Do nothing (no flags set) -Numop equ 148 # of opcodes in table (including pseudo-ops) +Numop equ 160 # of opcodes in table (including pseudo-ops) u0000 rmb 2 Ptr to start of current source line -u0002 rmb 1 -u0003 rmb 1 -u0004 rmb 1 -u0005 rmb 1 +u0002 rmb 2 +u0004 rmb 2 u0006 rmb 1 u0007 rmb 1 u0008 rmb 1 @@ -51,56 +50,41 @@ u000B rmb 1 u000C rmb 1 u000D rmb 1 -u000E rmb 1 -u000F rmb 1 +u000E rmb 2 u0010 rmb 2 u0012 rmb 2 u0014 rmb 2 -u0016 rmb 1 -u0017 rmb 1 +u0016 rmb 2 u0018 rmb 1 Path number to source file u0019 rmb 1 u001A rmb 1 Some output path number u001B rmb 2 -u001D rmb 1 -u001E rmb 1 -u001F rmb 1 -u0020 rmb 1 +u001D rmb 2 +u001F rmb 2 u0021 rmb 1 -u0022 rmb 1 -u0023 rmb 1 -u0024 rmb 1 -u0025 rmb 1 -u0026 rmb 1 -u0027 rmb 1 -u0028 rmb 1 -u0029 rmb 1 +u0022 rmb 2 +u0024 rmb 2 +u0026 rmb 2 +u0028 rmb 2 u002A rmb 1 u002B rmb 1 Bit flags u002C rmb 1 -u002D rmb 1 -u002E rmb 1 +u002D rmb 2 u002F rmb 2 Ptr to start of current mnemonic u0031 rmb 2 Ptr to next field (or operand start) -u0033 rmb 1 -u0034 rmb 1 +u0033 rmb 2 u0035 rmb 1 u0036 rmb 1 Page height (default=66) u0037 rmb 1 Page width (default=80) -u0038 rmb 1 -u0039 rmb 1 -u003A rmb 1 -u003B rmb 1 +u0038 rmb 2 +u003A rmb 2 u003C rmb 1 u003D rmb 1 u003E rmb 1 u003F rmb 1 -u0040 rmb 1 -u0041 rmb 1 -u0042 rmb 1 -u0043 rmb 1 -u0044 rmb 1 -u0045 rmb 1 +u0040 rmb 2 +u0042 rmb 2 +u0044 rmb 2 u0046 rmb 1 # bytes in current instruction u0047 rmb 1 Current instructions flags/index handler byte u0048 rmb 1 @@ -112,8 +96,7 @@ u004E rmb 1 Indexed mode calc completed flag (0=no) u004F rmb 1 u0050 rmb 1 -u0051 rmb 1 -u0052 rmb 1 +u0051 rmb 2 u0053 rmb 1 u0054 rmb 1 u0055 rmb 1 @@ -133,44 +116,9 @@ u0062 rmb 1 Current instruction's opcode u0063 rmb 1 More bytes as needed by instruction u0064 rmb 1 -u0065 rmb 4 -u0069 rmb 1 -u006A rmb 3 -u006D rmb 2 -u006F rmb 1 -u0070 rmb 1 -u0071 rmb 1 -u0072 rmb 1 -u0073 rmb 2 -u0075 rmb 11 -u0080 rmb 1 -u0081 rmb 2 -u0083 rmb 2 -u0085 rmb 2 -u0087 rmb 1 -u0088 rmb 2 -u008A rmb 2 -u008C rmb 1 -u008D rmb 1 -u008E rmb 1 -u008F rmb 8 -u0097 rmb 15 -u00A6 rmb 1 -u00A7 rmb 2 -u00A9 rmb 6 -u00AF rmb 7 -u00B6 rmb 11 -u00C1 rmb 1 -u00C2 rmb 1 -u00C3 rmb 3 -u00C6 rmb 8 -u00CE rmb 1 -u00CF rmb 8 -u00D7 rmb 10 -u00E1 rmb 7 -u00E8 rmb 4 -u00EC rmb 12 -u00F8 rmb 3848 Main buffer area +u0065 rmb 2 +u0067 rmb 1 temp postbyte storage for 6309 bit ops + rmb 4096-. Main buffer area size equ . name equ * fcs /Asm/ @@ -200,7 +148,7 @@ leau -$01,y stu L062A,pc Point to some table ldd d,y Get 2 bytes @ offset D @@ -570,9 +518,9 @@ bsr L033D L0322 lbsr L1368 L0325 inc 255' -L06F7 fcb $00 + fcb $00 L06F8 fcc 'reg name' -L0700 fcb $00 + fcb $00 L0701 fcc 'reg sizes' -L070A fcb $00 + fcb $00 L070B fcc 'input path' -L0715 fcb $00 + fcb $00 L0716 fcc 'object path' -L0721 fcb $00 + fcb $00 L0722 fcc 'index reg' -L072B fcb $00 + fcb $00 L072C fcc '] missing' -L0735 fcb $00 + fcb $00 L0736 fcc 'needs label' -L0741 fcb $00 + fcb $00 L0742 fcc 'opt list' -L074A fcb $00 + fcb $00 L074B fcc 'const def' -L0754 fcb $00 + fcb $00 L0755 fcc /can't open / -L0760 fcb $00 + fcb $00 L0761 fcc 'label not allowed' -L0772 fcb $00 + fcb $00 L0773 fcc 'cond nesting' -L077F fcb $00 + fcb $00 * Index by opcode-type jump table -L0780 fdb L079E-L0780 $001E (LBRA/LBSR) (type 0) - fdb L07A5-L0780 $0025 (orcc/andcc/cwai) (type 1) +L0780 fdb L079E-L0780 $001E type 0 (LBRA/LBSR) + fdb L07A5-L0780 $0025 type 1 (orcc/andcc/cwai) fdb L07B9-L0780 $0039 type 2 fdb L07CE-L0780 $004E type 3 - fdb L07F3-L0780 $0073 (CLR,etc.) (type 4) + fdb L07F3-L0780 $0073 type 4 (CLR,etc.) fdb L0826-L0780 $00A6 type 5 fdb L082F-L0780 $00AF type 6 fdb L0846-L0780 $00C6 type 7 @@ -1103,11 +1079,12 @@ fdb L08E1-L0780 $0161 fdb L08F9-L0780 $0179 fdb L0F29-L0780 $07A9 + fdb TypeF-L0780 $???? type F (bitfield ops OIM,BAND,etc) * LBRA/LBSR (type 0) L079E lda #$03 # bytes require for instruction sta L09A2,pc Point to register names - pshs x Save start of current register we are checking ldb #16 # of register names to check +L0971 pshs x Save start of current register we are checking L0973 lda ,y Get byte from reg. name beq L098F If NUL (empty entry), skip this entry cmpa ,x+ Compare with source @@ -1479,56 +1534,26 @@ leas $02,s Eat X off the stack lda $02,y Get PSH/PUL bit mask andcc #$FE No error & return - rts + rts * Stack table: 2 bytes for reg. name, 1 byte for bit mask for PSH/PUL * Positions (done in reverse from highest to lowest) indicates the bit * mask for register to register operations (ex. TFR) -L09A2 fcc 'F' %1111 - fcb $00,$00 - - fcc 'E' %1110 - fcb $00,$00 - - fcb $00,$00,$00 %1101 (2nd zero register won't be used) - - fcc '0' %1100 Zero register - fcb $00,$00 - - fcc 'DP' %1011 - fcb $08 - - fcc 'CC' %1010 - fcb $01 - - fcc 'B' %1001 - fcb $00,$04 - - fcc 'A' %1000 - fcb $00,$02 - - fcc 'V' %0111 - fcb $00,00 - - fcc 'W' %0110 - fcb $00,$00 - - fcc 'PC' %0101 - fcb $80 - - fcc 'S' %0100 - fcb $00,$40 - - fcc 'U' %0011 - fcb $00,$40 - - fcc 'Y' %0010 - fcb $00,$20 - - fcc 'X' %0001 - fcb $00,$10 - - fcc 'D' %0000 - fcb $00,$06 (A & B combined) +L09A2 fcb 'F,00,$00 %1111 F + fcb 'E,00,$00 %1110 E + fcb 00,00,$00 %1101 (2nd zero register won't be used) + fcb '0,00,$00 %1100 Zero register + fcb 'D,'P,$08 %1011 DP + fcb 'C,'C,$01 %1010 CC + fcb 'B,00,$04 %1001 B + fcb 'A,00,$02 %1000 A + fcb 'V,00,$00 %0111 V + fcb 'W,00,$00 %0110 W + fcb 'P,'C,$80 %0101 PC + fcb 'S,00,$40 %0100 S + fcb 'U,00,$40 %0011 U + fcb 'Y,00,$20 %0010 Y + fcb 'X,00,$10 %0001 X + fcb 'D,00,$06 %0000 D (A & B combined) * Generic memory mode addressing handler: Indexed, Extended, Direct Page L09C6 lbsr L1164 Parse for next field in source @@ -1588,7 +1613,7 @@ L0A20 stb L10AA,pc Point to powers of 10 table @@ -2498,14 +2526,14 @@ ldd $02,s bita #$F0 bne L1160 - lslb - rola - lslb - rola - lslb - rola - lslb - rola + lslb + rola + lslb + rola + lslb + rola + lslb + rola addb ,s adca #$00 std $02,s @@ -2517,13 +2545,13 @@ bcs L114D stb ,s ldd $02,s - lslb - rola + lslb + rola std $02,s - lslb - rola - lslb - rola + lslb + rola + lslb + rola bcs L1160 addd $02,s bcs L1160 @@ -2538,28 +2566,28 @@ L1121 ldb ,x+ subb #$30 bcs L114D - lsrb + lsrb bne L114D rol $03,s rol $02,s bcs L1160 inc $01,s bra L1121 -L1134 clra - clrb +L1134 clra + clrb std $02,s std $04,s - rts + rts L113B ldb ,x+ cmpb #$30 bcs L1145 cmpb #$39 bls L1148 L1145 orcc #$01 - rts + rts L1148 subb #$30 andcc #$FE - rts + rts L114D leax -$01,x tst $01,s beq L1159 @@ -2569,7 +2597,7 @@ L1159 orcc #$04 L115B orcc #$01 L115D leas $04,s - rts + rts L1160 andcc #$FB bra L115B @@ -2581,26 +2609,26 @@ cmpa #$20 Space? beq L1164 Yes, eat it leax -$01,x Found next field; point to it & return - rts + rts L116D pshs x,d lda $03,s - mul + mul pshs b,a lda $02,s ldb $05,s - mul + mul addb ,s stb ,s lda $03,s ldb $04,s - mul + mul addb ,s stb ,s ldd ,s ldx #$0000 leas $06,s - rts + rts L118E pshs y,x,b,a ldd ,s bne L1198 @@ -2608,11 +2636,11 @@ bra L11B8 L1198 ldd #$0010 stb $04,s - clrb + clrb L119E lsl $03,s rol $02,s - rolb - rola + rolb + rola subd ,s bmi L11AC inc $03,s @@ -2624,12 +2652,13 @@ ldd $02,s andcc #$FE L11B8 leas $06,s - rts + rts L11BB sta ,x+ L11BD lda ,y+ bne L11BB - rts + rts +* expression evaluator L11C2 pshs u,y Preserve regs leau ,s Point U to copy of Y on stack bsr L1164 Parse for next field @@ -2641,30 +2670,30 @@ L11D0 bsr L1211 pshs d L11D4 lda ,x - cmpa #'- + cmpa #'- Minus? bne L11E2 bsr L120F - nega - negb + nega + negb sbca #$00 bra L11E8 -L11E2 cmpa #$2B +L11E2 cmpa #$2B Plus? bne L11EE bsr L120F L11E8 addd ,s std ,s bra L11D4 -L11EE tsta +L11EE tsta Null? beq L120D - cmpa #$0D + cmpa #$0D CR? beq L120D - cmpa #$20 + cmpa #$20 Space? beq L120D - cmpa #$2C + cmpa #$2C Comma? beq L120D - cmpa #$29 + cmpa #$29 Rt paren? beq L120D - cmpa #$5D + cmpa #$5D Rt bracket? beq L120D L1205 ldb #$06 L1207 leas ,u @@ -2712,8 +2741,8 @@ orb $01,s ora ,s bra L1267 -L125D cmpa #'? ??? - bne L120D +L125D cmpa #'? Logical EOR? + bne L120D No, return bsr L126B eorb $01,s eora ,s @@ -2724,16 +2753,16 @@ cmpa #'^ Is it a NOT? bne L1279 No, check next bsr L1284 - comb - coma + comb + coma bra L1283 L1279 cmpa #'- Is it negative? bne L1288 No, check next bsr L1284 - nega - negb + nega + negb sbca #$00 -L1283 rts +L1283 rts L1284 leax 1,x L1286 lda ,x Get character from source code L1288 cmpa #'( Math grouping start symbol? @@ -2752,21 +2781,21 @@ bne L12AA No, check next ldd 255 error L1304 lbsr L02FA ldd #$FFFF orcc #$01 - rts + rts L130D bsr L134D pshs x,d ldx