From 45cc31bd882e416077bbd810afdb7f6ab6be79c7 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Fri, 20 Dec 2019 20:06:15 -0800 Subject: [PATCH] initial snapshot --- Makefile | 21 ++++++++++ prodos.inc | 102 +++++++++++++++++++++++++++++++++++++++++++++++++ total.replay.s | 61 +++++++++++++++++++++++++++++ 3 files changed, 184 insertions(+) create mode 100644 Makefile create mode 100644 prodos.inc create mode 100644 total.replay.s diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..59d6d4f --- /dev/null +++ b/Makefile @@ -0,0 +1,21 @@ + +CAFLAGS = --target apple2enh --list-bytes 0 +LDFLAGS = --config apple2-asm.cfg + +TARGETS = total.replay.SYS + +.PHONY: clean all +all: $(TARGETS) + +HEADERS = $(wildcard *.inc) + +clean: + rm -f *.o + rm -f $(TARGETS) + +%.o: %.s $(HEADERS) + ca65 $(CAFLAGS) --listing $(basename $@).list -o $@ $< + +%.SYS: %.o + ld65 $(LDFLAGS) -o $@ $< + xattr -wx prodos.AuxType '00 20' $@ diff --git a/prodos.inc b/prodos.inc new file mode 100644 index 0000000..49b4344 --- /dev/null +++ b/prodos.inc @@ -0,0 +1,102 @@ +;;; ------------------------------------------------------------ +;;; ProDOS MLI +;;; ------------------------------------------------------------ + +;;; ------------------------------------------------------------ +;;; ProDOS Global Page + +MLI := $BF00 ; Entry point +DEVNUM := $BF30 ; Most recent accessed device +DEVCNT := $BF31 ; Number of on-line devices minus 1 +DEVLST := $BF32 ; Up to 14 units +BITMAP := $BF58 +BITMAP_SIZE := $18 ; Bits for pages $00 to $BF +DATELO := $BF90 ; Date lo +DATEHI := $BF91 ; Date hi +TIMELO := $BF92 ; Time lo +TIMEHI := $BF93 ; Time hi + + +;;; ------------------------------------------------------------ +;;; MLI Calls + +;;; Housekeeping Calls +CREATE := $C0 +DESTROY := $C1 +RENAME := $C2 +SET_FILE_INFO := $C3 +GET_FILE_INFO := $C4 +ON_LINE := $C5 +SET_PREFIX := $C6 +GET_PREFIX := $C7 + +;;; Filing Calls +OPEN := $C8 +NEWLINE := $C9 +READ := $CA +WRITE := $CB +CLOSE := $CC +FLUSH := $CD +SET_MARK := $CE +GET_MARK := $CF +SET_EOF := $D0 +GET_EOF := $D1 +SET_BUF := $D2 +GET_BUF := $D3 + +;;; System Calls +GET_TIME := $82 +ALLOC_INTERRUPT := $40 +DEALLOC_INTERRUPT := $41 +QUIT := $65 + +;;; Direct Disk Access Commands +READ_BLOCK := $80 +WRITE_BLOCK := $71 + +;;; ------------------------------------------------------------ +;;; File Types + +FT_TYPELESS := $00 +FT_BAD := $01 +FT_TEXT := $04 +FT_BINARY := $06 +FT_DIRECTORY := $0F +FT_SRC := $B0 ; IIgs system type; re-used? +FT_BASIC := $FC +FT_SYSTEM := $FF + + +;;; ------------------------------------------------------------ +;;; Macros + +.macro MLI_CALL op, addr + jsr MLI + .byte op + .addr addr +.endmacro + + +;;; ------------------------------------------------------------ +;;; Structures + +.scope DirectoryHeader + entry_length := $23 + entries_per_block := $24 + file_count := $25 + + size := $2B +.endscope + +.scope FileEntry + storage_type := $00 ; high nibble + name_length := $00 ; low nibble + file_name := $01 + file_type := $10 + access := $1E +.endscope + +.scope FileType + Directory := $0F + System := $FF +.endscope diff --git a/total.replay.s b/total.replay.s new file mode 100644 index 0000000..1d7b549 --- /dev/null +++ b/total.replay.s @@ -0,0 +1,61 @@ + .setcpu "6502" + + .include "opcodes.inc" + .include "apple2.inc" + .include "../a2d/inc/macros.inc" + .include "../a2d/inc/apple2.inc" + .include "../a2d/inc/prodos.inc" + + + ;; System files start at $2000 + .org $2000 + reloc = $1000 + +;;; Relocate down to $1000 + copy16 #rel_start, STARTLO + copy16 #rel_end, ENDLO + copy16 #reloc, DESTINATIONLO + ldy #0 + jsr MOVE + jmp reloc + + +;;; Relocated routine +rel_start: + .pushorg reloc + jmp run + +fn: PASCAL_STRING "LAUNCHER.SYSTEM" +prefix: PASCAL_STRING "/TOTAL.REPLAY" + + DEFINE_SET_PREFIX_PARAMS set_prefix_params, prefix + DEFINE_OPEN_PARAMS open_params, fn, $1C00 + DEFINE_READ_PARAMS read_params, $2000, $BEFF-$2000 + DEFINE_CLOSE_PARAMS close_params + + DEFINE_QUIT_PARAMS quit_params +run: + MLI_CALL SET_PREFIX, set_prefix_params + bcs quit + MLI_CALL OPEN, open_params + bcs quit + lda open_params::ref_num + sta read_params::ref_num + sta close_params::ref_num + MLI_CALL READ, read_params + bcs quit + MLI_CALL CLOSE, close_params + + ;; Disable ProDOS realtime clock + lda MACHID + and #%11111110 + sta MACHID + lda #OPC_RTS + sta DATETIME + + jmp $2000 + +quit: MLI_CALL QUIT, quit_params + + .poporg +rel_end: