home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
archives
/
appleii.zip
/
appxas.1
< prev
next >
Wrap
Text File
|
1990-12-05
|
23KB
|
759 lines
#!/bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #!/bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
# assmtest
# assmtest.l
# makefile
# user.nr
# This archive created: Tue Apr 2 14:21:42 1985
# By: James Van Ornum (AT&T-Bell Laboratories)
export PATH; PATH=/bin:$PATH
if test -f 'assmtest'
then
echo shar: over-writing existing file "'assmtest'"
fi
cat << \SHAR_EOF > 'assmtest'
;******************************************
; Test file for the 65c02 assembler - as65c02
; assemble as
; as65c02 -nisv assmtest
; and compare output with assmtest.l
;******************************************
;; comment treatment
;******************************************
aa = $10; ';' immediately after the '0'
B = $20 space to comment subfield
C = $30 tab to comment subfield
DEFGHIjkl = $FFEE
D =DEFGHIjkl
;******************************************
; Number formats
;******************************************
start *= $4 ; location counter adjust
.byte %0101 ; binary number
.byte 022,@22,^o22 ; octal numbers - three forms
.byte 22 ; decimal number
.byte $22,$ff,$FF ; hex - upper/lower case
.byte 'a,'b ; single ASCII characters
;******************************************
;; ASCII character string
;******************************************
.byte "abcd\t\n",0 ; tab and new line escaped
;******************************************
; Operation checks
;******************************************
.word aa+B ; addition
.word aa-B ; subtraction
.word aa*B ; multiplication
.word B/aa ; division
.word C%B ; modulo
.word B!C ; exclusive OR
.word ~C ; one's complement
.word B&C ; logical AND
.word aa|B ; logical OR
.word D\ ; low byte
.word D^ ; high byte
.word * ; current location
.word aa,B,C
.word B*<aa+C> ; one level of parenthesis
.dbyt D ; high byte-low byte word
.word D/256,D%256
;******************************************
; Addressing Mode Check
;******************************************
*=$0100
lda =aa ; immediate addressing
lda #aa ; immediate addressing, alternate
lda D ; direct addessing
LDA aa ; page zero addressing, aa < 256
a1 = 512
a2 = 500
lda a1-a2 ; also page zero
asl A ; accumulator addressing
AsL a ; accumulator addressing also
brk ; implied addressing
lda (aa,X) ; indirect,X addressing
lda (aa),Y ; indirect,Y addressing
lda aa,X ; zero page,X addressing
lda D,X ; absolute,X addressing
lda D,Y ; absolute,Y addressing
bcc *-$10 ; relative addressing
jmp (D) ; indirect addressing
jmp (a2,x) ; abs indexed indirect
adc (aa) ; indirect zero page
ldx aa,Y ; zero page,Y addressing
ldx aa,y ; alternate index name
.nlst
;******************************************
; opcode check
;******************************************
adc =01
and =01
and (aa)
asl A
bcc *+2
bcs *+2
beq *+2
bit $01
bit $301,x
bit $01,x
bmi *+2
bne *+2
bpl *+2
bra *+2
brk
bvc *+2
bvs *+2
clc
cld
cli
clv
cmp =01
cmp (aa)
cpx =01
cpy =01
dea
dec $01
dex
dey
eor =01
eor (aa)
ina
inc $01
inx
iny
jmp *+3
jsr *+3
lda =01
lda (aa)
ldx =01
ldy =01
lsr A
nop
ora =01
ora (aa)
pha
php
phx
phy
pla
plp
plx
ply
rol A
ror A
rti
rts
sbc =01
sbc (aa)
sec
sed
sei
sta $01
sta (aa)
stx $01
sty $01
stz $301
stz $301,x
stz $01
stz $01,x
tax
tay
trb $301
trb $01
tsb $301
tsb $01
tsx
txa
txs
tya
.title some way for a listing
.sbttl check for .ifeq
.ifeq 0
.byte 1,2,3,$34,@10
.endc
.ifne 0
.word 1234,$4354,@7777
.endc
; now check nesting
.ifeq 0
lda .
.ifne 0
m2 .asciz /help/
.endc
m3 nasc <more of same>
.endc
msb ON
.asciz /high order bits on /
nasc <should not be affected> 1
msb off
.asciz /high order bits off/
nasc <still not affected> 0
m31 org *+2
m4 .word .+34
m41 org .+2
m5 .byte
; now lets try some blank lines
.asciz /this is ok?/
nasc <how about this>
.byte 0,$e
.word 2 ;how about two in a row
.title what does the control l mean
.sbttl perhaps is the Dec 20 way of new page, anyway ignore it
.ifeq 1
.sbttl Lets check to see if we skip
.asciz /this should not assemble/
.sbttl these lines
.endc
.sbttl now this is the living end
aaaa equ aa+3
aaa equ abc+5
.byte 3
abc nasc <the end>
.byte 255
org $100
.asciz /1/
jmp d
jmp d+2
lda cba
lda abc-4
.byte 3
nasc <1>
nasc <22> 1
baaa = 7+d ; can you handle this
nasc <three> 0
d lda #4
cba .word 2345
bbc
ldx d+3^
lda cba
lda baaa
jmp bbc
lda #3
rep lda #23
org $fe
.ifeq <.\-$ff> ;what does the loc counter say
nop
.endc
.ifeq <.\-$fe> ; loc ctr
nop
nop
.endc
SHAR_EOF
if test -f 'assmtest.l'
then
echo shar: over-writing existing file "'assmtest.l'"
fi
cat << \SHAR_EOF > 'assmtest.l'
as65c02 - version 4.1b - 11/22/84 - JHV [gvw]
1 ;******************************************
2 ; Test file for the 65c02 assembler - as65c02
3 ; assemble as
4 ; as65c02 -nisv assmtest
5 ; and compare output with assmtest.l
6 ;******************************************
7 ; ; comment treatment
8 ;******************************************
9 0010 aa = $10 ; ';' immediately after the '0'
10 0020 B = $20 space to comment subfield
11 0030 C = $30 tab to comment subfield
12 FFEE DEFGHIjkl = $FFEE
13 FFEE D =DEFGHIjkl
14 ;******************************************
15 ; Number formats
16 ;******************************************
17 0004 start *= $4 ; location counter adjust
18 0004 05 .byte %0101 ; binary number
19 0005 12 12 12 .byte 022,@22,^o22 ; octal numbers - three forms
20 0008 16 .byte 22 ; decimal number
21 0009 22 FF FF .byte $22,$ff,$FF ; hex - upper/lower case
22 000C 61 62 .byte 'a,'b ; single ASCII characters
23 ;******************************************
24 ; ; ASCII character string
25 ;******************************************
26 000E 61 62 63 .byte "abcd\t\n",0 ; tab and new line escaped
0011 64 09 0A
0014 00
27 ;******************************************
28 ; Operation checks
29 ;******************************************
30 0015 30 00 .word aa+B ; addition
31 0017 F0 FF .word aa-B ; subtraction
32 0019 00 02 .word aa*B ; multiplication
33 001B 02 00 .word B/aa ; division
34 001D 10 00 .word C%B ; modulo
35 001F 10 00 .word B!C ; exclusive OR
36 0021 CF FF .word ~C ; one's complement
37 0023 20 00 .word B&C ; logical AND
38 0025 30 00 .word aa|B ; logical OR
39 0027 EE 00 .word D\ ; low byte
40 0029 FF 00 .word D^ ; high byte
41 002B 2B 00 .word * ; current location
42 002D 10 00 .word aa,B,C
002F 20 00
0031 30 00
43 0033 00 08 .word B*<aa+C> ; one level of parenthesis
44 0035 FF EE .dbyt D ; high byte-low byte word
45 0037 FF 00 .word D/256,D%256
0039 EE 00
46 ;******************************************
47 ; Addressing Mode Check
48 ;******************************************
49 0100 *=$0100
50 0100 A9 10 lda =aa ; immediate addressing
51 0102 A9 10 lda #aa ; immediate addressing, alternate
52 0104 AD EE FF lda D ; direct addessing
53 0107 A5 10 LDA aa ; page zero addressing, aa < 256
54 0200 a1 = 512
55 01F4 a2 = 500
56 0109 A5 0C lda a1-a2 ; also page zero
57 010B 0A asl A ; accumulator addressing
58 010C 0A AsL a ; accumulator addressing also
59 010D 00 brk ; implied addressing
60 010E A1 10 lda (aa,X) ; indirect,X addressing
61 0110 B1 10 lda (aa),Y ; indirect,Y addressing
62 0112 B5 10 lda aa,X ; zero page,X addressing
63 0114 BD EE FF lda D,X ; absolute,X addressing
64 0117 B9 EE FF lda D,Y ; absolute,Y addressing
65 011A 90 EE bcc *-$10 ; relative addressing
66 011C 6C EE FF jmp (D) ; indirect addressing
67 011F 7C F4 01 jmp (a2,x) ; abs indexed indirect
68 0122 72 10 adc (aa) ; indirect zero page
69 0124 B6 10 ldx aa,Y ; zero page,Y addressing
70 0126 B6 10 ldx aa,y ; alternate index name
72 ;******************************************
73 ; opcode check
74 ;******************************************
75 0128 69 01 adc =01
76 012A 29 01 and =01
77 012C 32 10 and (aa)
78 012E 0A asl A
79 012F 90 00 bcc *+2
80 0131 B0 00 bcs *+2
81 0133 F0 00 beq *+2
82 0135 24 01 bit $01
83 0137 3C 01 03 bit $301,x
84 013A 34 01 bit $01,x
85 013C 30 00 bmi *+2
86 013E D0 00 bne *+2
87 0140 10 00 bpl *+2
88 0142 80 00 bra *+2
89 0144 00 brk
90 0145 50 00 bvc *+2
91 0147 70 00 bvs *+2
92 0149 18 clc
93 014A D8 cld
94 014B 58 cli
95 014C B8 clv
96 014D C9 01 cmp =01
97 014F D2 10 cmp (aa)
98 0151 E0 01 cpx =01
99 0153 C0 01 cpy =01
100 0155 3A dea
101 0156 C6 01 dec $01
102 0158 CA dex
103 0159 88 dey
104 015A 49 01 eor =01
105 015C 52 10 eor (aa)
106 015E 1A ina
107 015F E6 01 inc $01
108 0161 E8 inx
109 0162 C8 iny
110 0163 4C 66 01 jmp *+3
111 0166 20 69 01 jsr *+3
112 0169 A9 01 lda =01
113 016B B2 10 lda (aa)
114 016D A2 01 ldx =01
115 016F A0 01 ldy =01
116 0171 4A lsr A
117 0172 EA nop
118 0173 09 01 ora =01
119 0175 12 10 ora (aa)
120 0177 48 pha
121 0178 08 php
122 0179 DA phx
123 017A 5A phy
124 017B 68 pla
125 017C 28 plp
126 017D FA plx
127 017E 7A ply
128 017F 2A rol A
129 0180 6A ror A
130 0181 40 rti
131 0182 60 rts
132 0183 E9 01 sbc =01
133 0185 F2 10 sbc (aa)
134 0187 38 sec
135 0188 F8 sed
136 0189 78 sei
137 018A 85 01 sta $01
138 018C 92 10 sta (aa)
139 018E 86 01 stx $01
140 0190 84 01 sty $01
141 0192 9C 01 03 stz $301
142 0195 9E 01 03 stz $301,x
143 0198 64 01 stz $01
144 019A 74 01 stz $01,x
145 019C AA tax
146 019D A8 tay
147 019E 1C 01 03 trb $301
148 01A1 14 01 trb $01
149 01A3 0C 01 03 tsb $301
150 01A6 04 01 tsb $01
151 01A8 BA tsx
152 01A9 8A txa
153 01AA 9A txs
154 01AB 98 tya
155 .title some way for a listing
156 .sbttl check for .ifeq
157 .ifeq 0
158 01AC 01 02 03 .byte 1,2,3,$34,@10
01AF 34 08
159 .endc
160 .ifne 0
161 .word 1234,$4354,@7777
162 .endc
163 ; now check nesting
164 .ifeq 0
165 01B1 AD B1 01 lda .
166 .ifne 0
167 m2 .asciz /help/
168 .endc
169 01B4 ED EF F2 m3 nasc <more of same>
01B7 E5 A0 EF
01BA E6 A0 F3
01BD E1 ED E5
170 .endc
171 msb ON
172 01C0 E8 E9 E7 .asciz /high order bits on /
01C3 E8 A0 EF
01C6 F2 E4 E5
01C9 F2 A0 E2
01CC E9 F4 F3
01CF A0 EF EE
01D2 A0 00
173 01D4 F3 E8 EF nasc <should not be affected> 1
01D7 F5 EC E4
01DA A0 EE EF
01DD F4 A0 E2
01E0 E5 A0 E1
01E3 E6 E6 E5
01E6 E3 F4 E5
01E9 E4 00
174 msb off
175 01EB 68 69 67 .asciz /high order bits off/
01EE 68 20 6F
01F1 72 64 65
01F4 72 20 62
01F7 69 74 73
01FA 20 6F 66
01FD 66 00
176 01FF F3 F4 E9 nasc <still not affected> 0
0202 EC EC A0
0205 EE EF F4
0208 A0 E1 E6
020B E6 E5 E3
020E F4 E5 E4
177 0213 m31 org *+2
178 0213 35 02 m4 .word .+34
179 0217 m41 org .+2
180 0217 00 m5 .byte
181 ; now lets try some blank lines
182 0218 74 68 69 .asciz /this is ok?/
021B 73 20 69
021E 73 20 6F
0221 6B 3F 00
183
184 0224 E8 EF F7 nasc <how about this>
0227 A0 E1 E2
022A EF F5 F4
022D A0 F4 E8
0230 E9 F3
185
186 0232 00 0E .byte 0,$e
187
188
189 0234 02 00 .word 2 ;how about two in a row
190 .title what does the control l mean
191 .sbttl perhaps is the Dec 20 way of new page, anyway ignore it
192 .ifeq 1
193 .sbttl Lets check to see if we skip
194 .asciz /this should not assemble/
195 .sbttl these lines
196 .endc
197 .sbttl now this is the living end
198 0013 aaaa equ aa+3
199 023C aaa equ abc+5
200 0236 03 .byte 3
201 0237 F4 E8 E5 abc nasc <the end>
023A A0 E5 EE
023D E4
202 023E FF .byte 255
203 0100 org $100
204 0100 31 00 .asciz /1/
205 0102 4C 18 01 jmp d
206 0105 4C 1A 01 jmp d+2
207 0108 AD 1A 01 lda cba
208 010B AD 33 02 lda abc-4
209 010E 03 .byte 3
210 010F B1 nasc <1>
211 0110 B2 B2 00 nasc <22> 1
212 011F baaa = 7+d ; can you handle this
213 0113 F4 E8 F2 nasc <three> 0
0116 E5 E5
214 0118 A9 04 d lda #4
215 011A 29 09 cba .word 2345
216 011C bbc
217 011C A6 01 ldx d+3^
218 011E AD 1A 01 lda cba
219 0121 AD 1F 01 lda baaa
220 0124 4C 1C 01 jmp bbc
221 0127 A9 03 lda #3
222 0129 A9 17 rep lda #23
223 00FE org $fe
224 .ifeq <.\-$ff> ;what does the loc counter say
225 nop
226 .endc
227 .ifeq <.\-$fe> ; loc ctr
228 00FE EA nop
229 00FF EA nop
230 .endc
aa 10:00 0010
B 20:00 0020
C 30:00 0030
DEFGHIjkl EE:FF FFEE
D EE:FF FFEE
start 04:00 0004
a1 00:02 0200
a2 F4:01 01F4
m2 00:00 0000
m3 B4:01 01B4
m31 13:02 0213
m4 13:02 0213
m41 17:02 0217
m5 17:02 0217
aaaa 13:00 0013
aaa 3C:02 023C
abc 37:02 0237
d 18:01 0118
cba 1A:01 011A
baaa 1F:01 011F
bbc 1C:01 011C
rep 29:01 0129
SHAR_EOF
if test -f 'makefile'
then
echo shar: over-writing existing file "'makefile'"
fi
cat << \SHAR_EOF > 'makefile'
as6502: assm0.o assm1.o assm2.o assm3.o
cc assm0.o assm1.o assm2.o assm3.o -o as65c02
assm0.o: assm.d1 assm.d2 assm0.c
cc -c -O assm0.c
assm1.o: assm.d1 assm.d2 assm1.c
cc -c -O assm1.c
assm2.o: assm.d1 assm.d2 assm2.c
cc -c -O assm2.c
assm3.o: assm.d1 assm.d2 assm3.c
cc -c -O assm3.c
check: assmtest.l
assmtest.l: as6502 assmtest
as65c02 -nisv assmtest > temp
touch assmtest.l
diff assmtest.l temp
manuals: as6502.l user.l
as6502.l: as6502.1
nroff -man as6502.1 > as6502.l
user.l: user.nr
nroff user.nr > user.l
clean:
rm assm0.o assm1.o assm2.o assm3.o temp as6502.l user.l
SHAR_EOF
if test -f 'user.nr'
then
echo shar: over-writing existing file "'user.nr'"
fi
cat << \SHAR_EOF > 'user.nr'
.de hd
'sp 3
.tl ''\fBas6502 User Notes\fR'Page %'
'sp 2
..
.de fo
'bp
..
.wh 0 hd
.wh -3 fo
.br
\fBSOURCE LINE FORMAT\fR:
.ti 0.5i
.sp 1
<label> <operation> <operand> <comment>
.sp 1
Each field is terminated by one or more spaces, a tab or a ';' (which
begins the comment field immediately).
.sp
\fBLABEL FIELD\fR:
.sp 1
If first character is ';', entire line is a comment.
If first character is space, label field is null.
Labels are alphanumeric strings beginning
with 'a' through 'z', 'A' through 'Z',
underscore or period followed by any of the above
characters or '0' through '9'.
Currently, labels are limited to 19 characters.
A, X, Y, a, x and y are reserved labels.
.sp
\fBOPERATION FIELD\fR:
.sp 1
Upper and lower case letters are equivalent.
Machine operation mnemonics are:
.in 0.5i
.nf
.sp 1
ADC BMI CLD DEX JSR PHA RTS STY
AND BNE CLI DEY LDA PHP SBC TAX
ASL BPL CLV EOR LDX PLA SEC TAY
BCC BRK CMP INC LDY PLP SED TSX
BCS BVC CPX INX LSR ROL SEI TXA
BEQ BVS CPY INY NOP ROR STA TXS
BIT CLC DEC JMP ORA RTI STX TYA
BRA DEA INA PHX PHY PLX PLY STZ TRB TSB
.in 0
.fi
.sp 1
Pseudo operation mnemonics are:
.in 1.2i
.ti 0.5i
.sp 1
= equate label name to operand field value
(space is not needed to terminate this operation).
.ti 0.5i
*= set location counter to operand field value
(space is not needed to terminate this operation).
.ti 0.5i
.tr*.
*WORD assign 16 bit value of operand field to next
two locations; low byte of value first, then high byte.
.ti 0.5i
*DBYT assign 16 bit value of operand field to next
two locations; high byte of value first, then low byte.
.ti 0.5i
*BYTE assign 8 bit value of operand field to next
location.
.ti 0.5i
*NLST turn listing mode off (this source
line is not listed).
.ti 0.5i
*LIST turn listing mode on (normal mode) (this
source line is not listed).
.tr**
.in 0
.sp 1
\fBOPERAND FIELD\fR:
.sp 1
Operand field expressions use infix notation and are evaluated strictly
from left to right.
No imbedded spaces are permitted.
.sp 1
Operand field terms include labels and numbers.
Asterisk (*) is the label for the location counter value.
Numbers are binary, octal, decimal, hexadecimal or ASCII.
Number type is indicated by the first character of the number string as follows:
.nf
.in 0.5i
.sp 1
% binary prefix
@ or 0 octal prefix
1 - 9 decimal by default (prefix is part of number)
$ hexadecimal prefix
.tr,'
, ASCII character prefix
.tr,,
" ASCII character string prefix and suffix; in the
string, \\t is a tab character, \\n is a new line.
.in 0
.fi
.sp 1
Operand field operations and the corresponding symbols are:
.in 0.5i
.nf
.sp 1
+ addition
- subtraction
/ division
* multiplication
% modulo (remainder after integer division)
^ logical exclusive OR
& logical AND
| logical OR
< low byte
> high byte
.in 0
.fi
.sp 1
\fBERROR MESSAGES\fR:
.in 0.5i
.nf
.sp 1
Invalid operation code
Invalid argument count (when as6502 was invoked)
Open error for file
Creat error for object file 6502.out
Close error
Close error (6502.out)
Symbol table full
Label multiply defined
Sync error (pass 1 symbol value not equal pass 2 symbol value)
Invalid branch address
Operand field missing
Invalid addressing mode
Operand field size error
Undefined symbol in operand field
Invalid operand field
.fi
.in 0
.sp 1
\fBINVOKING as6502\fR:
.sp 1
.ti 0.5i
as6502 {-ilnos} <source files descriptions>
.sp 1
Options:
.in 0.5i
.nf
.sp 1
-i ignore any .nlst pseudo operations
-l list errors only
-n print addresses as <high byte><low byte>,
rather than as <low byte>:<high byte>.
-o generate ASCII object output in file 6502.out,
format is
;<address lo><address hi><data>
-s print symbol table at end of listing
-v print assembler version
J. H. Van Ornum 11/5/84
SHAR_EOF
# End of shell archive
exit 0