mirror of
https://github.com/a2stuff/prodos-drivers.git
synced 2025-02-01 08:32:23 +00:00
Makefile tidying, unify headers
This commit is contained in:
parent
d10429b3a0
commit
cf891e061f
22
bbb/Makefile
22
bbb/Makefile
@ -2,7 +2,13 @@
|
||||
CAFLAGS = --target apple2enh --list-bytes 0
|
||||
LDFLAGS = --config apple2-asm.cfg
|
||||
|
||||
TARGETS = bye.system.SYS buhbye.system.SYS
|
||||
OUTDIR = out
|
||||
|
||||
HEADERS = $(wildcard *.inc) $(wildcard ../inc/*.inc)
|
||||
|
||||
TARGETS = \
|
||||
$(OUTDIR)/bye.system.SYS \
|
||||
$(OUTDIR)/buhbye.system.SYS
|
||||
|
||||
# For timestamps
|
||||
MM = $(shell date "+%-m")
|
||||
@ -11,17 +17,19 @@ YY = $(shell date "+%-y")
|
||||
DEFINES = -D DD=$(DD) -D MM=$(MM) -D YY=$(YY)
|
||||
|
||||
.PHONY: clean all
|
||||
all: $(TARGETS)
|
||||
all: $(OUTDIR) $(TARGETS)
|
||||
|
||||
HEADERS = $(wildcard *.inc) $(wildcard ../inc/*.inc)
|
||||
$(OUTDIR):
|
||||
mkdir -p $(OUTDIR)
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
rm -f $(TARGETS)
|
||||
rm -f $(OUTDIR)/*.o
|
||||
rm -f $(OUTDIR)/*.list
|
||||
rm -f $(OUTDIR)/$(TARGETS)
|
||||
|
||||
%.o: %.s $(HEADERS)
|
||||
$(OUTDIR)/%.o: %.s $(HEADERS)
|
||||
ca65 $(CAFLAGS) $(DEFINES) --listing $(basename $@).list -o $@ $<
|
||||
|
||||
%.SYS: %.o
|
||||
$(OUTDIR)/%.SYS: $(OUTDIR)/%.o
|
||||
ld65 $(LDFLAGS) -o $@ $<
|
||||
xattr -wx prodos.AuxType '00 20' $@
|
||||
|
@ -15,37 +15,7 @@
|
||||
.include "../inc/apple2.inc"
|
||||
.include "../inc/macros.inc"
|
||||
.include "../inc/prodos.inc"
|
||||
|
||||
;;; Miscellaneous
|
||||
|
||||
COL80HPOS := $57B
|
||||
|
||||
;;; I/O Soft Switches / Firmware
|
||||
|
||||
ROMINNW := $C082 ; Read ROM; no write
|
||||
ROMINWB1 := $C089 ; Read ROM; write RAM bank 1
|
||||
|
||||
SLOT3 := $C300
|
||||
|
||||
;;; Monitor
|
||||
|
||||
SETTXT := $FB39
|
||||
TABV := $FB5B
|
||||
SETPWRC := $FB6F
|
||||
BELL1 := $FBDD
|
||||
SETINV := $FE80
|
||||
|
||||
;;; ASCII/Key codes
|
||||
ASCII_TAB := $9
|
||||
ASCII_DOWN := $A ; down arrow
|
||||
ASCII_UP := $B ; up arrow
|
||||
ASCII_CR := $D
|
||||
ASCII_RIGHT := $15 ; right arrow
|
||||
ASCII_SYN := $16 ; scroll text window up
|
||||
ASCII_ETB := $17 ; scroll text window down
|
||||
ASCII_EM := $19 ; move cursor to upper left
|
||||
ASCII_ESCAPE := $1B
|
||||
|
||||
.include "../inc/ascii.inc"
|
||||
|
||||
;;; ************************************************************
|
||||
.include "../inc/driver_preamble.inc"
|
||||
@ -75,7 +45,7 @@ ASCII_ESCAPE := $1B
|
||||
src_ptr := $19
|
||||
dst_ptr := $1B
|
||||
|
||||
sta ALTZPOFF
|
||||
sta ALTZPOFF ; TODO: Necessary?
|
||||
lda ROMIN ; write bank 2
|
||||
lda ROMIN
|
||||
|
||||
@ -107,7 +77,7 @@ loop: lda (src_ptr) ; *src_ptr = *dst_ptr
|
||||
cmp #<end
|
||||
bne loop
|
||||
|
||||
sta ALTZPOFF
|
||||
sta ALTZPOFF ; TODO: Necessary?
|
||||
sta ROMINWB1
|
||||
sta ROMINWB1
|
||||
|
||||
@ -158,7 +128,6 @@ loop: lda (src_ptr) ; *src_ptr = *dst_ptr
|
||||
;;; ------------------------------------------------------------
|
||||
|
||||
cld ; ProDOS protocol for QUIT routine
|
||||
lda ROMINNW ; Page in ROM for reads, writes ignored
|
||||
|
||||
lda #$A0
|
||||
jsr SLOT3 ; Activate 80-Column Firmware
|
||||
|
@ -2,64 +2,16 @@
|
||||
|
||||
.setcpu "65C02"
|
||||
.include "apple2.inc"
|
||||
.include "prodos.inc"
|
||||
.include "apple2.mac"
|
||||
|
||||
;;; Miscellaneous
|
||||
|
||||
RESETVEC := $3F2
|
||||
|
||||
COL80HPOS := $57B
|
||||
|
||||
;;; I/O Soft Switches / Firmware
|
||||
|
||||
RAMRDOFF := $C002 ; If 80STORE Off: Read Main Mem $0200-$BFFF
|
||||
RAMRDON := $C003 ; If 80STORE Off: Read Aux Mem $0200-$BFFF
|
||||
RAMWRTOFF := $C004 ; If 80STORE Off: Write Main Mem $0200-$BFFF
|
||||
RAMWRTON := $C005 ; If 80STORE Off: Write Aux Mem $0200-$BFFF
|
||||
ALTZPOFF := $C008 ; Main Stack and Zero Page
|
||||
ALTZPON := $C009 ; Aux Stack and Zero Page
|
||||
ROMINNW := $C082 ; Read ROM; no write
|
||||
ROMINWB1 := $C089 ; Read ROM; write RAM bank 1
|
||||
|
||||
SLOT3 := $C300
|
||||
|
||||
;;; Monitor
|
||||
|
||||
SETTXT := $FB39
|
||||
TABV := $FB5B
|
||||
SETPWRC := $FB6F
|
||||
BELL1 := $FBDD
|
||||
HOME := $FC58
|
||||
COUT := $FDED
|
||||
SETINV := $FE80
|
||||
SETNORM := $FE84
|
||||
|
||||
;;; ASCII/Key codes
|
||||
ASCII_TAB := $9
|
||||
ASCII_DOWN := $A ; down arrow
|
||||
ASCII_UP := $B ; up arrow
|
||||
ASCII_CR := $D
|
||||
ASCII_RIGHT := $15 ; right arrow
|
||||
ASCII_SYN := $16 ; scroll text window up
|
||||
ASCII_ETB := $17 ; scroll text window down
|
||||
ASCII_EM := $19 ; move cursor to upper left
|
||||
ASCII_ESCAPE := $1B
|
||||
.include "../inc/apple2.inc"
|
||||
.include "../inc/prodos.inc"
|
||||
.include "../inc/ascii.inc"
|
||||
|
||||
;;; ------------------------------------------------------------
|
||||
|
||||
.define HI(char) (char|$80)
|
||||
|
||||
.macro HIASCII arg
|
||||
.repeat .strlen(arg), i
|
||||
.byte .strat(arg, i) | $80
|
||||
.endrep
|
||||
.endmacro
|
||||
|
||||
.macro HIASCIIZ arg
|
||||
HIASCII arg
|
||||
.byte 0
|
||||
.endmacro
|
||||
|
||||
|
||||
;;; ------------------------------------------------------------
|
||||
|
||||
@ -121,7 +73,7 @@ ASCII_ESCAPE := $1B
|
||||
;;; ------------------------------------------------------------
|
||||
|
||||
cld ; ProDOS protocol for QUIT routine
|
||||
lda ROMINNW ; Page in ROM for reads, writes ignored
|
||||
lda ROMIN2 ; Page in ROM for reads, writes ignored
|
||||
|
||||
;; Point reset vector at this routine
|
||||
stz RESETVEC
|
||||
@ -197,7 +149,7 @@ check_device:
|
||||
lda open_params_ref_num
|
||||
sta read_params_ref_num
|
||||
sta mark_ref_num
|
||||
lda #DirectoryHeader::size
|
||||
lda #.sizeof(SubdirectoryHeader)
|
||||
sta read_params_request
|
||||
stz read_params_request+1
|
||||
jsr do_read
|
||||
@ -205,7 +157,7 @@ check_device:
|
||||
|
||||
;; Store entry_length/entries_per_block/file_count
|
||||
ldx #3
|
||||
: lda read_buffer + DirectoryHeader::entry_length,x
|
||||
: lda read_buffer + SubdirectoryHeader::entry_length,x
|
||||
sta entry_length,x
|
||||
dex
|
||||
bpl :-
|
||||
@ -256,7 +208,7 @@ carry: inc mark_position+1
|
||||
bcs finish_read2
|
||||
|
||||
inc entry_num
|
||||
lda read_buffer + FileEntry::storage_type
|
||||
lda read_buffer + FileEntry::storage_type_name_length
|
||||
and #$F0 ; mask off storage_type
|
||||
beq floop ; inactive file entry
|
||||
dec file_count
|
||||
@ -269,9 +221,9 @@ carry: inc mark_position+1
|
||||
|
||||
;; Check file type
|
||||
lda read_buffer + FileEntry::file_type
|
||||
cmp #FileType::Directory
|
||||
cmp #FT_DIRECTORY
|
||||
beq :+
|
||||
cmp #FileType::System
|
||||
cmp #FT_SYSTEM
|
||||
bne next_file_entry
|
||||
|
||||
;; Check to see if we have room
|
||||
@ -603,7 +555,8 @@ cout: jmp COUT
|
||||
|
||||
string_start := *
|
||||
.proc help_string
|
||||
HIASCIIZ "RETURN: Select | TAB: Chg Vol | ESC: Back"
|
||||
scrcode "RETURN: Select | TAB: Chg Vol | ESC: Back"
|
||||
.byte 0
|
||||
.endproc
|
||||
|
||||
;; Mousetext sequence: Enable, folder left, folder right, disable
|
||||
@ -714,7 +667,7 @@ loop: lda (src_ptr)
|
||||
lda src_ptr
|
||||
cmp #<end
|
||||
bne loop
|
||||
lda (src_ptr) ; WTF??
|
||||
lda (src_ptr)
|
||||
sta (dst_ptr)
|
||||
sta ALTZPOFF
|
||||
sta ROMINWB1
|
||||
|
102
bbb/prodos.inc
102
bbb/prodos.inc
@ -1,102 +0,0 @@
|
||||
;;; ------------------------------------------------------------
|
||||
;;; 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
|
@ -17,6 +17,7 @@
|
||||
.include "../inc/apple2.inc"
|
||||
.include "../inc/macros.inc"
|
||||
.include "../inc/prodos.inc"
|
||||
.include "../inc/ascii.inc"
|
||||
|
||||
;;; ************************************************************
|
||||
.include "../inc/driver_preamble.inc"
|
||||
@ -97,7 +98,7 @@ init_ssc:
|
||||
|
||||
: jsr readbyte
|
||||
bcs cricket_not_found ; timeout
|
||||
cmp #HI($0D) ; = CR ?
|
||||
cmp #HI(ASCII_CR)
|
||||
beq cricket_found
|
||||
digit: cmp #HI('0') ; < '0' ?
|
||||
bcc cricket_not_found
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
.include "../inc/apple2.inc"
|
||||
.include "../inc/macros.inc"
|
||||
.include "../inc/ascii.inc"
|
||||
|
||||
.org $2000
|
||||
|
||||
@ -39,7 +40,7 @@
|
||||
loop: lda INPUT_BUFFER,x
|
||||
jsr sendbyte
|
||||
inx
|
||||
cmp #HI($0D) ; = CR
|
||||
cmp #HI(ASCII_CR)
|
||||
bne loop
|
||||
|
||||
rts
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
.include "../inc/apple2.inc"
|
||||
.include "../inc/macros.inc"
|
||||
.include "../inc/ascii.inc"
|
||||
|
||||
.org $2000
|
||||
|
||||
@ -39,7 +40,7 @@
|
||||
loop: lda INPUT_BUFFER,x
|
||||
jsr sendbyte
|
||||
inx
|
||||
cmp #HI($0D) ; = CR
|
||||
cmp #HI(ASCII_CR)
|
||||
bne loop
|
||||
|
||||
rts
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
.include "../inc/apple2.inc"
|
||||
.include "../inc/macros.inc"
|
||||
.include "../inc/ascii.inc"
|
||||
|
||||
.org $2000
|
||||
|
||||
@ -84,7 +85,7 @@ init_ssc:
|
||||
|
||||
: jsr readbyte
|
||||
bcs cricket_not_found ; timeout
|
||||
cmp #HI($0D) ; = CR ?
|
||||
cmp #HI(ASCII_CR)
|
||||
beq cricket_found
|
||||
digit: cmp #HI('0') ; < '0' ?
|
||||
bcc cricket_not_found
|
||||
|
@ -8,6 +8,8 @@
|
||||
;;; Soft Switches
|
||||
;;; ============================================================
|
||||
|
||||
;;; I/O Soft Switches / Firmware
|
||||
|
||||
RAMRDOFF := $C002
|
||||
RAMRDON := $C003
|
||||
RAMWRTOFF := $C004
|
||||
@ -24,6 +26,7 @@ RDPAGE2 := $C01C
|
||||
BANKSEL := $C073 ; Select RamWorks bank
|
||||
|
||||
ROMIN2 := $C082 ; Read ROM; no write
|
||||
ROMINWB1 := $C089 ; Read ROM; write RAM bank 1
|
||||
RWRAM1 := $C08B ; Read/write RAM bank 1
|
||||
|
||||
;;; ============================================================
|
||||
@ -36,19 +39,36 @@ STATUS := $C089 + $20 ; ACIA Status/Reset Register
|
||||
COMMAND := $C08A + $20 ; ACIA Command Register (read/write)
|
||||
CONTROL := $C08B + $20 ; ACIA Control Register (read/write)
|
||||
|
||||
;;; ============================================================
|
||||
;;; Other Slots
|
||||
;;; ============================================================
|
||||
|
||||
SLOT3 := $C300
|
||||
|
||||
;;; ============================================================
|
||||
;;; Monitor ROM routines
|
||||
;;; ============================================================
|
||||
|
||||
INIT := $FB2F
|
||||
SETTXT := $FB39
|
||||
TABV := $FB5B
|
||||
SETPWRC := $FB6F
|
||||
BELL1 := $FBDD
|
||||
HOME := $FC58
|
||||
GETLN := $FD6A ; with prompt character
|
||||
GETLN2 := $FD6F ; no prompt character
|
||||
CROUT := $FD8E
|
||||
PRBYTE := $FDDA
|
||||
COUT := $FDED
|
||||
SETINV := $FE80
|
||||
SETNORM := $FE84
|
||||
SETKBD := $FE89
|
||||
SETVID := $FE93
|
||||
|
||||
;;; ============================================================
|
||||
;;; Well-known RAM locations
|
||||
;;; ============================================================
|
||||
|
||||
INPUT_BUFFER := $200
|
||||
RESETVEC := $3F2
|
||||
COL80HPOS := $57B
|
||||
|
13
inc/ascii.inc
Normal file
13
inc/ascii.inc
Normal file
@ -0,0 +1,13 @@
|
||||
;;; ============================================================
|
||||
;;; ASCII Code Points (also used as key codes)
|
||||
;;; ============================================================
|
||||
|
||||
ASCII_TAB := $09 ; tab
|
||||
ASCII_DOWN := $0A ; down arrow
|
||||
ASCII_UP := $0B ; up arrow
|
||||
ASCII_CR := $0D ; carriage return
|
||||
ASCII_RIGHT := $15 ; right arrow
|
||||
ASCII_SYN := $16 ; scroll text window up
|
||||
ASCII_ETB := $17 ; scroll text window down
|
||||
ASCII_EM := $19 ; move cursor to upper left
|
||||
ASCII_ESCAPE := $1B ; escape
|
@ -117,11 +117,11 @@ self_name: .res 16
|
||||
|
||||
;; Update reset vector - ProDOS QUIT
|
||||
lda #<quit
|
||||
sta $03F2
|
||||
sta RESETVEC
|
||||
lda #>quit
|
||||
sta $03F3
|
||||
sta RESETVEC+1
|
||||
eor #$A5
|
||||
sta $03F4
|
||||
sta RESETVEC+2
|
||||
|
||||
;; Quit 80-column firmware
|
||||
lda #$95 ; Ctrl+U (quit 80 col firmware)
|
||||
@ -130,10 +130,11 @@ self_name: .res 16
|
||||
;; Reset I/O
|
||||
sta CLR80VID
|
||||
sta CLRALTCHAR
|
||||
jsr SETVID
|
||||
jsr SETKBD
|
||||
sta CLR80COL
|
||||
jsr SETNORM
|
||||
jsr INIT
|
||||
jsr SETVID
|
||||
jsr SETKBD
|
||||
jsr HOME
|
||||
|
||||
;; Update System Bit Map
|
||||
|
@ -2,7 +2,12 @@
|
||||
CAFLAGS = --target apple2enh --list-bytes 0
|
||||
LDFLAGS = --config apple2-asm.cfg
|
||||
|
||||
TARGETS = quit.system.SYS
|
||||
OUTDIR = out
|
||||
|
||||
HEADERS = $(wildcard *.inc) $(wildcard ../inc/*.inc)
|
||||
|
||||
TARGETS = \
|
||||
$(OUTDIR)/quit.system.SYS
|
||||
|
||||
# For timestamps
|
||||
MM = $(shell date "+%-m")
|
||||
@ -11,17 +16,19 @@ YY = $(shell date "+%-y")
|
||||
DEFINES = -D DD=$(DD) -D MM=$(MM) -D YY=$(YY)
|
||||
|
||||
.PHONY: clean all
|
||||
all: $(TARGETS)
|
||||
all: $(OUTDIR) $(TARGETS)
|
||||
|
||||
HEADERS = $(wildcard *.inc) $(wildcard ../inc/*.inc)
|
||||
$(OUTDIR):
|
||||
mkdir -p $(OUTDIR)
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
rm -f $(TARGETS)
|
||||
rm -f $(OUTDIR)/*.o
|
||||
rm -f $(OUTDIR)/*.list
|
||||
rm -f $(OUTDIR)/$(TARGETS)
|
||||
|
||||
%.o: %.s $(HEADERS)
|
||||
$(OUTDIR)/%.o: %.s $(HEADERS)
|
||||
ca65 $(CAFLAGS) $(DEFINES) --listing $(basename $@).list -o $@ $<
|
||||
|
||||
%.SYS: %.o
|
||||
$(OUTDIR)/%.SYS: $(OUTDIR)/%.o
|
||||
ld65 $(LDFLAGS) -o $@ $<
|
||||
xattr -wx prodos.AuxType '00 20' $@
|
||||
|
@ -6,7 +6,8 @@ OUTDIR = out
|
||||
|
||||
HEADERS = $(wildcard *.inc) $(wildcard ../inc/*.inc)
|
||||
|
||||
TARGETS = $(OUTDIR)/ram.drv.system.SYS
|
||||
TARGETS = \
|
||||
$(OUTDIR)/ram.drv.system.SYS
|
||||
|
||||
# For timestamps
|
||||
MM = $(shell date "+%-m")
|
||||
@ -23,12 +24,11 @@ $(OUTDIR):
|
||||
clean:
|
||||
rm -f $(OUTDIR)/*.o
|
||||
rm -f $(OUTDIR)/*.list
|
||||
rm -f $(TARGETS)
|
||||
rm -f $(OUTDIR)/$(TARGETS)
|
||||
|
||||
$(OUTDIR)/%.o: %.s $(HEADERS)
|
||||
ca65 $(CAFLAGS) $(DEFINES) --listing $(basename $@).list -o $@ $<
|
||||
|
||||
# System Files .SYS
|
||||
$(OUTDIR)/%.SYS: $(OUTDIR)/%.o
|
||||
ld65 $(LDFLAGS) -o '$@' $<
|
||||
ld65 $(LDFLAGS) -o $@ $<
|
||||
xattr -wx prodos.AuxType '00 20' $@
|
||||
|
Loading…
x
Reference in New Issue
Block a user