mirror of https://github.com/a2stuff/basys33.git
Initial snapshot
This commit is contained in:
parent
4a2ef1ced1
commit
bd315a04df
2
Makefile
2
Makefile
|
@ -2,7 +2,7 @@
|
|||
CAFLAGS = --target apple2enh --list-bytes 0
|
||||
LDFLAGS = --config apple2-asm.cfg
|
||||
|
||||
TARGETS = total.replay.SYS
|
||||
TARGETS = basis.system.SYS
|
||||
|
||||
.PHONY: clean all
|
||||
all: $(TARGETS)
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
# BASIS.SYSTEM for DOS 3.3 Launcher
|
||||
|
||||
## Background
|
||||
|
||||
[ProDOS 2.4](https://prodos8.com/) includes the [Bitsy Bye](https://prodos8.com/bitsy-bye/) program launcher. It can launch System (SYS), Binary (BIN) and BASIC (BAS) files. For other file types, if there's a `BASIS.SYSTEM` handler in the root volume, it is invoked to handle the file.
|
||||
|
||||
[DOS 3.3 Launcher](http://apple2.org.za/gswv/a2zine/Docs/Dos33Launcher_Docs.txt) is a tool to run certain DOS 3.3 games (or more commonly, game cracks) under ProDOS. Launchers must be specially configured to invoke it for these DOS 3.3 files (file types $F1, $F2, $F3, $F4).
|
||||
|
||||
## What's this?
|
||||
|
||||
This repro includes a `BASIS.SYSTEM` implementation that takes the passed file and invokes `DOS3.3.LAUNCHER` on it. It searches for `DOS3.3.LAUNCHER` starting in the directory containing the DOS 3.3 file, and then upwards. So you can create a disk like this:
|
||||
|
||||
* `PRODOS`
|
||||
* `BASIS.SYSTEM`
|
||||
* `DOS.GAMES/`
|
||||
* `DOS3.3.LAUNCHER`
|
||||
* `GAME1`
|
||||
* `GAME2`
|
||||
* ...
|
||||
|
||||
And then Bitsy Bye will be able to launch them.
|
|
@ -0,0 +1,176 @@
|
|||
;;; ============================================================
|
||||
;;; BASIS.SYSTEM relay for DOS3.3.LAUNCHER
|
||||
;;; ============================================================
|
||||
|
||||
.setcpu "6502"
|
||||
|
||||
.include "apple2.inc"
|
||||
.include "prodos.inc"
|
||||
|
||||
neworg := $1000 ; Relocated to...
|
||||
filename_buffer := $1800 ; Saved
|
||||
filename_prefix := $1880 ; Unchanged
|
||||
launcher_prefix := $1900 ; Potentially shortened
|
||||
io_buf := $1C00
|
||||
|
||||
sys_start_address := $2000
|
||||
kMaxSysLength = ($BF00 - sys_start_address)
|
||||
|
||||
.org sys_start_address
|
||||
|
||||
;;; ============================================================
|
||||
;;; Interpeter protocol
|
||||
;;; http://www.easy68k.com/paulrsm/6502/PDOS8TRM.HTM#5.1.5.1
|
||||
|
||||
jmp start
|
||||
.byte $EE, $EE ; signature
|
||||
.byte 65 ; pathname buffer length ($2005)
|
||||
str_path:
|
||||
.res 65 ; pathname buffer ($2006)
|
||||
|
||||
.proc get_prefix_params1
|
||||
param_count: .byte 1
|
||||
pathname: .addr filename_prefix
|
||||
.endproc
|
||||
|
||||
|
||||
.proc get_prefix_params2
|
||||
param_count: .byte 1
|
||||
pathname: .addr launcher_prefix
|
||||
.endproc
|
||||
|
||||
;;; ============================================================
|
||||
|
||||
start:
|
||||
|
||||
;;; Save filename
|
||||
ldx str_path
|
||||
: lda str_path,x
|
||||
sta filename_buffer,x
|
||||
dex
|
||||
bpl :-
|
||||
|
||||
;;; Save prefix
|
||||
MLI_CALL GET_PREFIX, get_prefix_params1
|
||||
MLI_CALL GET_PREFIX, get_prefix_params2
|
||||
|
||||
;;; Relocation to $1000 since launcher will overwrite us at $2000
|
||||
ldx #reloc_end - reloc_start
|
||||
: lda reloc_start-1,x
|
||||
sta neworg-1,x
|
||||
dex
|
||||
bne :-
|
||||
|
||||
jmp newstart
|
||||
|
||||
reloc_start:
|
||||
.org neworg
|
||||
|
||||
launcher_filename:
|
||||
PASCAL_STRING "DOS3.3.LAUNCHER"
|
||||
|
||||
.proc open_params
|
||||
param_count: .byte 3
|
||||
path: .addr launcher_filename
|
||||
buffer: .addr io_buf
|
||||
ref_num: .byte 0
|
||||
.endproc
|
||||
|
||||
.proc read_params
|
||||
param_count: .byte 4
|
||||
ref_num: .byte 1
|
||||
buffer: .word sys_start_address
|
||||
request: .word kMaxSysLength
|
||||
trans: .word 0
|
||||
.endproc
|
||||
|
||||
.proc close_params
|
||||
param_count: .byte 1
|
||||
ref_num: .byte 0
|
||||
.endproc
|
||||
|
||||
.proc set_prefix_params
|
||||
param_count: .byte 1
|
||||
pathname: .addr launcher_prefix
|
||||
.endproc
|
||||
|
||||
|
||||
newstart:
|
||||
|
||||
;;; Find DOS3.3.LAUNCHER
|
||||
|
||||
check_for_launcher:
|
||||
MLI_CALL OPEN, open_params
|
||||
beq load_launcher
|
||||
ldy launcher_prefix ; Pop path segment.
|
||||
: lda launcher_prefix,y
|
||||
cmp #'/'
|
||||
beq update_prefix
|
||||
dey
|
||||
cpy #1
|
||||
bne :-
|
||||
beq quit ; always
|
||||
|
||||
update_prefix: ; Update prefix and try again.
|
||||
dey
|
||||
sty launcher_prefix
|
||||
MLI_CALL SET_PREFIX, set_prefix_params
|
||||
jmp check_for_launcher
|
||||
|
||||
;;; Load launcher
|
||||
|
||||
load_launcher:
|
||||
lda open_params::ref_num
|
||||
sta read_params::ref_num
|
||||
MLI_CALL READ, read_params
|
||||
bcs quit
|
||||
MLI_CALL CLOSE, close_params
|
||||
bcs quit
|
||||
|
||||
|
||||
;;; Populate startup pathname buffer
|
||||
|
||||
startup_buffer := $2006
|
||||
|
||||
;; Prefix
|
||||
ldx filename_prefix
|
||||
: lda filename_prefix,x
|
||||
sta startup_buffer,x
|
||||
dex
|
||||
bpl :-
|
||||
|
||||
;; Append filename
|
||||
ldx filename_prefix
|
||||
inx
|
||||
ldy #0
|
||||
: lda filename_buffer+1,y
|
||||
sta startup_buffer,x
|
||||
iny
|
||||
inx
|
||||
cpy filename_buffer
|
||||
bne :-
|
||||
|
||||
dex
|
||||
stx startup_buffer
|
||||
|
||||
;;; Invoke launcher
|
||||
jmp sys_start_address
|
||||
|
||||
;;; In case of error, QUIT to ProDOS
|
||||
quit:
|
||||
MLI_CALL QUIT, quit_params
|
||||
brk
|
||||
|
||||
.proc quit_params
|
||||
param_count: .byte 4
|
||||
.byte 0
|
||||
.word 0
|
||||
.byte 0
|
||||
.word 0
|
||||
.endproc
|
||||
|
||||
|
||||
.org reloc_start + * - neworg
|
||||
|
||||
reloc_end:
|
||||
.assert (reloc_end - reloc_start) < $100, error, "more than one page, oops"
|
|
@ -0,0 +1,20 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Use Cadius to create a disk image for distribution
|
||||
# https://github.com/mach-kernel/cadius
|
||||
|
||||
set -e
|
||||
|
||||
IMGFILE="basis33.po"
|
||||
VOLNAME="basis33"
|
||||
|
||||
|
||||
|
||||
# Create a new disk image.
|
||||
|
||||
rm -f "$IMGFILE"
|
||||
cadius CREATEVOLUME "$IMGFILE" "$VOLNAME" 800KB --quiet --no-case-bits
|
||||
|
||||
cp "basis.system.SYS" "basis.system#FF0000"
|
||||
cadius ADDFILE "$IMGFILE" "/$VOLNAME" "basis.system#FF0000" --quiet --no-case-bits
|
||||
rm -f "basis.system#FF0000"
|
|
@ -0,0 +1,69 @@
|
|||
;;; ------------------------------------------------------------
|
||||
;;; 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
|
||||
|
||||
|
||||
;;; ------------------------------------------------------------
|
||||
;;; Macros
|
||||
|
||||
.macro MLI_CALL op, addr
|
||||
jsr MLI
|
||||
.byte op
|
||||
.addr addr
|
||||
.endmacro
|
||||
|
||||
.macro PASCAL_STRING str,res
|
||||
.local data
|
||||
.local end
|
||||
.byte end - data
|
||||
data: .byte str
|
||||
end:
|
||||
.endmacro
|
|
@ -1,61 +0,0 @@
|
|||
.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:
|
Loading…
Reference in New Issue