mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-01-14 13:33:48 +00:00
keen: improve IIgs support
This commit is contained in:
parent
c960ca1b16
commit
1df61f7865
@ -32,7 +32,7 @@ HELLO: hello.bas
|
|||||||
LOADER: loader.o
|
LOADER: loader.o
|
||||||
ld65 -o LOADER loader.o -C ../../linker_scripts/apple2_1000.inc
|
ld65 -o LOADER loader.o -C ../../linker_scripts/apple2_1000.inc
|
||||||
|
|
||||||
loader.o: loader.s
|
loader.o: loader.s hardware_detect.s
|
||||||
ca65 -o loader.o loader.s -l loader.lst
|
ca65 -o loader.o loader.s -l loader.lst
|
||||||
|
|
||||||
####
|
####
|
||||||
|
@ -12,6 +12,7 @@ TBCOLOR = $C022 ; IIgs text foreground / background colors
|
|||||||
NEWVIDEO = $C029 ; IIgs graphics modes
|
NEWVIDEO = $C029 ; IIgs graphics modes
|
||||||
SPEAKER = $C030
|
SPEAKER = $C030
|
||||||
CLOCKCTL = $C034 ; bits 0-3 are IIgs border color
|
CLOCKCTL = $C034 ; bits 0-3 are IIgs border color
|
||||||
|
CYAREG = $C036 ; iigs motor detect and clock speed
|
||||||
SET_GR = $C050
|
SET_GR = $C050
|
||||||
SET_TEXT = $C051
|
SET_TEXT = $C051
|
||||||
FULLGR = $C052
|
FULLGR = $C052
|
||||||
|
153
games/keen/hardware_detect.s
Normal file
153
games/keen/hardware_detect.s
Normal file
@ -0,0 +1,153 @@
|
|||||||
|
;====================
|
||||||
|
; Hardware Detect
|
||||||
|
|
||||||
|
; we mostly care about the model type
|
||||||
|
; TODO: for hi-res we might want to detect language card
|
||||||
|
|
||||||
|
; Things we care about
|
||||||
|
; + Original Apple II / II+ have horrible keyboard support
|
||||||
|
; for platformers (only keydown events). If we detect IIe or
|
||||||
|
; later we can do better
|
||||||
|
; + Apple IIgs before ROM3 has broken lo-res PAGE2 support.
|
||||||
|
; we can enable the software workaround but it's slow
|
||||||
|
|
||||||
|
hardware_detect:
|
||||||
|
|
||||||
|
;=======================
|
||||||
|
; Hardware Detect Model
|
||||||
|
;=======================
|
||||||
|
; Yes Michaelangel007 I will eventually update linux_logo 6502
|
||||||
|
|
||||||
|
jsr detect_appleii_model
|
||||||
|
|
||||||
|
lda APPLEII_MODEL
|
||||||
|
cmp #'g'
|
||||||
|
bne not_iigs
|
||||||
|
|
||||||
|
is_a_iigs:
|
||||||
|
|
||||||
|
; enable 1MHz mode
|
||||||
|
; see hw.accel.a in 4cade
|
||||||
|
setspeed:
|
||||||
|
lda CYAREG
|
||||||
|
and #$7f
|
||||||
|
sta CYAREG
|
||||||
|
|
||||||
|
; gr/text page2 handling broken on early IIgs models (before ROM3)
|
||||||
|
; this enables the workaround
|
||||||
|
|
||||||
|
jsr ROM_TEXT2COPY ; set alternate display mode on IIgs
|
||||||
|
|
||||||
|
|
||||||
|
; set background color to black instead of blue
|
||||||
|
lda NEWVIDEO
|
||||||
|
and #%00011111 ; bit 7 = 0 -> IIgs Apple II-compat video modes
|
||||||
|
; bit 6 = 0 -> IIgs 128K memory map same as IIe
|
||||||
|
; bit 5 = 0 -> IIgs DHGR is color, not mono
|
||||||
|
; bits 0-4 unchanged
|
||||||
|
sta NEWVIDEO
|
||||||
|
lda #$F0
|
||||||
|
sta TBCOLOR ; white text on black background
|
||||||
|
lda #$00
|
||||||
|
sta CLOCKCTL ; black border
|
||||||
|
sta CLOCKCTL ; set twice for VidHD
|
||||||
|
|
||||||
|
not_iigs:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;===========================
|
||||||
|
; Check Apple II model
|
||||||
|
;===========================
|
||||||
|
; this is mostly for IIc support
|
||||||
|
; as it does interrupts differently
|
||||||
|
|
||||||
|
; some of this info from the document:
|
||||||
|
; Apple II Family Identification Routines 2.2
|
||||||
|
;
|
||||||
|
|
||||||
|
; ' ' = Apple II
|
||||||
|
; '+' = Apple II+
|
||||||
|
; 'e' = Apple IIe
|
||||||
|
; 'c' = Apple IIc
|
||||||
|
; 'g' = Apple IIgs
|
||||||
|
; 'm' = mac L/C with board
|
||||||
|
; 'j' = jplus
|
||||||
|
; '3' = Apple III
|
||||||
|
|
||||||
|
detect_appleii_model:
|
||||||
|
lda #' '
|
||||||
|
|
||||||
|
ldx $FBB3
|
||||||
|
|
||||||
|
; II is $38
|
||||||
|
; J-plus is $C9
|
||||||
|
; II+ is $EA (so is III)
|
||||||
|
; IIe and newer is $06
|
||||||
|
|
||||||
|
cpx #$38 ; ii
|
||||||
|
beq done_apple_detect
|
||||||
|
|
||||||
|
|
||||||
|
; ii+ is EA FB1E=AD
|
||||||
|
; iii is EA FB1E=8A 00
|
||||||
|
|
||||||
|
cpx #$EA
|
||||||
|
bne not_ii_iii
|
||||||
|
ii_or_iii:
|
||||||
|
|
||||||
|
lda #'+' ; ii+/iii
|
||||||
|
|
||||||
|
ldx $FB1E
|
||||||
|
cpx #$AD
|
||||||
|
beq done_apple_detect ; ii+
|
||||||
|
|
||||||
|
lda #'3'
|
||||||
|
bne done_apple_detect ; bra iii
|
||||||
|
|
||||||
|
not_ii_iii:
|
||||||
|
lda #'j' ; jplus
|
||||||
|
cpx #$C9
|
||||||
|
beq done_apple_detect
|
||||||
|
|
||||||
|
|
||||||
|
cpx #$06
|
||||||
|
bne done_apple_detect
|
||||||
|
|
||||||
|
apple_iie_or_newer:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ldx $FBC0 ; $EA on a IIe
|
||||||
|
; $E0 on a IIe enhanced
|
||||||
|
; $00 on a IIc/IIc+
|
||||||
|
|
||||||
|
; $FE1F = $60, IIgs
|
||||||
|
|
||||||
|
beq apple_iic
|
||||||
|
|
||||||
|
lda #'e'
|
||||||
|
cpx #$EA
|
||||||
|
beq done_apple_detect
|
||||||
|
; cpx #$E0
|
||||||
|
; beq done_apple_detect
|
||||||
|
|
||||||
|
; should do something if not $E0
|
||||||
|
|
||||||
|
; GS and IIe enhanced are the same, need to check
|
||||||
|
|
||||||
|
sec ; set carry
|
||||||
|
jsr $FE1F
|
||||||
|
bcs done_apple_detect ;If carry then IIe enhanced
|
||||||
|
|
||||||
|
; get here we're a IIgs?
|
||||||
|
|
||||||
|
lda #'g'
|
||||||
|
bne done_apple_detect
|
||||||
|
|
||||||
|
apple_iic:
|
||||||
|
lda #'c'
|
||||||
|
|
||||||
|
done_apple_detect:
|
||||||
|
sta APPLEII_MODEL
|
||||||
|
rts
|
@ -48,6 +48,37 @@ filbuf = $3D6 ; filbuf: .res 4 ; = bit2tbl+86
|
|||||||
|
|
||||||
loader_start:
|
loader_start:
|
||||||
|
|
||||||
|
jsr hardware_detect
|
||||||
|
|
||||||
|
lda #<model_string
|
||||||
|
sta OUTL
|
||||||
|
lda #>model_string
|
||||||
|
sta OUTH
|
||||||
|
|
||||||
|
lda APPLEII_MODEL
|
||||||
|
sta model_string+17
|
||||||
|
|
||||||
|
cmp #'g'
|
||||||
|
bne go_print
|
||||||
|
|
||||||
|
lda #'s'
|
||||||
|
sta model_string+18
|
||||||
|
|
||||||
|
go_print:
|
||||||
|
|
||||||
|
ldy #0
|
||||||
|
print_model:
|
||||||
|
lda (OUTL),Y
|
||||||
|
beq print_model_done
|
||||||
|
ora #$80
|
||||||
|
sta $7d0,Y
|
||||||
|
iny
|
||||||
|
jmp print_model
|
||||||
|
print_model_done:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
lda #LOAD_TITLE
|
lda #LOAD_TITLE
|
||||||
sta WHICH_LOAD
|
sta WHICH_LOAD
|
||||||
|
|
||||||
@ -267,10 +298,10 @@ quick_print:
|
|||||||
beq quick_print_done
|
beq quick_print_done
|
||||||
jsr COUT1
|
jsr COUT1
|
||||||
iny
|
iny
|
||||||
jmp quick_print
|
; jmp quick_print
|
||||||
|
|
||||||
quick_print_done:
|
quick_print_done:
|
||||||
; rts
|
rts
|
||||||
|
|
||||||
; jsr quick_print
|
; jsr quick_print
|
||||||
|
|
||||||
@ -285,6 +316,8 @@ fnf_keypress:
|
|||||||
error_string:
|
error_string:
|
||||||
.byte "PLEASE INSERT DISK 1, PRESS RETURN",0
|
.byte "PLEASE INSERT DISK 1, PRESS RETURN",0
|
||||||
|
|
||||||
|
model_string:
|
||||||
|
.byte "DETECTED APPLE II",0,0,0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -679,6 +712,8 @@ step2: .byte $70, $2c, $26, $22, $1f, $1e, $1d, $1c
|
|||||||
sectbl: .byte $00,$0d,$0b,$09,$07,$05,$03,$01,$0e,$0c,$0a,$08,$06,$04,$02,$0f
|
sectbl: .byte $00,$0d,$0b,$09,$07,$05,$03,$01,$0e,$0c,$0a,$08,$06,$04,$02,$0f
|
||||||
|
|
||||||
|
|
||||||
|
.include "hardware_detect.s"
|
||||||
|
|
||||||
; From $BA96 of DOS33
|
; From $BA96 of DOS33
|
||||||
;nibtbl: .res 128 ; = *
|
;nibtbl: .res 128 ; = *
|
||||||
; .byte $00,$01,$98,$99,$02,$03,$9C,$04 ; $BA96 ; 00
|
; .byte $00,$01,$98,$99,$02,$03,$9C,$04 ; $BA96 ; 00
|
||||||
|
@ -140,7 +140,7 @@ MARS_X = $A0
|
|||||||
MARS_Y = $A1
|
MARS_Y = $A1
|
||||||
INITIAL_SOUND = $A2
|
INITIAL_SOUND = $A2
|
||||||
PLAY_END_SOUND = $A3
|
PLAY_END_SOUND = $A3
|
||||||
|
APPLEII_MODEL = $A4
|
||||||
|
|
||||||
WHICH_SLOT = $DA
|
WHICH_SLOT = $DA
|
||||||
JS_BUTTON_STATE = $DB
|
JS_BUTTON_STATE = $DB
|
||||||
|
12
keyboard/README
Normal file
12
keyboard/README
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
Apple II Keyboard Support
|
||||||
|
|
||||||
|
Original Apple II / Apple II+
|
||||||
|
|
||||||
|
|
||||||
|
Apple IIe
|
||||||
|
If you read $C010 (KEYRESET) bit #7 is "any key down" meaning
|
||||||
|
you can detect if a key is being held down
|
||||||
|
|
||||||
|
Apple IIc / IIgs
|
||||||
|
Possibly have actual keyboard buffer you can enable, along
|
||||||
|
with interrupts?
|
Loading…
x
Reference in New Issue
Block a user