second: update loader

This commit is contained in:
Vince Weaver 2023-10-20 08:48:02 -04:00
parent becb8fd276
commit 5c3e3e91ec
5 changed files with 357 additions and 47 deletions

View File

@ -6,29 +6,35 @@ EMPTY_DISK = ../../empty_disk/empty.dsk
TOKENIZE = ../../utils/asoft_basic-utils/tokenize_asoft
LINKER_SCRIPTS = ../../linker_scripts/
all: second.dsk
all: second_d1.dsk second_d2.dsk
#second.dsk: HELLO ZW
# cp $(EMPTY_DISK) second.dsk
# $(DOS33) -y second.dsk SAVE A HELLO
# $(DOS33) -y second.dsk BSAVE -a 0x6000 ZW
second.dsk: QBOOT QLOAD SECOND MUSIC START \
second_d1.dsk: QBOOT QLOAD MUSIC START \
./part01_intropan/INTRO \
./part05_dot_tunnel/TUNNEL \
./part16_ocean/OCEAN \
./part18_3d/THREED
cp $(EMPTY_DISK) second.dsk
$(DOS33_RAW) second.dsk 0 0 QBOOT 0 1
$(DOS33_RAW) second.dsk 0 2 QBOOT 1 1
$(DOS33_RAW) second.dsk 0 4 QBOOT 2 1
$(DOS33_RAW) second.dsk 1 0 QLOAD 0 0
$(DOS33_RAW) second.dsk 3 0 MUSIC 0 0
$(DOS33_RAW) second.dsk 5 0 START 0 0
$(DOS33_RAW) second.dsk 8 0 ./part01_intropan/INTRO 0 0
$(DOS33_RAW) second.dsk 11 0 ./part05_dot_tunnel/TUNNEL 0 0
$(DOS33_RAW) second.dsk 13 0 ./part16_ocean/OCEAN 0 0
$(DOS33_RAW) second.dsk 20 0 ./part18_3d/THREED 0 0
cp $(EMPTY_DISK) second_d1.dsk
$(DOS33_RAW) second_d1.dsk 0 0 QBOOT 0 1
$(DOS33_RAW) second_d1.dsk 0 2 QBOOT 1 1
$(DOS33_RAW) second_d1.dsk 0 4 QBOOT 2 1
$(DOS33_RAW) second_d1.dsk 1 0 QLOAD 0 0
$(DOS33_RAW) second_d1.dsk 3 0 MUSIC 0 0
$(DOS33_RAW) second_d1.dsk 5 0 START 0 0
$(DOS33_RAW) second_d1.dsk 8 0 ./part01_intropan/INTRO 0 0
$(DOS33_RAW) second_d1.dsk 11 0 ./part05_dot_tunnel/TUNNEL 0 0
$(DOS33_RAW) second_d1.dsk 13 0 ./part16_ocean/OCEAN 0 0
second_d2.dsk: QBOOT QLOAD2 MUSIC2 START \
./part18_3d/THREED
cp $(EMPTY_DISK) second_d2.dsk
$(DOS33_RAW) second_d2.dsk 0 0 QBOOT 0 1
$(DOS33_RAW) second_d2.dsk 0 2 QBOOT 1 1
$(DOS33_RAW) second_d2.dsk 0 4 QBOOT 2 1
$(DOS33_RAW) second_d2.dsk 1 0 QLOAD2 0 0
$(DOS33_RAW) second_d2.dsk 3 0 MUSIC2 0 0
$(DOS33_RAW) second_d2.dsk 5 0 START 0 0
$(DOS33_RAW) second_d2.dsk 20 0 ./part18_3d/THREED 0 0
####
@ -53,11 +59,24 @@ qload.o: qload.s \
pt3_lib_detect_model.s pt3_lib_mockingboard_detect.s \
pt3_lib_mockingboard_setup.s interrupt_handler.s \
pt3_lib_mockingboard_patch.s
# hgr.inc simple_sounds.s \
# audio.s decompress_fast_v2.s
# hgr_hlin.s hgr_vlin.s hgr_box.s hgr_tables.s hgr_14x14_sprite.s \
# hgr_sprite.s hgr_partial_restore.s
ca65 -o qload.o qload.s -l qload.lst
ca65 -o qload.o qload.s -l qload2.lst
####
QLOAD2: qload2.o
ld65 -o QLOAD2 qload2.o -C $(LINKER_SCRIPTS)/apple2_1200.inc
qload2.o: qload2.s \
gr_offsets.s \
wait.s wait_a_bit.s \
lc_detect.s gr_fast_clear.s \
text_print.s start2.s \
hardware_detect.s \
pt3_lib_detect_model.s pt3_lib_mockingboard_detect.s \
pt3_lib_mockingboard_setup.s interrupt_handler.s \
pt3_lib_mockingboard_patch.s
ca65 -o qload2.o qload2.s -l qload2.lst
####
@ -82,7 +101,6 @@ start.o: start.s zx02_optim.s \
zp.inc hardware.inc qload.inc music.inc
ca65 -o start.o start.s -l start.lst
####
qload.inc: generate_common QLOAD
@ -109,6 +127,23 @@ qload.inc: generate_common QLOAD
####
qload2.inc: generate_common QLOAD2
./generate_common -a 0x1200 -s load_file qload2.lst > qload2.inc
./generate_common -a 0x1200 -s detect_appleii_model qload2.lst >> qload2.inc
./generate_common -a 0x1200 -s clear_all qload2.lst >> qload2.inc
./generate_common -a 0x1200 -s set_normal qload2.lst >> qload2.inc
./generate_common -a 0x1200 -s set_inverse qload2.lst >> qload2.inc
./generate_common -a 0x1200 -s wait qload2.lst >> qload2.inc
./generate_common -a 0x1200 -s wait_a_bit qload2.lst >> qload2.inc
./generate_common -a 0x1200 -s move_and_print qload2.lst >> qload2.inc
./generate_common -a 0x1200 -s detect_language_card qload2.lst >> qload2.inc
./generate_common -a 0x1200 -s mockingboard_detect qload2.lst >> qload2.inc
./generate_common -a 0x1200 -s clear_bottom qload2.lst >> qload2.inc
./generate_common -a 0x1200 -s clear_bottoms qload2.lst >> qload2.inc
./generate_common -a 0x1200 -s clear_screens qload2.lst >> qload2.inc
####
music.inc: generate_common MUSIC
./generate_common -a 0xd000 -s pt3_init_song music.lst > music.inc
./generate_common -a 0xd000 -s mockingboard_init music.lst >> music.inc
@ -121,7 +156,7 @@ music.inc: generate_common MUSIC
####
MUSIC: music.o
MUSIC: music.o qload.inc
ld65 -o MUSIC music.o -C $(LINKER_SCRIPTS)/apple2_d000.inc
music.o: music.s zp.inc \
@ -134,6 +169,21 @@ music.o: music.s zp.inc \
pt3_lib_irq_handler.s
ca65 -o music.o music.s -l music.lst
####
MUSIC2: music2.o qload2.inc
ld65 -o MUSIC2 music2.o -C $(LINKER_SCRIPTS)/apple2_d000.inc
music2.o: music2.s zp.inc \
music/second_3d.pt3 \
pt3_lib_core.s \
pt3_lib_mockingboard_detect.s \
pt3_lib_mockingboard.inc \
pt3_lib_init.s \
pt3_lib_mockingboard_setup.s \
pt3_lib_irq_handler.s
ca65 -o music2.o music2.s -l music2.lst

