commit f560e63a5030fc8b3241ab956775a82cde528683 Author: Neil McPhail Date: Sun Nov 10 17:12:49 2024 +0000 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..16e44d5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.tap +*bin +*bincs +ac diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1fc4eab --- /dev/null +++ b/Makefile @@ -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 diff --git a/append_checksum.c b/append_checksum.c new file mode 100644 index 0000000..fb1f309 --- /dev/null +++ b/append_checksum.c @@ -0,0 +1,26 @@ +#include +#include +#include + +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; +} diff --git a/body.asm b/body.asm new file mode 100644 index 0000000..3796e6e --- /dev/null +++ b/body.asm @@ -0,0 +1,7 @@ +bodylength: + dw bodyend - bodycontent + +bodycontent: +INCBIN bodybincs + +bodyend: diff --git a/header.asm b/header.asm new file mode 100644 index 0000000..7c0758a --- /dev/null +++ b/header.asm @@ -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: diff --git a/program.asm b/program.asm new file mode 100644 index 0000000..cebb655 --- /dev/null +++ b/program.asm @@ -0,0 +1,5 @@ +headlength: + dw 19 + +INCBIN headerbincs +INCBIN body.tap diff --git a/remload.asm b/remload.asm new file mode 100644 index 0000000..6ff256f --- /dev/null +++ b/remload.asm @@ -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: