Skip to content

Commit

Permalink
Merge pull request #12 from markdryan/markdryan/v9
Browse files Browse the repository at this point in the history
Specasm v9
  • Loading branch information
markdryan authored May 4, 2024
2 parents f6bbb12 + b20d382 commit a7583b1
Show file tree
Hide file tree
Showing 60 changed files with 3,322 additions and 403 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ SAEXPORT =\
SALINK =\
link_obj.c \
map.c \
queued_files.c \
salink.c \
expression.c

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ You should now have a folder in your root directory called SPECASM. It should l

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

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.
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.

## Reinstalling Specasm

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

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.
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.
2. Manually remove the old /Specasm directory on your SD card, e.g., rm -rf /Specasm
3. Download the latest release and unzip its contents to /Specasm on the SD card
4. Run the INSTALL BASIC program. This will install the new version of Specasm.
4. Run the INSTALL.BAS BASIC program. This will install the new version of Specasm.

## Assembling your First Program

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

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.,
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.,

```
> q
Expand Down
39 changes: 39 additions & 0 deletions asm/fsize/fsize.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
org $EA60
.FSize equ $EA60
ds 32, 0
.Main
ld a, '*'
ld ix, =FSize
ld b, 1
rst $8
db $9A
jr c, fail
ld (handle), a

ld ix, stat
rst $8
db $A1
jr c, closeFail

ld a, (handle)
rst $8
db $9B

ld hl, =stat+7
ld c, (hl)
inc hl
ld b, (hl)
ret

.closeFail
ld a, (handle)
rst $8
db $9B

.fail
ld bc, 0
ret
.handle
db 0
.stat
ds 11, 0
211 changes: 211 additions & 0 deletions asm/tst/check.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
; Apache-2.0

.TestChkBase
ld hl, baseGood
call TstParseRegs
call TstSaveRegs
call modAllBase
call TstCheckRegs
ret

.TestChkBaseBad
ld hl, baseBad
call TstParseRegs
call TstSaveRegs
call modAllBase
call TstCheckRegs
ld a, c
or b
jr z, badFail
ld hl, baseGood
call strcmp
ret
.badFail
ld bc, 1
ret

.TestChkIXIY
ld hl, ixiyGood
call TstParseRegs
call TstSaveRegs
di
push iy
call modIXIY
call TstCheckRegs
pop iy
ei
ret

.TestChkIXIYBad
ld hl, baseBad
call TstParseRegs
call TstSaveRegs
di
push iy
call modIXIY
call TstCheckRegs
pop iy
ei
ld a, c
or b
jr z, badFail
ld hl, ixiyGood
call strcmp
ret

.TestChkPrime
ld hl, primeGood
call TstParseRegs
call TstSaveRegs
call modAllPrime
call TstCheckRegs
ret

.TestChkPrimeBad
ld hl, baseBad
call TstParseRegs
call TstSaveRegs
call modAllPrime
call TstCheckRegs
ld a, c
or b
jr z, badFail
ld hl, primeGood
call strcmp
ret

.TestChkMixed
ld hl, mixedGood
call TstParseRegs
call TstSaveRegs
call modMixed
call TstCheckRegs
ret

.TestChkMixedBad
ld hl, baseBad
call TstParseRegs
call TstSaveRegs
call modMixed
call TstCheckRegs
ld a, c
or b
jp z, badFail
ld hl, mixedGood
call strcmp
ret

.strcmp
ld a, (bc)
cp (hl)
jr nz, cmpFail
or a
jr z, cmpOk
inc hl
inc bc
jr strcmp
.cmpFail
ld bc, 1
ret
.cmpOk
ld bc, 0
ret

.modAllBase
push af
pop bc
ld a, b
cpl
ld b, a
ld a, c
cpl
ld c, a
push bc
ld a, b
cpl
ld b, a
ld a, c
cpl
ld c, a
ld a, d
cpl
ld d, a
ld a, e
cpl
ld e, a
ld a, h
cpl
ld h, a
ld a, l
cpl
ld l, a
pop af
ret

.modIXIY
push af
push ix
pop af
cpl
push af
pop ix
push iy
pop af
cpl
push af
pop iy
pop af
ret

.modAllPrime
exx
ex af, af'
call modAllBase
ex af, af'
exx
ret

.modMixedBase
push af
ld a, b
cpl
ld b, a
ld a, d
cpl
ld d, a
ld a, h
cpl
ld h, a
pop af
cpl
ret

.modMixed
call modMixedBase
ex af, af'
exx
call modMixedBase
exx
ex af, af'
push ix
pop af
cpl
push af
pop ix
ret


.baseGood
"facbedlh"
.baseBad
db 0
.ixiyGood
"ixiy"
db 0
.primeGood
"f'a'c'b'e'd'l'h'"
db 0
.mixedGood
"fabdhixf'a'b'd'h'"
db 0

Loading

0 comments on commit a7583b1

Please sign in to comment.