View File

@ -0,0 +1,57 @@
;====================
; Hardware Detect
; simplified version for disk2
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:
; 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:
;======================
; detect mockingboard
lda #0
sta SOUND_STATUS
PT3_ENABLE_APPLE_IIC = 1
jsr mockingboard_detect
bcc mockingboard_notfound
mockingboard_found:
lda SOUND_STATUS
ora #SOUND_MOCKINGBOARD
sta SOUND_STATUS
mockingboard_notfound:
rts
.include "pt3_lib_mockingboard.inc"

33
demos/second/music2.s Normal file
View File

@ -0,0 +1,33 @@
; music, music
; by Vince `deater` Weaver vince@deater.net
.include "hardware.inc"
.include "zp.inc"
;.include "qload.inc"
music_lib:
PT3_ENABLE_APPLE_IIC = 1
nop ; urgh to keep interrupt_handler from starting at $C4
; which broke auto-patcher
; pt3 player
; .include "pt3_lib_detect_model.s"
.include "pt3_lib_core.s"
.include "pt3_lib_init.s"
.include "pt3_lib_mockingboard_setup.s"
.include "interrupt_handler.s"
.include "pt3_lib_mockingboard_detect.s"
; only load one music track, self modify to make other
.align $100
PT3_LOC:
;.incbin "music/z00m_unreal2_part1.pt3"
;.incbin "music/z00m_unreal2_part2.pt3"
.incbin "music/second_3d.pt3"

