Compare commits
3 Commits
f560e63a50
...
v1.1
Author | SHA1 | Date | |
---|---|---|---|
a6698e3ead | |||
be861f6a13 | |||
cd5ec16cef |
2
Makefile
2
Makefile
@ -18,7 +18,7 @@ bodybincs: bodybin ac
|
|||||||
cp bodybin bodybincs
|
cp bodybin bodybincs
|
||||||
./ac bodybincs
|
./ac bodybincs
|
||||||
|
|
||||||
bodybin: remload.asm
|
bodybin: remload.asm code.asm
|
||||||
pasmo remload.asm bodybin
|
pasmo remload.asm bodybin
|
||||||
|
|
||||||
ac: append_checksum.c
|
ac: append_checksum.c
|
||||||
|
11
README.md
Normal file
11
README.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# ZX Spectrum REM statement machine code loader
|
||||||
|
|
||||||
|
Sometimes it would be useful to run machine code directly from ZX BASIC without having to load a CODE block or use lots of POKE and DATA statements. For example, you could add code for a fast loader or headerless loading block.
|
||||||
|
|
||||||
|
This Makefile will generate a ZX BASIC .tap file with a REM statement containing the machine code, and will automatically run it. Simply amend the code in `code.asm` and run `make`. The file `program.tap` will be created which can be loaded in an emulator or real Spectrum.
|
||||||
|
|
||||||
|
The included BASIC routine will CLEAR 59999 and set BORDER and PAPER to black and INK to white. Amend the `remload.asm` routine if this is not desired.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
To use this, you need to install `make`, `pasmo`, `dd` and a C compiler.
|
12
code.asm
Normal file
12
code.asm
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
; This is the main file you will edit to add your machine code to the REM statement.
|
||||||
|
; You _must_ include the "entry_point" tag to point to the address which will called by the BASIC "PRINT USR" statement.
|
||||||
|
; The default code below is for illustration only, and can be deleted.
|
||||||
|
; But REMEMBER TO ADD THE entry_point TAG TO YOUR OWN CODE!
|
||||||
|
|
||||||
|
|
||||||
|
data_start: ;if your routine starts here, move the entry_point tag here too
|
||||||
|
ld bc, 42
|
||||||
|
ret
|
||||||
|
|
||||||
|
entry_point: ;move this tag to the start point of your code
|
||||||
|
jr data_start
|
@ -45,7 +45,7 @@ printusr:
|
|||||||
db "0" ;don't know if actual value is important
|
db "0" ;don't know if actual value is important
|
||||||
db #0e
|
db #0e
|
||||||
db 0,0
|
db 0,0
|
||||||
dw code ;actual call to REM statement code
|
dw entry_point ;actual call to REM statement code
|
||||||
db 0
|
db 0
|
||||||
db ':'
|
db ':'
|
||||||
|
|
||||||
@ -53,8 +53,7 @@ remcode:
|
|||||||
db #ea ;REM
|
db #ea ;REM
|
||||||
|
|
||||||
code:
|
code:
|
||||||
ld bc, 42 ;your code goes here
|
INCLUDE code.asm
|
||||||
ret
|
|
||||||
|
|
||||||
enter:
|
enter:
|
||||||
db #0d
|
db #0d
|
||||||
|
Reference in New Issue
Block a user