Skip to content

Commit a7583b1

Browse files
authored
Merge pull request #12 from markdryan/markdryan/v9
Specasm v9
2 parents f6bbb12 + b20d382 commit a7583b1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+3322
-403
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ SAEXPORT =\
4747
SALINK =\
4848
link_obj.c \
4949
map.c \
50+
queued_files.c \
5051
salink.c \
5152
expression.c
5253

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ You should now have a folder in your root directory called SPECASM. It should l
1313

1414
![Installing](/docs/install.png)
1515

16-
Now navigate to the INSTALL file, which is a BASIC program, and press **ENTER** to execute it. On the 48kb or 128kb Spectrum this will use ESXDOS's **.launcher** command to set up some command line short cuts for the tap files in the SPECASM directory. It will also copy some executables to the /bin folder. On the ZX Spectrum Next it will copy the various executable programs that compose Specasm to the /dot folder.
16+
Now navigate to the INSTALL.BAS file, which is a BASIC program, and press **ENTER** to execute it. On the 48kb or 128kb Spectrum this will use ESXDOS's **.launcher** command to set up some command line short cuts for the tap files in the SPECASM directory. It will also copy some executables to the /bin folder. On the ZX Spectrum Next it will copy the various executable programs that compose Specasm to the /dot folder.
1717

1818
## Reinstalling Specasm
1919

2020
To upgrade to a new version of Specasm perform the following steps.
2121

22-
1. Execute the REMOVE BASIC program. This can be done from the ESXDOS file browser or by loading it from the BASIC prompt. This will remove the old version of Specasm stored under the /bin or the /dot folders, and will also de-register the old **.launcher** shortcuts.
22+
1. Execute the REMOVE.BAS BASIC program. This can be done from the ESXDOS file browser or by loading it from the BASIC prompt. This will remove the old version of Specasm stored under the /bin or the /dot folders, and will also de-register the old **.launcher** shortcuts.
2323
2. Manually remove the old /Specasm directory on your SD card, e.g., rm -rf /Specasm
2424
3. Download the latest release and unzip its contents to /Specasm on the SD card
25-
4. Run the INSTALL BASIC program. This will install the new version of Specasm.
25+
4. Run the INSTALL.BAS BASIC program. This will install the new version of Specasm.
2626

2727
## Assembling your First Program
2828

@@ -47,7 +47,7 @@ Note when entering the program there's no need to worry about formatting. Speca
4747
> s hello
4848
```
4949

50-
to save your work. We've now entered, assembled and saved our first program. Before we can run it however, we need to link it (basically resolve all the jumps and label references). There's not enough memory on the 48k spectrum to do the linking inside the IDE so we need to exit it and run another program. The can be achieved by entering command mode once more by pressing **SYMSHIFT w**, following by q and **ENTER**, e.g.,
50+
to save your work. We've now entered, assembled and saved our first program. Before we can run it however, we need to link it (basically resolve all the jumps and label references). There's not enough memory on the 48k spectrum to do the linking inside the IDE so we need to exit it and run another program. This can be achieved by entering command mode once more by pressing **SYMSHIFT w**, following by q and **ENTER**, e.g.,
5151

5252
```
5353
> q

asm/fsize/fsize.s

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
org $EA60
2+
.FSize equ $EA60
3+
ds 32, 0
4+
.Main
5+
ld a, '*'
6+
ld ix, =FSize
7+
ld b, 1
8+
rst $8
9+
db $9A
10+
jr c, fail
11+
ld (handle), a
12+
13+
ld ix, stat
14+
rst $8
15+
db $A1
16+
jr c, closeFail
17+
18+
ld a, (handle)
19+
rst $8
20+
db $9B
21+
22+
ld hl, =stat+7
23+
ld c, (hl)
24+
inc hl
25+
ld b, (hl)
26+
ret
27+
28+
.closeFail
29+
ld a, (handle)
30+
rst $8
31+
db $9B
32+
33+
.fail
34+
ld bc, 0
35+
ret
36+
.handle
37+
db 0
38+
.stat
39+
ds 11, 0