192
demos/second/qload2.s Normal file
View File

@ -0,0 +1,192 @@
; Loader
.include "zp.inc"
.include "hardware.inc"
;.include "common_defines.inc"
.include "qboot.inc"
qload_start:
; first time entry
; start by loading text title
; lda #0 ; load ZW engine
; sta WHICH_LOAD
lda #1
sta CURRENT_DISK ; current disk number
; jsr load_file
jmp second_start
; jmp $2000 ; jump to ZW
;====================================
; loads file specified by WHICH_LOAD
;====================================
load_file:
ldx WHICH_LOAD
lda which_disk_array,X
cmp CURRENT_DISK
bne change_disk
load_file_no_diskcheck:
lda load_address_array,X
sta load_address
lda track_array,X
sta load_track
lda sector_array,X
sta load_sector
lda length_array,X
sta load_length
jsr load_new
rts
;===================================================
;===================================================
; change disk
;===================================================
;===================================================
change_disk:
.if 0
; turn off disk drive light
jsr driveoff
jsr TEXT
jsr HOME
lda #<error_string
sta OUTL
lda #>error_string
sta OUTH
ldx WHICH_LOAD
lda which_disk_array,X
clc
adc #48
ldy #19
sta (OUTL),Y
ldy #0
quick_print:
lda (OUTL),Y
beq quick_print_done
jsr COUT1
iny
jmp quick_print
quick_print_done:
fnf_keypress:
lda KEYPRESS
bpl fnf_keypress
bit KEYRESET
;==============================================
; actually verify proper disk is there
; read T0:S0 and verify proper disk
lda WHICH_LOAD
pha
ldx #LOAD_FIRST_SECTOR ; load track 0 sector 0
stx WHICH_LOAD
jsr load_file_no_diskcheck
pla
sta WHICH_LOAD
tax
; first sector now in $c00
; offset 59
; disk1 = $0a
; disk2 = $32 ('2')
; disk3 = $33 ('3')
lda $c59
cmp #$0a
beq is_disk1
cmp #$32
beq is_disk2
cmp #$33
beq is_disk3
bne change_disk ; unknown disk
is_disk1:
lda #1
bne disk_compare
is_disk2:
lda #2
bne disk_compare
is_disk3:
lda #3
disk_compare:
cmp which_disk_array,X
bne change_disk ; disk mismatch
;==============================================
; all good, retry original load
jsr HOME
ldx WHICH_LOAD
lda which_disk_array,X
sta CURRENT_DISK
jmp load_file
; offset for disk number is 19
error_string:
.byte "PLEASE INSERT DISK 1, PRESS RETURN",0
.endif
which_disk_array:
.byte 1,1 ; MUSIC2, THREED
load_address_array:
.byte $D0,$40 ; MUSIC2, THREED
track_array:
.byte 3, 20 ; MUSIC2, THREED
sector_array:
.byte 0, 0 ; MUSIC2, THREED
length_array:
.byte 32, 128 ; MUSIC2, THREED
.include "wait.s"
.include "start2.s"
.include "lc_detect.s"
.include "wait_a_bit.s"
.include "gr_fast_clear.s"
.include "text_print.s"
.include "gr_offsets.s"
.include "pt3_lib_detect_model.s"
.include "pt3_lib_mockingboard_detect.s"
qload_end:
.assert (>qload_end - >qload_start) < $e , error, "loader too big"

View File

@ -74,28 +74,6 @@ ENVELOPE_SHAPE = $7D
PATTERN_L = $7E
PATTERN_H = $7F
.if 0
; ym player
CURRENT_FRAME_L = $70
CURRENT_FRAME_H = $71
BASE_FRAME_L = $72
BASE_FRAME_H = $73
CURRENT_CHUNK = $74
TIME_MINUTES = $75
TIME_SECONDS = $76
CURSOR_X = $77
CURSOR_Y = $78
LEVEL_OVER = $7B
LEVEL_FAIL = 1
LEVEL_WIN = 2
DOOR_OPEN = $7C
CHUNK_NEXT_LOAD = $7D
CHUNK_NEXT_PLAY = $7E
LOAD_NEXT_CHUNK = $7F
.endif
; rest of pt3_player
; rest of pt3_player
PT3_TEMP = $80