Initial commit

This commit is contained in:
Neil McPhail 2024-11-10 17:12:49 +00:00
commit f560e63a50
7 changed files with 160 additions and 0 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*.tap
*bin
*bincs
ac

33
Makefile Normal file
View File

@ -0,0 +1,33 @@
program.tap: program.asm headerbincs body.tap
pasmo program.asm program.tap
headerbincs: headerbin ac
cp headerbin headerbincs
./ac headerbincs
headerbin: header.tap
dd if=header.tap of=headerbin bs=1 count=18
header.tap: header.asm body.tap
pasmo header.asm header.tap
body.tap: body.asm bodybincs
pasmo body.asm body.tap
bodybincs: bodybin ac
cp bodybin bodybincs
./ac bodybincs
bodybin: remload.asm
pasmo remload.asm bodybin
ac: append_checksum.c
cc append_checksum.c -o ac
clean:
rm -f *.tap
rm -f *bin
rm -f *bincs
rm -f ac
.PHONY: clean

26
append_checksum.c Normal file
View File

@ -0,0 +1,26 @@
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
int fd;
unsigned char tally = 0;
unsigned char next = 0;
if (argc!=2) return -1;
fd = open(argv[1], O_RDWR|O_APPEND);
if (fd<0) return -2;
while (read(fd, &next, 1)) {
//printf("Tally: %X, next byte: %X\n", tally, next);
tally ^= next;
};
printf("Final tally: %X\n", tally);
write(fd, &tally, 1);
close(fd);
return 0;
}

7
body.asm Normal file
View File

@ -0,0 +1,7 @@
bodylength:
dw bodyend - bodycontent
bodycontent:
INCBIN bodybincs
bodyend:

24
header.asm Normal file
View File

@ -0,0 +1,24 @@
headerflag:
db 0
blocktype:
db 0 ;basic program
filename:
db "LOADER "
payloadlength:
dw endbodytap - bodytap - 4
autorunlinenumber:
dw 0
variablearea:
dw endbodytap - bodytap - 4
checksum:
db 0
bodytap:
INCBIN body.tap
endbodytap:

5
program.asm Normal file
View File

@ -0,0 +1,5 @@
headlength:
dw 19
INCBIN headerbincs
INCBIN body.tap

61
remload.asm Normal file
View File

@ -0,0 +1,61 @@
org #5cca
bodyformat:
db #ff
linenumber:
db #00 ;MSB
db #00 ;LSB
linelength:
dw eol - border ;will need calculated and adjusted post hoc. Length of text including ENTER
border:
db #e7, '0' ;BORDER 0
db #0e ;number
db 0,0 ;mantissa
dw 0 ;number
db 0
db ':'
paper:
db #da, '0' ;PAPER 0
db #0e
db 0,0
dw 0
db 0
db ':'
ink:
db #d9, '7' ;INK 7
db #0e
db 0,0
dw 7
db 0
db ':'
clear:
db #fd, "59999" ;CLEAR 59999 - presumably code will be loaded somewhere?
db #0e
db 0,0
dw 59999
db 0
db ':'
printusr:
db #f5, #c0 ;PRINT USR
db "0" ;don't know if actual value is important
db #0e
db 0,0
dw code ;actual call to REM statement code
db 0
db ':'
remcode:
db #ea ;REM
code:
ld bc, 42 ;your code goes here
ret
enter:
db #0d
eol: