2023-09-06 22:17:42 +00:00
|
|
|
; 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
|
2023-09-07 11:02:16 +00:00
|
|
|
MACHID := $BF98
|
2023-09-06 22:17:42 +00:00
|
|
|
|
|
|
|
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
|
2023-09-07 11:02:16 +00:00
|
|
|
ldx #(END_SPLASH - SPLASH_SCREEN)
|
2023-09-06 22:17:42 +00:00
|
|
|
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
|
2023-09-07 11:02:16 +00:00
|
|
|
bne MAIN_LOOP ; branch-always to MAIN_LOOP
|
2023-09-06 22:17:42 +00:00
|
|
|
|
|
|
|
; get keypress and process
|
|
|
|
|
|
|
|
MAIN_LOOP_WITH_BEEP:
|
|
|
|
jsr ROM_BELL
|
|
|
|
MAIN_LOOP:
|
|
|
|
jsr RDKEY
|
|
|
|
cmp #$9B ; ESC?
|
2023-09-07 11:02:16 +00:00
|
|
|
beq DO_MLI_BOOT
|
2023-09-06 22:17:42 +00:00
|
|
|
cmp #$8D ; CR?
|
|
|
|
beq BOOT_RECENT
|
|
|
|
cmp #$A0 ; space?
|
|
|
|
beq BOOT_RECENT
|
2023-09-07 11:02:16 +00:00
|
|
|
cmp #$B8 ; >= 8?
|
|
|
|
bcs GSOS_QUIT
|
|
|
|
cmp #$B1 ; >= 1?
|
|
|
|
bcs SET_SLOT_AND_BOOT
|
|
|
|
GSOS_QUIT:
|
|
|
|
ldx MACHID
|
|
|
|
cpx #$b3 ; IIgs (or //e with clock card)
|
|
|
|
bne MAIN_LOOP_WITH_BEEP
|
|
|
|
bit RDBTN0 ; safe to check O-A now
|
2023-09-06 22:17:42 +00:00
|
|
|
bpl MAIN_LOOP
|
2023-09-07 11:02:16 +00:00
|
|
|
and #$DF
|
|
|
|
cmp #$D1 ; Q? (GS/OS only)
|
|
|
|
bne MAIN_LOOP_WITH_BEEP
|
|
|
|
|
|
|
|
; 65816 GS/OS gunk here ...
|
|
|
|
.setcpu "65816"
|
|
|
|
rep #$80 ; reset processor status bits
|
|
|
|
bmi MAIN_LOOP_WITH_BEEP
|
|
|
|
lda $E100BD ; OS_BOOT (byte)
|
|
|
|
dec
|
|
|
|
bne MAIN_LOOP_WITH_BEEP
|
|
|
|
clc
|
|
|
|
xce ; swap carry and emulation flags (clear E)
|
|
|
|
lda LCBANK1 ; rw:LCBANK1
|
|
|
|
jmp $E0D000
|
|
|
|
.setcpu "6502"
|
|
|
|
|
2023-09-06 22:17:42 +00:00
|
|
|
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
|
|
|
|
|
2023-09-07 11:02:16 +00:00
|
|
|
DO_MLI_BOOT:
|
|
|
|
jsr HOME
|
2023-09-06 22:17:42 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
; 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
|
2023-09-06 22:25:38 +00:00
|
|
|
scrcode "1.0+"
|
2023-09-06 22:17:42 +00:00
|
|
|
.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 = *
|