asm/tst/check.ts

Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
; Apache-2.0
2+
3+
.TestChkBase
4+
ld hl, baseGood
5+
call TstParseRegs
6+
call TstSaveRegs
7+
call modAllBase
8+
call TstCheckRegs
9+
ret
10+
11+
.TestChkBaseBad
12+
ld hl, baseBad
13+
call TstParseRegs
14+
call TstSaveRegs
15+
call modAllBase
16+
call TstCheckRegs
17+
ld a, c
18+
or b
19+
jr z, badFail
20+
ld hl, baseGood
21+
call strcmp
22+
ret
23+
.badFail
24+
ld bc, 1
25+
ret
26+
27+
.TestChkIXIY
28+
ld hl, ixiyGood
29+
call TstParseRegs
30+
call TstSaveRegs
31+
di
32+
push iy
33+
call modIXIY
34+
call TstCheckRegs
35+
pop iy
36+
ei
37+
ret
38+
39+
.TestChkIXIYBad
40+
ld hl, baseBad
41+
call TstParseRegs
42+
call TstSaveRegs
43+
di
44+
push iy
45+
call modIXIY
46+
call TstCheckRegs
47+
pop iy
48+
ei
49+
ld a, c
50+
or b
51+
jr z, badFail
52+
ld hl, ixiyGood
53+
call strcmp
54+
ret
55+
56+
.TestChkPrime
57+
ld hl, primeGood
58+
call TstParseRegs
59+
call TstSaveRegs
60+
call modAllPrime
61+
call TstCheckRegs
62+
ret
63+
64+
.TestChkPrimeBad
65+
ld hl, baseBad
66+
call TstParseRegs
67+
call TstSaveRegs
68+
call modAllPrime
69+
call TstCheckRegs
70+
ld a, c
71+
or b
72+
jr z, badFail
73+
ld hl, primeGood
74+
call strcmp
75+
ret
76+
77+
.TestChkMixed
78+
ld hl, mixedGood
79+
call TstParseRegs
80+
call TstSaveRegs
81+
call modMixed
82+
call TstCheckRegs
83+
ret
84+
85+
.TestChkMixedBad
86+
ld hl, baseBad
87+
call TstParseRegs
88+
call TstSaveRegs
89+
call modMixed
90+
call TstCheckRegs
91+
ld a, c
92+
or b
93+
jp z, badFail
94+
ld hl, mixedGood
95+
call strcmp
96+
ret
97+
98+
.strcmp
99+
ld a, (bc)
100+
cp (hl)
101+
jr nz, cmpFail
102+
or a
103+
jr z, cmpOk
104+
inc hl
105+
inc bc
106+
jr strcmp
107+
.cmpFail
108+
ld bc, 1
109+
ret
110+
.cmpOk
111+
ld bc, 0
112+
ret
113+
114+
.modAllBase
115+
push af
116+
pop bc
117+
ld a, b
118+
cpl
119+
ld b, a
120+
ld a, c
121+
cpl
122+
ld c, a
123+
push bc
124+
ld a, b
125+
cpl
126+
ld b, a
127+
ld a, c
128+
cpl
129+
ld c, a
130+
ld a, d
131+
cpl
132+
ld d, a
133+
ld a, e
134+
cpl
135+
ld e, a
136+
ld a, h
137+
cpl
138+
ld h, a
139+
ld a, l
140+
cpl
141+
ld l, a
142+
pop af
143+
ret
144+
145+
.modIXIY
146+
push af
147+
push ix
148+
pop af
149+
cpl
150+
push af
151+
pop ix
152+
push iy
153+
pop af
154+
cpl
155+
push af
156+
pop iy
157+
pop af
158+
ret
159+
160+
.modAllPrime
161+
exx
162+
ex af, af'
163+
call modAllBase
164+
ex af, af'
165+
exx
166+
ret
167+
168+
.modMixedBase
169+
push af
170+
ld a, b
171+
cpl
172+
ld b, a
173+
ld a, d
174+
cpl
175+
ld d, a
176+
ld a, h
177+
cpl
178+
ld h, a
179+
pop af
180+
cpl
181+
ret
182+
183+
.modMixed
184+
call modMixedBase
185+
ex af, af'
186+
exx
187+
call modMixedBase
188+
exx
189+
ex af, af'
190+
push ix
191+
pop af
192+
cpl
193+
push af
194+
pop ix
195+
ret
196+
197+
198+
.baseGood
199+
"facbedlh"
200+
.baseBad
201+
db 0
202+
.ixiyGood
203+
"ixiy"
204+
db 0
205+
.primeGood
206+
"f'a'c'b'e'd'l'h'"
207+
db 0
208+
.mixedGood
209+
"fabdhixf'a'b'd'h'"
210+
db 0
211+

0 commit comments

Comments
 (0)