Initial commit.

This commit is contained in:
Christopher RYU 2023-09-07 07:17:42 +09:00
parent 1621ad628f
commit 179d281b12
4 changed files with 218 additions and 0 deletions

BIN
BITSY.BOOT#ff2000 Normal file

Binary file not shown.

9
Makefile Normal file
View File

@ -0,0 +1,9 @@
all: bitsy.boot.bin
cp bitsy.boot.bin BITSY.BOOT#ff2000
%.bin: %.s
ca65 --target apple2 -DPLUS_FIX -o $*.o $*.s
ld65 --config apple2-asm.cfg -o $*.bin $*.o
clean:
rm -f *.o *.bin

BIN
bitsy.boot.bin Normal file

Binary file not shown.

209
bitsy.boot.s Normal file
View File

@ -0,0 +1,209 @@
; BITSY.BOOT
; Created: 2023-09-07 02:57:20
;
; Stock BITSY.BOOT doesn't reliably work on my Franklin.
; It appears that the check for an open-Apple keypress on a pre-//e isn't
; reliably low/high -- same issue as console5's gamepad adapter.
;
; Defining PLUS_FIX at compile time moves the check for O-A to the end of the
; keypress matching routine. This does the right thing on my Franklin; I don't
; have a //e to test with, but the logic should be sound. And it only costs
; two extra bytes :)
.macpack apple2
.setcpu "6502"
.org $2000
MLI_ENTRY := $BF00
DEVNUM := $BF30
DEVCNT := $BF31
DEVLST := $BF32
KBD := $C000
CLR80VID := $C00C
KBDSTRB := $C010
RDBTN0 := $C061
LCBANK1 := $C08B
INIT := $FB2F
BASCALC := $FBC1
ROM_BELL := $FBDD
HOME := $FC58
RDKEY := $FD0C
SETKBD := $FE89
SETVID := $FE93
sta CLR80VID
sta KBD
jsr SETVID
jsr SETKBD
jsr INIT
jsr GET_SLOT
and #$07
ora #$B0
sta BOOT_SLOT
; set up active slot display in splash screen data
ldy DEVCNT ; count (-1) of active devices
L201C: lda DEVLST,y
beq L2036
php
lsr a
lsr a
lsr a
and #$0E
tax
lsr a
ora #$B0 ; convert to screen code
plp
bmi L2033
sta D1_LIST,x
bne L2036
L2033: sta D2_LIST,x
L2036: dey
bpl L201C
; display splash screen
jsr HOME
ldx #(END_SPLASH - SPLASH_SCREEN) ;#$9D
L203E: lda SPLASH_SCREEN-1,x
bmi L204A
jsr BASCALC
ldy SPLASH_SCREEN,x
.byte $2C ; hide next opcode via BIT
L204A: sta ($28),y
dey
dex
bne L203E
L2050: sta $0400,y
sta ($28),y
dey
bpl L2050
ldx #$15
L205A: txa
jsr BASCALC
ldy #$14
lda #$A1 ; screencode for "!"
sta ($28),y
dex
bne L205A
lda #$10
sta $29
sta KBDSTRB ; clear keyboard strobe
bne MAIN_LOOP ; branch-always to MAIN_LOOP
; get keypress and process
MAIN_LOOP_WITH_BEEP:
jsr ROM_BELL
MAIN_LOOP:
jsr RDKEY
.ifndef PLUS_FIX
bit RDBTN0 ; open-apple -- this fries the franklin?
bmi QUIT
.endif
cmp #$B8 ; >= 8?
bcs QUIT
cmp #$B1 ; >= 1?
bcs SET_SLOT_AND_BOOT
cmp #$9B ; ESC?
beq L209B
cmp #$8D ; CR?
beq BOOT_RECENT
cmp #$A0 ; space?
.ifndef PLUS_FIX
bne MAIN_LOOP
.else
beq BOOT_RECENT
bit RDBTN0 ; open-apple -- this fries the franklin?
bmi QUIT
bpl MAIN_LOOP
.endif
BOOT_RECENT:
jsr GET_SLOT
SET_SLOT_AND_BOOT:
and #$07 ; mask to get raw slot number
beq MAIN_LOOP ; if zero, restart
ora #$C0 ; this becomes $C100-$C700
sta BOOTVEC+2 ; and put it into boot vector
L209B: jsr HOME
BOOTVEC:
jsr MLI_ENTRY ; but overwritten to slot entry point
.byte $65
.word * + 2
.byte $04 ; it's apparently okay to have garbage for $65
QUIT:
cmp #$9B ; key ESC?
beq L20AF
and #$DF
cmp #$D1 ; key Q?
bne MAIN_LOOP_WITH_BEEP
L20AF: bit RDBTN0 ; is open-apple pressed?
bpl MAIN_LOOP_WITH_BEEP ; if not, restart loop
; 65816 GS/OS gunk here ...
.setcpu "65816"
REP #$80
BMI MAIN_LOOP_WITH_BEEP
LDA $E100BD ; OS_BOOT (byte)
DEC
BNE MAIN_LOOP_WITH_BEEP
CLC
XCE
LDA LCBANK1 ; rw:LCBANK1
JMP $E0D000
.setcpu "6502"
; get last-accessed slot
GET_SLOT:
lda DEVNUM
lsr a
lsr a
lsr a
lsr a
rts
SPLASH_SCREEN:
scrcode "-"
.byte $16, $29
scrcode "BITSY BOOT"
.byte $04, $23
scrcode "1.0"
.byte $15, $28
scrcode "BY"
.byte $09, $1f
scrcode "JOHN"
.byte $0f, $20
scrcode "BROOKS"
.byte $12
.byte "!"
scrcode "ACTIVE SLOTS"
D1_LIST:
.byte $04, $10
scrcode ". . . . . . ."
D2_LIST:
.byte $08, $10
scrcode ". . . . . . ."
.byte $0a, $10
scrcode "1-7:"
scrcode "BOOT A SLOT"
.byte $0f, $11
scrcode "RET:BOOT SLOT "
BOOT_SLOT:
scrcode "N"
.byte $12, $11
scrcode "ESC:QUIT TO PRODOS"
.byte $17, $12
scrcode "OA-Q:QUIT TO GS/OS"
.byte $17, $28
END_SPLASH = *