anothermist: got it working

This commit is contained in:
Vince Weaver 2020-06-21 01:38:07 -04:00
parent 5dd6741f26
commit b5d998d60c
22 changed files with 4421 additions and 43 deletions

View File

@ -7,12 +7,12 @@ PNG2LZ4 = ../gr-utils/png2lz4
all: am.dsk
am.dsk: HELLO ANOTHERMIST
am.dsk: HELLO ANOTHERMIST INTRO TITLE
cp empty.dsk am.dsk
$(DOS33) -y am.dsk SAVE A HELLO
$(DOS33) -y am.dsk BSAVE -a 0x1700 ANOTHERMIST
$(DOS33) -y am.dsk BSAVE -a 0x1700 INTRO
$(DOS33) -y am.dsk BSAVE -a 0xd00 TITLE
####
@ -23,33 +23,6 @@ intro.o: intro.s \
gr_copy.s gr_fast_clear.s gr_pageflip.s gr_unrle.s gr_putsprite.s \
gr_overlay.s gr_run_sequence.s \
keyboard.s random16.s text_print.s zp.inc \
intro_graphics/01_building/intro_car.inc \
intro_graphics/01_building/intro_building_car.inc \
intro_graphics/01_building/intro_building.inc \
intro_graphics/02_outer_door/outer_door.inc \
intro_graphics/02_outer_door/feet.inc \
intro_graphics/03_elevator/intro_elevator.inc \
intro_graphics/03_elevator/intro_off_elevator.inc \
intro_graphics/03_elevator/intro_walking.inc \
intro_graphics/04_keypad/intro_scanner_door.inc \
intro_graphics/04_keypad/intro_approach.inc \
intro_graphics/04_keypad/intro_keypad_bg.inc \
intro_graphics/04_keypad/intro_hands.inc \
intro_graphics/04_keypad/intro_opening.inc \
intro_graphics/05_scanner/intro_scanner.inc \
intro_graphics/05_scanner/intro_scanning.inc \
intro_graphics/05_scanner/intro_ai_bg.inc \
intro_graphics/05_scanner/intro_ai.inc \
intro_graphics/06_console/intro_desktop.inc \
intro_graphics/06_console/intro_cursor.inc \
intro_graphics/06_console/intro_collider.inc \
intro_graphics/07_soda/intro_open_soda.inc \
intro_graphics/07_soda/intro_drinking.inc \
intro_graphics/08_lightning/lightning.inc \
intro_graphics/09_tunnel/intro_tunnel1.inc \
intro_graphics/09_tunnel/intro_tunnel2.inc \
intro_graphics/10_gone/intro_zappo.inc \
intro_graphics/10_gone/intro_gone.inc \
intro_data_01.lz4 \
intro_data_04.lz4 \
intro_data_06.lz4 \

47
another_myst/gr_plot.s Normal file
View File

@ -0,0 +1,47 @@
;================================
; plot routine
;================================
; Xcoord in X
; Ycoord in A
; color in COLOR
plot:
stx XPOS
lsr ; shift bottom bit into carry ; 2
bcc plot_even ; 2nt/3
plot_odd:
ldx #$f0 ; 2
bcs plot_c_done ; 2nt/3
plot_even:
ldx #$0f ; 2
plot_c_done:
stx MASK ; 3
asl ; shift back (now even) ; 2
tay
lda gr_offsets,Y ; lookup low-res memory address ; 4
clc ; 2
adc XPOS ; 3
sta GBASL ; 3
iny ; 2
lda gr_offsets,Y ; 4
adc DRAW_PAGE ; add in draw page offset ; 3
sta GBASH ; 3
ldy #0 ; 2
plot_write:
lda MASK ; 3
eor #$ff ; 2
and (GBASL),Y ; 5
sta COLOR_MASK ; 3
lda COLOR ; 3
and MASK ; 3
ora COLOR_MASK ; 3
sta (GBASL),Y ; 5
rts ; 6

View File

@ -0,0 +1,129 @@
;=================================
; Display a sequence of images
;=================================
; quit if escape pressed?
; pattern is TIME, PTR
; if time==0, then done
; if time==255, reload $C00 with PTR
; if time==0..127 wait TIME, then overlay PTR over $C00
; if time==128..254, wait TIME-128, then overlay GBASL over $C00
run_sequence:
ldy #0
run_sequence_loop:
lda (INTRO_LOOPL),Y ; get time
beq run_sequence_done ; if zero, then done
cmp #$ff ; if $ff, then load image to $c00
bne not_reload
reload_image:
iny
lda (INTRO_LOOPL),Y
sta GBASL
iny
lda (INTRO_LOOPL),Y
sta GBASH
iny
sty INTRO_LOOPER ; save for later
lda #$0c ; load to $c00
jsr load_rle_gr
jmp seq_stuff
not_reload:
tax
cmp #$80 ;if negative, no need to load pointer
bcs no_set_image_ptr ; bge (branch if greater equal)
get_image_ptr:
iny
lda (INTRO_LOOPL),Y
sta GBASL
iny
lda (INTRO_LOOPL),Y
sta GBASH
no_set_image_ptr:
txa
and #$7f
tax
cpx #1
beq seq_no_wait
jsr long_wait
seq_no_wait:
iny
sty INTRO_LOOPER ; save for later
lda #$10 ; load to $1000
jsr load_rle_gr
jsr gr_overlay
jsr page_flip
seq_stuff:
ldy INTRO_LOOPER
; exit early if escape pressed
lda KEYPRESS
cmp #27+$80
beq run_sequence_done
bit KEYRESET
jmp run_sequence_loop
run_sequence_done:
rts
;====================================
; Display a sequence of images 40x40
run_sequence_40x40:
ldy #0
run_sequence_40x40_loop:
lda (INTRO_LOOPL),Y ; get time
beq run_sequence_40x40_done
tax
jsr long_wait
iny
lda (INTRO_LOOPL),Y
sta GBASL
iny
lda (INTRO_LOOPL),Y
sta GBASH
iny
sty INTRO_LOOPER ; save for later
lda #$10 ; load to $1000
jsr load_rle_gr
jsr gr_overlay_40x40
jsr page_flip
ldy INTRO_LOOPER
jmp run_sequence_40x40_loop
run_sequence_40x40_done:
rts
;=====================
; long(er) wait
; waits approximately ?? ms
long_wait:
lda #64
jsr WAIT ; delay
dex
bne long_wait
rts

55
another_myst/gr_vlin.s Normal file
View File

@ -0,0 +1,55 @@
;=========================================
; vlin
;=========================================
; X, V2 at Y
; from x=top, v2=bottom
vlin:
sty TEMPY ; save Y (x location)
vlin_loop:
txa ; a=x (get first y)
and #$fe ; Clear bottom bit
tay ;
lda gr_offsets,Y ; lookup low-res memory address low
sta GBASL ; put it into our indirect pointer
iny
lda gr_offsets,Y ; lookup low-res memory address high
clc
adc DRAW_PAGE ; add in draw page offset
sta GBASH ; put into top of indirect
ldy TEMPY ; load back in y (x offset)
txa ; load back in x (current y)
lsr ; check the low bit
bcc vlin_low ; if not set, skip to low
vlin_high:
lda #$F0 ; setup masks
sta MASK
lda #$0f
bcs vlin_too_slow
vlin_low: ; setup masks
lda #$0f
sta MASK
lda #$f0
vlin_too_slow:
and (GBASL),Y ; mask current byte
sta (GBASL),Y ; and store back
lda MASK ; mask the color
and COLOR
ora (GBASL),Y ; or into the right place
sta (GBASL),Y ; store it
inx ; increment X (current y)
cpx V2 ; compare to the limit
bcc vlin_loop ; if <= then loop
rts ; return

View File

@ -1,3 +1,3 @@
5 HOME
10 PRINT "ANOTHER MIST V0.1 LOADING"
120 PRINT CHR$(4);"BRUN ANOTHERMIST"
120 PRINT CHR$(4);"BRUN TITLE"

2012
another_myst/intro.s Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,124 @@
;=================================
;=================================
; Intro Segment 01 Data (Building)
;=================================
;=================================
.include "intro_graphics/01_building/intro_building.inc"
.include "intro_graphics/01_building/intro_car.inc"
.include "intro_graphics/01_building/intro_building_car.inc"
;========================
; Car driving up sequence
building_sequence:
.byte 255
.word building_rle
.byte 1
.word building_rle
.byte 128+126 ; .word intro_car1
.byte 128+2 ; .word intro_car2
.byte 128+2 ; .word intro_car3
.byte 128+2 ; .word intro_car4
.byte 128+2 ; .word intro_car5
.byte 128+2 ; .word intro_car6
.byte 128+2 ; .word intro_car7
.byte 128+2 ; .word intro_car8
.byte 128+2 ; .word intro_car9
.byte 128+126 ; .word intro_car10
; .byte 0
;========================
; Getting out of car sequence
outtacar_sequence:
.byte 255
.word building_car_rle
.byte 1
.word building_car_rle
.byte 100
.word intro_car12
.byte 128+50 ; .word intro_car13
.byte 128+125 ; .word intro_car14
.byte 125
.word intro_car14
.byte 0
;=================================
;=================================
; Intro Segment 02 Data (Door)
;=================================
;=================================
; background graphics
.include "intro_graphics/02_outer_door/outer_door.inc"
.include "intro_graphics/02_outer_door/feet.inc"
.include "intro_graphics/08_lightning/nothing.inc"
;=============================
; Feet going in door sequence
feet_sequence:
.byte 255
.word outer_door_rle
.byte 1
.word outer_door_rle
.byte 128+100 ; .word feet01_rle
.byte 128+10 ; .word feet02_rle
.byte 128+10 ; .word feet03_rle
.byte 128+10 ; .word feet04_rle
.byte 128+10 ; .word feet05_rle
.byte 128+10 ; .word feet06_rle
.byte 128+10 ; .word feet07_rle
.byte 128+10 ; .word feet08_rle
.byte 128+30 ; .word feet09_rle
.byte 128+10 ; .word feet10_rle
.byte 128+10 ; .word feet11_rle
.byte 128+10 ; .word feet12_rle
.byte 128+10 ; .word feet13_rle
.byte 128+10 ; .word feet14_rle
.byte 128+10 ; .word feet15_rle
.byte 10
.word nothing_rle
.byte 100
.word nothing_rle
.byte 0
;=================================
;=================================
; Intro Segment 03 Data (Elevator)
;=================================
;=================================
.include "intro_graphics/03_elevator/intro_elevator.inc"
.include "intro_graphics/03_elevator/intro_off_elevator.inc"
.include "intro_graphics/03_elevator/intro_walking.inc"
; Elevator light co-ordinates
; we load them backwards
indicators:
.byte 18,4 ; 4
.byte 16,3 ; 3
.byte 14,2 ; 2
.byte 18,2 ; 1
.byte 16,1 ; 0
; Walking off elevator sequence
walking_sequence:
.byte 20
.word walking01_rle
.byte 128+20 ; .word walking02_rle
.byte 128+20 ; .word walking03_rle
.byte 128+20 ; .word walking04_rle
.byte 128+20 ; .word walking05_rle
.byte 128+20 ; .word walking06_rle
.byte 128+20 ; .word walking07_rle
.byte 128+20 ; .word walking08_rle
.byte 20
.word walking08_rle
.byte 0

View File

@ -0,0 +1,247 @@
;=================================
;=================================
; Intro Segment 04 Data (Keypad)
;=================================
;=================================
.include "intro_graphics/04_keypad/intro_scanner_door.inc"
.include "intro_graphics/04_keypad/intro_approach.inc"
.include "intro_graphics/04_keypad/intro_keypad_bg.inc"
.include "intro_graphics/04_keypad/intro_hands.inc"
.include "intro_graphics/04_keypad/intro_opening.inc"
.include "intro_graphics/08_lightning/nothing.inc"
; Approaching keypad sequence
approach_sequence:
.byte 20
.word approach01_rle
.byte 128+20 ; .word approach02_rle
.byte 128+20 ; .word approach03_rle
.byte 128+20 ; .word approach04_rle
.byte 128+20 ; .word approach05_rle
.byte 128+20 ; .word approach06_rle
.byte 128+20 ; .word approach07_rle
.byte 80
.word approach07_rle
.byte 0
; Using keypad sequence
keypad_sequence:
.byte 9
.word hand04_01_rle
.byte 9
.word hand04_02_rle
.byte 9
.word hand04_03_rle
.byte 9
.word hand04_02_rle
.byte 9
.word hand05_01_rle
.byte 9
.word hand05_02_rle
.byte 9
.word hand05_03_rle
.byte 9
.word hand05_04_rle
.byte 9
.word hand01_01_rle
.byte 9
.word hand01_02_rle
.byte 9
.word hand01_03_rle
.byte 9
.word hand04_02_rle
.byte 9
.word hand01_02_rle
.byte 9
.word hand01_03_rle
.byte 9
.word hand04_02_rle
.byte 9
.word hand09_01_rle
.byte 9
.word hand09_02_rle
.byte 9
.word hand09_03_rle
.byte 9
.word hand09_04_rle
.byte 9
.word hand09_05_rle
.byte 9
.word hand03_01_rle
.byte 9
.word hand03_02_rle
.byte 9
.word hand03_03_rle
.byte 9
.word hand03_04_rle
.byte 9
.word hand02_01_rle
.byte 9
.word hand02_02_rle
.byte 9
.word hand02_03_rle
.byte 9
.word hand02_04_rle
.byte 9
.word hand02_05_rle
.byte 12
.word hand02_05_rle
.byte 0
; Door opening sequence
opening_sequence:
.byte 15
.word opening01_rle
.byte 128+15 ; .word opening02_rle
.byte 128+15 ; .word opening03_rle
.byte 128+15 ; .word opening04_rle
.byte 128+15 ; .word opening05_rle
.byte 128+15 ; .word opening06_rle
.byte 128+15 ; .word opening07_rle
.byte 128+15 ; .word opening08_rle
.byte 128+15 ; .word opening09_rle
.byte 128+15 ; .word opening10_rle
.byte 128+15 ; .word opening11_rle
.byte 128+15 ; .word opening12_rle
.byte 15
.word nothing_rle
.byte 100
.word nothing_rle
.byte 0
;=================================
;=================================
; Intro Segment 05 Data (Scanner)
;=================================
;=================================
.include "intro_graphics/05_scanner/intro_scanner.inc"
.include "intro_graphics/05_scanner/intro_scanning.inc"
.include "intro_graphics/05_scanner/intro_ai_bg.inc"
.include "intro_graphics/05_scanner/intro_ai.inc"
; Scanning sequence
scanning_sequence:
.byte 15
.word scan01_rle
.byte 128+15 ; .word scan02_rle
.byte 128+15 ; .word scan03_rle
.byte 128+15 ; .word scan04_rle
.byte 128+15 ; .word scan05_rle
.byte 128+15 ; .word scan06_rle
.byte 128+15 ; .word scan07_rle
.byte 128+15 ; .word scan08_rle
.byte 128+15 ; .word scan09_rle
.byte 128+15 ; .word scan10_rle
.byte 128+20 ; .word scan11_rle
.byte 128+20 ; .word scan12_rle
.byte 128+20 ; .word scan13_rle
.byte 128+20 ; .word scan14_rle
.byte 128+20 ; .word scan15_rle
.byte 128+20 ; .word scan16_rle
.byte 128+40 ; .word scan17_rle
.byte 128+40 ; .word scan18_rle
.byte 128+40 ; .word scan19_rle
.byte 40
.word scan19_rle
.byte 0
; AI sequence
ai_sequence:
.byte 0,50 ; pause at start, no dna
.word ai01_rle ; slices
.byte 0,50 ; pause at start, no dna
.word ai02_rle ; slices_zoom
.byte 0,50 ; pasue as start, no dna
.word ai03_rle ; little circle
.byte 0,50 ; pause at start, no dna
.word ai04_rle ; big circle
.byte 1,20 ; pause longer, yes dna
.word ai05_rle ; key
.byte 0,0
; .word ai05_rle ; key
; .byte 0
static_pattern:
.word nothing_rle ; 0
.word nothing_rle ; 2
.word static01_rle ; 4
.word static03_rle ; 6
.word static02_rle ; 8
.word static01_rle ; 10
; Scanning text
good_evening:
.byte 2,21,"GOOD EVENING PROFESSOR.",0
ferrari:
.byte 2,21,"I SEE YOU HAVE DRIVEN HERE IN YOUR",0
.byte 2,22,"FERRARI.",0
dna_list:
.word dna0_sprite
.word dna1_sprite
.word dna2_sprite
.word dna3_sprite
.word dna4_sprite
.word dna5_sprite
.word dna6_sprite
.word dna7_sprite
dna0_sprite:
.byte $7,$2
.byte $66,$40,$40,$40,$40,$40,$cc
.byte $06,$00,$00,$00,$00,$00,$0c
dna1_sprite:
.byte $7,$2
.byte $00,$66,$40,$40,$40,$cc,$00
.byte $00,$06,$00,$00,$00,$0c,$00
dna2_sprite:
.byte $7,$2
.byte $00,$00,$66,$40,$cc,$00,$00
.byte $00,$00,$06,$00,$0c,$00,$00
dna3_sprite:
.byte $7,$2
.byte $00,$00,$00,$66,$00,$00,$00
.byte $00,$00,$00,$06,$00,$00,$00
dna4_sprite:
.byte $7,$2
.byte $00,$00,$CC,$40,$66,$00,$00
.byte $00,$00,$0C,$00,$06,$00,$00
dna5_sprite:
.byte $7,$2
.byte $00,$CC,$40,$40,$40,$66,$00
.byte $00,$0C,$00,$00,$00,$06,$00
dna6_sprite:
.byte $7,$2
.byte $CC,$40,$40,$40,$40,$40,$66
.byte $0C,$00,$00,$00,$00,$00,$06
dna7_sprite:
.byte $7,$2
.byte $66,$40,$40,$40,$40,$40,$cc
.byte $06,$00,$00,$00,$00,$00,$0c

View File

@ -0,0 +1,265 @@
;=================================
;=================================
; Intro Segment 06 Data (Console)
;=================================
;=================================
.include "intro_graphics/06_console/intro_desktop.inc"
.include "intro_graphics/06_console/intro_cursor.inc"
.include "intro_graphics/06_console/intro_collider.inc"
; Power-up sequence
powerup_sequence:
.byte 20
.word powerup01_rle
.byte 128+60 ; .word powerup02_rle
.byte 128+20 ; .word powerup03_rle
.byte 20
.word powerup03_rle
.byte 0
; Cursor sequence
cursor_sequence:
.byte 60
.word cursor01_rle
.byte 128+40 ; .word cursor02_rle
.byte 128+20 ; .word cursor03_rle
.byte 128+20 ; .word cursor04_rle
.byte 128+20 ; .word cursor05_rle
.byte 128+20 ; .word cursor06_rle
.byte 128+20 ; .word cursor07_rle
.byte 128+20 ; .word cursor08_rle
.byte 60
.word cursor08_rle
.byte 0
peanut:
.byte 0,2,"COPYRIGHT (C) 1977 PEANUT COMPUTER, INC.",0
.byte 0,3,"ALL RIGHTS RESERVED.",0
.byte 0,5,"CDOS VERSION 5.01",0
.byte 0,18,"> ",(' '|$80),0
.byte 255
project_23:
.byte "RUN PROJECT 23",0
accelerator:
.byte 0,0, "MODIFICATION OF PARAMETERS",0
.byte 0,1, "RELATING TO PARTICLE",0
.byte 0,2, "ACCELERATOR (SYNCHOTRON).",0
.byte 0,3, " ___________",0
.byte 0,4, ":ROOM 3 ",('+'|$80),":\ E: 23%",0
.byte 0,5, ": : : G: .005",0
.byte 0,6, ": : : : RK: 77.2L",0
.byte 0,7, ": : :",0
.byte 0,8, ": : : OPT: G+",0
.byte 0,9, ": : : :",0
.byte 0,10, ":__________:_: SHIELD:",0
.byte 0,11, ":ROOM 1 ",('+'|$80),": : 1: OFF",0
.byte 0,12, ": : : : 2: ON",0
.byte 0,13, ": : : 3: ON",0
.byte 0,14, ": : : :",0
.byte 0,15, ": : : P^: 1",0
.byte 0,16, ": : : :",0
.byte 0,17, ": _________:_:",0
.byte 0,18, ":/_________:/",0
.byte 255
accel_paramaters:
.byte $15,$6,' ',20 ; 21,4 = $615 Cursor starts at E
.byte $15,$6,' '|$80,1 ; Cusrsor off at E
.byte $96,$6,' ',100 ; 22,5 = $696 Down to .005 (pauses)
.byte $96,$6,' '|$80,1 ; off
.byte $18,$7,' ',20 ; 24,6 = $718 End of RK
.byte $18,$7,' '|$80,1 ; off
.byte $3E,$4,' ',100 ; 22,8 = $43E End of g+ (pauses)
.byte $3E,$4,' '|$80,1 ; off
.byte $3D,$4,' ',20 ; 21,8 = $43D erase +
.byte $3D,$4,'-'|$80,1 ; change to - (pauses)
.byte $3E,$4,' ',100 ; 22,8 = $43e change to - (pauses)
.byte $3E,$4,' '|$80,1 ; off
.byte $BD,$5,' ',100 ; 22,11= $5bd down to 1 (pauses)
.byte $BD,$5,' '|$80,1 ; off
.byte $3C,$6,' ',20 ; 21,12= $63c down to 2
.byte $3C,$6,' '|$80,1 ; off
.byte $BC,$6,' ',20 ; 21,13= $6bc down to 3
.byte $BC,$6,' '|$80,1 ; off
.byte $BC,$7,' ',20 ; 21,15= $7bc down to P (pause)
.byte $BC,$7,' '|$80,1 ; off
.byte $ff
; FLASH: RUN EXPERIMENT ? (pause)
run_experiment:
.byte 10,20,"RUN EXPERIMENT ?",0
run_blank:
.byte 10,20," ",0
;'R'|$80,'U'|$80,'N'|$80,' '|$80
; .byte 10,20,'R'|$80,'U'|$80,'N'|$80,' '|$80
; .byte 'E'|$80,'X'|$80,'P'|$80,'E'|$80,'R'|$80,'I'|$80
; .byte 'M'|$80,'E'|$80,'N'|$80,'T'|$80,' '|$80,'?'|$80,0
; --- Theoretical Study ---
; make this inverse?
theoretical_study:
.byte 7,20,"--- THEORETICAL STUDY ---",0
; - Phase 0:
; INJECTION of particles
; into synchrotron
phase0:
.byte 0,21,"- PHASE 0:",0
.byte 0,22,"INJECTION OF PARTICLES",0
.byte 0,23,"INTO SYNCHROTRON",0
.byte $ff
; - Phase 1:
; Particle ACCELERATION.
phase1:
.byte 0,21,"- PHASE 1:",0
.byte 0,22,"PARTICLE ACCELERATION.",0
.byte $ff
; - Phase 2:
; EJECTION of particles
; on the shield.
phase2:
.byte 0,21,"- PHASE 2:",0
.byte 0,22,"EJECTION OF PARTICLES",0
.byte 0,23,"ON THE SHIELD.",0
.byte $ff
; A N A L Y S I S
analysis:
.byte 8,22,"A N A L Y S I S",0
; - RESULT:
; Probability of creating:
; ANTIMATTER: 91.V %
; NEUTRINO 27: 0.04 %
; NEUTRINO 424: 18 %
result:
.byte 0,20,"- RESULT, PROBABILITY OF CREATING:",0
.byte 10,21,"ANTIMATTER: 91.V %",0
.byte 10,22,"NEUTRINO 27: 0.04 %",0
.byte 10,23,"NEUTRINO 424: 18 %",0
.byte $ff
; Practical verification Y/N ?"
practical_verification:
.byte 6,21,"PRACTICAL VERIFICATION Y/N ?",0
; THE EXPERIMENT WILL BEGIN IN 20 SECONDS
experiment:
.byte 0,20,"THE EXPERIMENT WILL BEGIN IN 20 SECONDS",0
.byte 29,20,"19",0
.byte 29,20,"18",0
.byte 29,20,"17",0
; Particle co-ordinates
particles:
.byte 21,23 ; 0
.byte 21,15 ; 1
.byte 22,7 ; 2
.byte 27,2 ; 3
.byte 32,6 ; 4
.byte 34,13 ; 5
.byte 31,26 ; 6
.byte 27,28 ; 7
shield_sequence:
.byte 30
.word collider_p200_rle
.byte 30
.word collider_p201_rle
.byte 30
.word collider_p202_rle
.byte 30
.word collider_p203_rle
.byte 30
.word collider_p200_rle
.byte 0
message0:
.byte 8,22,"SHIELD 9A.5F OK ",0
message1:
.byte 8,22,"FLUX % 5.0177 OK",0
message2:
.byte 8,22,"CDI VECTOR OK ",0
message3:
.byte 8,22,"%%%DDD OK ",0
message4:
.byte 8,22,"RACE-TRACK OK ",0
message_list:
.word message0
.word message1
.word message2
.word message3
.word message4
five:
.byte 29,20,"5 ",0
four:
.byte 29,20,"4 ",0
three:
.byte 29,20,"3 ",0
two:
.byte 29,20,"2 ",0
one:
.byte 29,20,"1 ",0
zero:
.byte 29,20,"0 ",0
times:
; note, the second zero is there because we get a TIME_COUNT
; of 6 even though it is printed then erased (but never displayed)
.word five,four,three,two,one,zero,zero
;=================================
;=================================
; Intro Segment 07 Data (Soda)
;=================================
;=================================
.include "intro_graphics/07_soda/intro_open_soda.inc"
.include "intro_graphics/07_soda/intro_drinking.inc"
; Soda sequence
soda_sequence:
.byte 1
.word soda01_rle
.byte 128+30 ; .word soda02_rle
.byte 128+15 ; .word soda03_rle
.byte 128+15 ; .word soda04_rle
.byte 128+15 ; .word soda05_rle
.byte 128+15 ; .word soda06_rle
.byte 128+15 ; .word soda07_rle
.byte 128+15 ; .word soda08_rle
.byte 128+15 ; .word soda09_rle
.byte 20
.word soda09_rle
.byte 0
drinking_sequence:
.byte 30
.word drinking02_rle
.byte 128+30 ; .word drinking03_rle
.byte 128+30 ; .word drinking04_rle
.byte 128+30 ; .word drinking05_rle
.byte 0

View File

@ -0,0 +1,228 @@
;=================================
;=================================
; Intro Segment 08 Data (Lightning)
;=================================
;=================================
.include "intro_graphics/08_lightning/lightning.inc"
.include "intro_graphics/01_building/intro_building_car.inc"
; Lightning sequence
lightning_sequence:
; 125 start
; 126, small central lightning 1,2,3,4
;
.byte 100
.word storm01_rle
.byte 7
.word storm02_rle
.byte 7
.word storm03_rle
.byte 7
.word storm04_rle
.byte 7
; 128.2 center glow in cloud 5,6,5
;
.word nothing_rle
.byte 100
.word storm05_rle
.byte 7
.word storm06_rle
.byte 7
.word storm05_rle
.byte 7
.word nothing_rle
.byte 40
; 128.7 inverse flash
;
.word flash_rle
.byte 7
.word nothing_rle
.byte 40
; 129.6 center left glow in cloud 8
;
.word storm08_rle
.byte 7
.word nothing_rle
.byte 40
; 130.1 glow in cloud, right 9
;
.word storm09_rle
.byte 7
.word nothing_rle
.byte 40
; 130.4 glow in cloud, right 10
;
.word storm10_rle
.byte 7
.word nothing_rle
.byte 80
; 131.7 small glow, center right 11,12
;
.word storm11_rle
.byte 7
.word storm12_rle
.byte 7
.word nothing_rle
.byte 80
; 133.5 lightning bolt right 13,14,15,16
;
.word storm13_rle
.byte 7
.word storm14_rle
.byte 7
.word storm15_rle
.byte 7
.word storm16_rle
.byte 7
.word nothing_rle
.byte 80
; 134.7 glow center left 8
;
.word storm08_rle
.byte 7
.word nothing_rle
.byte 40
; 135.2 small glow center 5,6,5
;
.word storm05_rle
.byte 7
.word storm06_rle
.byte 7
.word storm05_rle
.byte 7
.word nothing_rle
.byte 40
; 135.4 inverse flash
;
.word flash_rle
.byte 7
.word nothing_rle
.byte 40
; 135.8 another inverse flash
;
.word flash_rle
.byte 7
.word nothing_rle
.byte 40
; 135.5 glow right 9
;
.word storm09_rle
.byte 7
.word nothing_rle
.byte 40
; 136 small glow right 0
;
.word storm10_rle
.byte 7
.word nothing_rle
.byte 80
; 138.6 cloud glow 12,11,12
;
.word storm12_rle
.byte 7
.word storm11_rle
.byte 7
.word storm12_rle
.byte 7
.word nothing_rle
.byte 80
; 139.6 small bolt center 1,2,3,4
;
.word storm01_rle
.byte 7
.word storm02_rle
.byte 7
.word storm03_rle
.byte 7
.word storm04_rle
.byte 7
.word nothing_rle
.byte 80
; 141.4 right glow in cloud 10
;
.word storm10_rle
.byte 7
.word nothing_rle
.byte 80
; 143 glow in center 5,6,5
;
.word storm05_rle
.byte 7
.word storm06_rle
.byte 7
.word storm05_rle
.byte 7
.word nothing_rle
.byte 80
; 144.8 glow left 8
;
.word storm08_rle
.byte 7
.word nothing_rle
.byte 80
; 145.7 center glow cloud 11,12
;
.word storm11_rle
.byte 7
.word storm12_rle
.byte 7
.word nothing_rle
.byte 0
; .word nothing_rle
;==============
; split, as was > 256
bolt_sequence:
.byte 80
;=======================
; 147 bolt right
;=======================
; 13,14,15
.word storm13_rle
.byte 128+5 ; .word storm14_rle
.byte 128+5 ; .word storm15_rle
.byte 5
; screen goes white
; *all white
.word white_rle
.byte 8
; lightning animation
; * bolt1, 2,3,4,5,6,7
.word bolt1_rle
.byte 128+5 ; .word bolt2_rle
.byte 128+5 ; .word bolt3_rle
.byte 128+5 ; .word bolt4_rle
.byte 128+5 ; .word bolt5_rle
.byte 128+5 ; .word bolt6_rle
.byte 128+5 ; .word bolt7_rle
.byte 5
; * all white (a while)
.word white_rle
; * all black (a while)
.word 128+30,black_rle
.byte 30
; 148.3 big bolt behind car
; 29 .. 38, 40.. 42 (38 twice as long?)
.word storm29_rle
.byte 128+5 ; .word storm30_rle
.byte 128+5 ; .word storm31_rle
.byte 128+5 ; .word storm32_rle
.byte 128+5 ; .word storm33_rle
.byte 128+5 ; .word storm34_rle
.byte 128+5 ; .word storm35_rle
.byte 128+5 ; .word storm36_rle
.byte 128+5 ; .word storm37_rle
.byte 128+5 ; .word storm38_rle
.byte 128+5 ; .word storm40_rle
.byte 128+5 ; .word storm41_rle
.byte 128+5 ; .word storm42_rle
.byte 5
; by 150 faded out and on to tunnel
.word nothing_rle
.byte 0
; .word nothing_rle

View File

@ -0,0 +1,315 @@
;=================================
;=================================
; Intro Segment 09 Data (Tunnel)
;=================================
;=================================
; background graphics
.include "intro_graphics/09_tunnel/intro_tunnel1.inc"
.include "intro_graphics/09_tunnel/intro_tunnel2.inc"
.include "intro_graphics/08_lightning/nothing.inc"
.include "intro_graphics/08_lightning/whiteblack.inc"
;=======================
; Tunnel1 Sequence
;=======================
tunnel1_sequence:
.byte 10
.word nothing_rle
.byte 50
; red blob
.word tunnel1_01_rle
.byte 128+2 ; .word tunnel1_02_rle
.byte 128+2 ; .word tunnel1_03_rle
.byte 128+2 ; .word tunnel1_04_rle
.byte 128+2 ; .word tunnel1_05_rle
.byte 2
; lightning blob
.word nothing_rle
.byte 50
.word tunnel1_06_rle
.byte 128+2 ; .word tunnel1_07_rle
.byte 2
.word white_rle
.byte 2
.word tunnel1_08_rle
.byte 128+2 ; .word tunnel1_09_rle
.byte 128+2 ; .word tunnel1_10_rle
.byte 128+2 ; .word tunnel1_11_rle
.byte 128+2 ; .word tunnel1_12_rle
.byte 128+2 ; .word tunnel1_13_rle
.byte 128+2 ; .word tunnel1_14_rle
.byte 128+2 ; .word tunnel1_15_rle
.byte 128+2 ; .word tunnel1_16_rle
.byte 128+2 ; .word tunnel1_17_rle
.byte 128+2 ; .word tunnel1_18_rle
.byte 128+2 ; .word tunnel1_19_rle
.byte 2
.word nothing_rle
.byte 0
;=======================
; Tunnel2 Sequence
;=======================
tunnel2_sequence:
.byte 10
.word nothing_rle
.byte 50
; red blob
.word tunnel2_01_rle
.byte 128+2 ; .word tunnel2_02_rle
.byte 128+2 ; .word tunnel2_03_rle
.byte 128+2 ; .word tunnel2_04_rle
.byte 128+2 ; .word tunnel2_05_rle
.byte 128+2 ; .word tunnel2_06_rle
.byte 128+2 ; .word tunnel2_07_rle
.byte 128+2 ; .word tunnel2_08_rle
.byte 128+2 ; .word tunnel2_09_rle
.byte 2
.word nothing_rle
.byte 50
; lightning blob
.word tunnel2_10_rle
.byte 128+2 ; .word tunnel2_11_rle
.byte 128+2 ; .word tunnel2_12_rle
.byte 128+2 ; .word tunnel2_13_rle
.byte 128+2 ; .word tunnel2_14_rle
.byte 128+2 ; .word tunnel2_15_rle
.byte 128+2 ; .word tunnel2_16_rle
.byte 128+2 ; .word tunnel2_17_rle
.byte 2
.word nothing_rle
.byte 0
;=================================
;=================================
; Intro Segment 10 Data (Zappo)
;=================================
;=================================
.include "intro_graphics/10_gone/intro_zappo.inc"
.include "intro_graphics/10_gone/intro_gone.inc"
;=======================
; Zappo Sequence
;=======================
zappo_sequence:
.byte 50
.word white_rle
.byte 2
.word zappo01_rle ; B
.byte 128+2 ; .word zappo02_rle ; B
.byte 128+2 ; .word zappo03_rle ; A
.byte 128+2 ; .word zappo04_rle ; B
.byte 128+2 ; .word zappo05_rle ; B
.byte 255
.word zappo03_rle ; load A
.byte 2
.word zappo06_rle ; A
.byte 255
.word blue_zappo_rle ; load b
.byte 2
.word zappo07_rle ; B
.byte 2
.word zappo08_rle ; B
.byte 255
.word zappo03_rle ; load A
.byte 2
.word zappo09_rle ; A
.byte 255
.word blue_zappo_rle ; load b
.byte 2
.word zappo10_rle ; B
.byte 255
.word zappo03_rle ; load A
.byte 2
.word zappo11_rle ; A
.byte 255
.word blue_zappo_rle ; load b
.byte 2
.word zappo12_rle ; B
.byte 128+2 ; .word zappo13_rle ; B
.byte 128+2 ; .word zappo14_rle ; B
.byte 255
.word zappo03_rle ; load A
.byte 2
.word zappo15_rle ; A
.byte 255
.word blue_zappo_rle ; load b
.byte 2
.word zappo16_rle ; B
.byte 128+2 ; .word zappo17_rle ; B
.byte 2
.word white_rle
.byte 128+5 ; .word black_rle
.byte 5
.word white_rle
.byte 128+5 ; .word black_rle
; .byte 5
; .word white_rle
; .byte 1
; .word black_rle
; .byte 1
; .word white_rle
; .byte 1
; .word black_rle
; .byte 1
; .word white_rle
; .byte 1
; .word black_rle
.byte 0
.word nothing_rle
;=======================
; Gone Sequence
;=======================
gone_sequence:
.byte 50
.word white_rle
.byte 7
.word gone01_rle ; B
.byte 128+7 ; .word gone02_rle ; B
.byte 128+7 ; .word gone03_rle ; B
.byte 128+7 ; .word gone04_rle ; B
.byte 128+7 ; .word gone05_rle ; B
.byte 128+7 ; .word gone06_rle ; B
.byte 128+7 ; .word gone07_rle ; B
.byte 128+7 ; .word gone08_rle ; B
.byte 128+7 ; .word gone09_rle ; LB
.byte 128+7 ; .word gone10_rle ; CY
.byte 255
.word gone09_rle ; LB into $c00
.byte 7
.word gone11_rle ; LB
.byte 255
.word gone_rle ; B back into $c00
.byte 7
.word gone02_rle ; B (12 is dupe of 2)
.byte 7
.word gone13_rle ; B
.byte 255
.word gone09_rle ; LB into $c00
.byte 7
.word gone14_rle ; LB
.byte 255
.word gone_rle ; B back into $c00 + plain
.byte 7
.word nothing_rle
.byte 7
.word gone16_rle ; B
.byte 7
.word nothing_rle ; B (plain?)
.byte 7
.word gone18_rle ; B
.byte 128+7 ; .word gone19_rle ; B
.byte 128+7 ; .word gone20_rle ; B
.byte 128+7 ; .word gone21_rle ; B
.byte 7
.word nothing_rle ; B (plain?)
.byte 7
.word gone23_rle ; B
.byte 128+7 ; .word gone24_rle ; B
.byte 128+7 ; .word gone25_rle ; B
.byte 128+7 ; .word gone26_rle ; B
.byte 128+7 ; .word gone27_rle ; B
.byte 255
.word gone09_rle ; LB into $c00
.byte 7
.word gone28_rle ; LB
; .byte 255
; .word gone10_rle ; CY into $c00
.byte 7
.word gone10_rle ; CY (same as 10)
.byte 255
.word gone09_rle ; LB into $c00
.byte 7
.word gone28_rle ; LB (30 same as 28)
.byte 255
.word gone_rle ; B back into $c00 + plain
.byte 7
.word gone31_rle ; B
.byte 255
.word gone09_rle ; LB into $c00
.byte 7
.word gone32_rle ; LB
.byte 255
.word gone_rle ; B back into $c00 + plain
.byte 7
.word nothing_rle ; B (plain?)
.byte 7
.word gone34_rle ; B
.byte 128+7 ; .word gone35_rle ; B
.byte 128+7 ; .word gone36_rle ; B
.byte 128+7 ; .word gone37_rle ; B
.byte 128+7 ; .word gone38_rle ; B
.byte 255
.word gone09_rle ; LB into $c00
.byte 7
.word gone39_rle ; LB
.byte 255
.word gone10_rle ; CY into $c00
.byte 7
.word gone40_rle ; CY
.byte 7
.word gone10_rle ; CY (same as 10)
.byte 255
.word gone09_rle ; LB into $c00
.byte 7
.word gone42_rle ; LB
.byte 255
.word gone_rle ; B back into $c00 + plain
.byte 7
.word gone43_rle ; B
.byte 7
.word nothing_rle
.byte 0

711
another_myst/loader.s Normal file
View File

@ -0,0 +1,711 @@
; Loader for OOTW
; Used to be standalone, now loaded as part of TITLE
; But still loads at $1400
; the TITLE program sets $05 with which thing to load
; this part of the program stays resident, so when a level ends
; it changes $05 (WHICH_LOAD) and this code loads the proper executable
nibtbl = $300 ; nothing uses the bottom 128 bytes of $300, do they?
bit2tbl = $380 ; bit2tbl: .res 86 ; = nibtbl+128
filbuf = $3D6 ; filbuf: .res 4 ; = bit2tbl+86
; read any file slot 6 version
; based on FASTLD6 and RTS copyright (c) Peter Ferrie 2011-2013,2018
; modified to assembled with ca65 -- vmw
; added code to patch it to run from current disk slot -- vmw
; WHICH_LOAD = $05 ; thing to load
adrlo = $26 ; constant from boot prom
adrhi = $27 ; constant from boot prom
tmpsec = $3c ; constant from boot prom
reqsec = $3d ; constant from boot prom
sizelo = $44
sizehi = $45
secsize = $46
namlo = $f8
namhi = $f9
; TEMPY = $fa
step = $fd ; state for stepper motor
tmptrk = $fe ; temporary copy of current track
phase = $ff ; current phase for /seek
; OUTL = $fe ; for picking filename
; OUTH = $ff
dirbuf = $c00
; note, don't put this immediately below
; the value being read as destaddr-4
; is temporarily overwritten during read
; process
FILENAME = $280
;===================================================
;===================================================
; START / INIT
;===================================================
;===================================================
loader_start:
jsr init ; unhook DOS, init nibble table
;===================================================
;===================================================
; SETUP THE FILENAME
;===================================================
;===================================================
which_load_loop:
ldx WHICH_LOAD
beq load_intro
jmp load_ending
lda #<ootw_filename
sta OUTL
lda #>ootw_filename
sta OUTH
ldy #6
cpx #10
bcc load_less_than_10 ; blt
txa
sec
sbc #10
tax
lda #'1' ; assume it's 10-15
sta (OUTL),Y
iny
load_less_than_10:
txa
clc
adc #48
sta (OUTL),Y
iny
lda #0
sta (OUTL),Y ; be sure NUL terminated
; might be issue if load >10 level
; then back to lower? that possible?
jmp opendir_filename
load_intro:
lda #<intro_filename
sta OUTL
lda #>intro_filename
sta OUTH
bne opendir_filename ; branch always
load_ending:
lda #<ending_filename
sta OUTL
lda #>ending_filename
sta OUTH
; fallthrough
;===================================================
;===================================================
; SET UP DOS3.3 FILENAME
;===================================================
;===================================================
opendir_filename:
; clear out the filename with $A0 (space)
lda #<FILENAME
sta namlo
lda #>FILENAME
sta namhi
ldy #29
wipe_filename_loop:
lda #$A0
sta (namlo),Y
dey
bpl wipe_filename_loop
ldy #0
copy_filename_loop:
lda (OUTL),Y
beq copy_filename_done
ora #$80
sta (namlo),Y
iny
bne copy_filename_loop
copy_filename_done:
jsr opendir ; open and read entire file into memory
jsr $1700 ; jump to common entry point
; hope they updated the WHICH_LOAD value
jmp which_load_loop
; filename to open is 30-character Apple text, must be padded with space ($A0)
;filename:
; .byte $A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0
; .byte $A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0
; .byte $A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0
intro_filename:
.byte "INTRO",0
ending_filename:
.byte "ANOTHERMIST",0
ootw_filename:
.byte "OOTW_C",0,0,0
;===================================================
;===================================================
; INIT (build nibble table)
;===================================================
;===================================================
;unhook DOS and build nibble table
init:
; patch to use current drive
; locate input paramater list
jsr $3E3
; result is in A:Y
sta $FF
sty $FE
ldy #1
lda ($FE),y
; list+1 should have slot<<8
ora #$80 ; add in $80
; c0e0
sta mlsmc06+1
; c0e8
clc
adc #8
sta mlsmc02+1
sta mlsmc07+1
; c0e9
clc
adc #1
sta mlsmc01+1
; c0ec
clc
adc #3
sta mlsmc03+1
sta mlsmc04+1
sta mlsmc05+1
jsr $fe93 ; clear COUT
jsr $fe89 ; clear KEYIN
;========================
; Create nibble table
; Note: the table starts 16 bytes in, and is sparse
; so it doesn't entirely look like the DOS33 table at
ldy #0
ldx #3
L1: stx $3c ; store tempx (3?)
txa ; a=x (a=3)
asl ; a*=2 (a=6)
bit $3c ; a&tempx, set N/V (a=6)
beq L3 ; if 0, skip to L3
ora $3c ; a|=tempx (a=7)
eor #$ff ; a=~a (a=f8)
and #$7e ; a&=0x7e 0111 1110 (a=78)
L2: bcs L3 ; this set way back at asl??
lsr ; a>>1 a=3c c=0
; a=1e c=0
; a=0f c=0
; a=07 c=1
bne L2 ; if a!=0 goto l2
tya ; if a==0, a=y
sta nibtbl, x ; write out to table
iny ; increment y
L3: inx ; increment x x=4, a=0f
bpl L1 ; loop while high bit not set
rts
;===================================================
;===================================================
; file not found
;===================================================
;===================================================
file_not_found:
mlsmc07:lda $c0e8 ; turn off drive motor?
jsr TEXT
jsr HOME
ldy #0
lda #<disk_string
sta OUTL
lda #>disk_string
sta OUTH
quick_print:
lda (OUTL),Y
beq quick_print_done
jsr COUT1
iny
jmp quick_print
quick_print_done:
; rts
; jsr quick_print
fnf_keypress:
lda KEYPRESS
bpl fnf_keypress
bit KEYRESET
jmp which_load_loop
disk_string:
.byte "INSERT OTHER DISK, PRESS RETURN",0
;===================================================
;===================================================
; OPENDIR: actually load the file
;===================================================
;===================================================
; turn on drive and read volume table of contents
opendir:
mlsmc01:lda $c0e9 ; turn slot#6 drive on
ldx #0
stx adrlo ; zero out adrlo
stx secsize ; zero out secsize
lda #$11 ; a=$11 (VTOC)
jsr readdirsec
firstent:
lda dirbuf+1
; lock if entry not found
entry_not_found:
beq file_not_found
; read directory sector
ldx dirbuf+2
jsr seekread1
ldy #7 ;number of directory entries in a sector
ldx #$2b ;offset of filename in directory entry
nextent:
tya
pha ; was **phy**
txa
pha ; was **phx**
ldy #$1d
; match name backwards (slower but smaller)
L4:
lda (namlo), y
cmp dirbuf, x
beq foundname
pla
; move to next directory in this block, if possible
clc
adc #$23
tax
pla
tay ; was **ply**
dey
bne nextent
beq firstent ; was **bra**
foundname:
dex
dey
bpl L4
pla
tay ; was **ply**
pla
; read track/sector list
lda dirbuf-32, y
ldx dirbuf-31, y
jsr seekread1
; read load offset and length info only, initially
lda #<filbuf
sta adrlo
lda #4
sta secsize
lda dirbuf+12
ldx dirbuf+13
ldy #>filbuf
jsr seekread
; reduce load offset by 4, to account for offset and length
sec
lda filbuf
sbc #4
sta adrlo
lda filbuf+1
sbc #0
sta adrhi
; save on stack bytes that will be overwritten by extra read
ldy #3
L5:
lda (adrlo), y
pha
dey
bpl L5
lda adrhi
pha
lda adrlo
pha
; increase load size by 4, to account for offst and length
lda filbuf+2
adc #3
sta sizelo
sta secsize
lda filbuf+3
adc #0
sta sizehi
beq readfirst
lda #0 ; was **stz secsize**
sta secsize
readfirst:
ldy #$0c
; read a file sector
readnext:
tya
pha
lda dirbuf, y ; A = track
ldx dirbuf+1, y ; x = sector
jsr seekread1
pla
tay
; if low count is non-zero then we are done
; (can happen only for partial last block)
lda secsize
bne readdone
; continue if more than $100 bytes left
dec sizehi
bne L6
; set read size to min(length, $100)
lda sizelo
beq readdone
sta secsize
L6:
inc adrhi
iny
iny
bne readnext
; save current address for after t/s read
lda adrhi
pha
lda adrlo
pha
lda #0
sta adrlo ; was **stz adrlo**
; read next track/sector sector
lda dirbuf+1
ldx dirbuf+2
jsr readdirsec
clc
; restore current address
readdone:
pla
sta adrlo ; code originally had this backwards
pla
sta adrhi
bcc readfirst
mlsmc02:lda $c0e8
; restore from stack bytes that were overwritten by extra read
ldx #3
ldy #0
L7:
pla
sta (adrlo), y
iny
dex
bpl L7
rts
;======================
; readdirsec
;======================
; a = track?
; x = sector?
readdirsec:
ldy #>dirbuf
seekread:
sty adrhi
seekread1:
sta phase
lda sectbl, x
sta reqsec
jsr readadr
; if track does not match, then seek
cpx phase
beq checksec
jsr seek
;=========================================
; re merge in with qkumba's recent changes
; to fix seek problem?
;=========================================
; [re-]read sector
re_read_addr:
jsr readadr
checksec:
cmp reqsec
bne re_read_addr
;=========================
; read sector data
;=========================
readdata:
jsr readd5aa
eor #$ad ; zero A if match
bne re_read_addr
L12:
mlsmc03:ldx $c0ec ; read until valid data (high bit set)
bpl L12
eor nibtbl-$80, x
sta bit2tbl-$aa, y
iny
bne L12
L13:
mlsmc04:ldx $c0ec ; read until valid data (high bit set)
bpl L13
eor nibtbl-$80, x
sta (adrlo), y ; the real address
iny
cpy secsize
bne L13
ldy #0
L14:
ldx #$a9
L15:
inx
beq L14
lda (adrlo), y
lsr bit2tbl-$aa, x
rol
lsr bit2tbl-$aa, x
rol
sta (adrlo), y
iny
cpy secsize
bne L15
rts
; no tricks here, just the regular stuff
;=======================
; readaddr -- read the address field
;=======================
; Find address field, put track in cutrk, sector in tmpsec
readadr:
jsr readd5aa
cmp #$96
bne readadr
ldy #3 ; three?
; first read volume/volume
; then track/track
; then sector/sector?
adr_read_two_bytes:
tax
jsr readnib
rol
sta tmpsec
jsr readnib
and tmpsec
dey
bne adr_read_two_bytes
rts
;========================
; make sure we see the $D5 $AA pattern
readd5aa:
L16:
jsr readnib
L17:
cmp #$d5
bne L16
jsr readnib
cmp #$aa
bne L17
tay ; we need Y=#$AA later
readnib:
mlsmc05:lda $c0ec ; read until valid (high bit set)
bpl readnib
seekret:
rts
;=====================
; SEEK
;=====================
; current track in X?
; desired track in phase
seek:
ldy #0
sty step
asl phase ; multiply by two
txa ; current track?
asl ; mul by two
copy_cur:
tax
sta tmptrk
sec
sbc phase
beq L22
bcs L18
eor #$ff
inx
bcc L19
L18:
sbc #1
dex
L19:
cmp step
bcc L20
lda step
L20:
cmp #8
bcs L21
tay
sec
L21:
txa
pha
ldx step1, y
L22:
php
bne L24
L23:
clc
lda tmptrk
ldx step2, y
L24:
stx tmpsec
and #3
rol
tax
lsr
mlsmc06:lda $c0e0, x
L25:
ldx #$12
L26:
dex
bpl L26
dec tmpsec
bne L25
bcs L23
plp
beq seekret
pla
inc step
bne copy_cur
step1: .byte $01, $30, $28, $24, $20, $1e, $1d, $1c
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
; From $BA96 of DOS33
;nibtbl: .res 128 ; = *
; .byte $00,$01,$98,$99,$02,$03,$9C,$04 ; $BA96 ; 00
; .byte $05,$06,$A0,$A1,$A2,$A4,$A4,$A5 ; $BA9E ; 08
; .byte $07,$08,$A8,$A9,$AA,$09,$0A,$0B ; $BAA6 ; 10
; .byte $0C,$0D,$B0,$B1,$0E,$0F,$10,$11 ; $BAAE ; 18
; .byte $12,$13,$B8,$14,$15,$16,$17,$18 ; $BAB6 ; 20
; .byte $19,$1A,$C0,$C1,$C2,$C3,$C4,$C5 ; $BABE ; 28
; .byte $C6,$C7,$C8,$C9,$CA,$1B,$CC,$1C ; $BAC6 ; 30
; .byte $1D,$1E,$D0,$D1,$D2,$1E,$D4,$D5 ; $BACE ; 38
; .byte $20,$21,$D8,$22,$23,$24,$25,$26 ; $BAD6 ; 40
; .byte $27,$28,$E0,$E1,$E2,$E3,$E4,$29 ; $BADE ; 48
; .byte $2A,$2B,$E8,$2C,$2D,$2E,$2F,$30 ; $BAE6 ; 50
; .byte $31,$32,$F0,$F1,$33,$34,$35,$36 ; $BAEE ; 58
; .byte $37,$38,$F8,$39,$3A,$3B,$3C,$3D ; $BAF6 ; 60
; .byte $3E,$3F,$13,$00,$01,$02,$01,$00 ; $BAFE ; 68
; .byte $00,$00,$00,$00,$00,$00,$00,$00
; .byte $00,$00,$00,$00,$00,$00,$00,$00
;bit2tbl: .res 86 ; = nibtbl+128
;filbuf: .res 4 ; = bit2tbl+86
;dataend = filbuf+4
loader_end:
.assert (<loader_end - <loader_start)>3, error, "loader too big"

207
another_myst/lz4_decode.s Normal file
View File

@ -0,0 +1,207 @@
; LZ4 data decompressor for Apple II
; NOTE: this version is optimized for loading LORES graphics
; on even page boundaries (usually $C00)
; Don't use it for generic purposes!
; Code originally by Peter Ferrie (qkumba) (peter.ferrie@gmail.com)
; "LZ4 unpacker in 143 bytes (6502 version) (2013)"
; http://pferrie.host22.com/misc/appleii.htm
; For LZ4 reference see
; https://github.com/lz4/lz4/wiki/lz4_Frame_format.md
; We expect src in LZ4_SRC
; Incoming Accumulator is page to write to
; Size is in first 2 bytes pointed to by LZ4_SRC
; LZ4 data should have 11 byte header stripped off beginning
; and 8 byte checksum stripped off the end
;LZ4_SRC EQU $00 ; 25:10 (size=7c)
;LZ4_DST EQU $02 ; 0c:00
;LZ4_END EQU $04 ; 25:8c
;COUNT EQU $06
;DELTA EQU $08
;======================
; LZ4 decode
;======================
; input buffer in LZ4_SRC
; A is destination page
; size in first two bytes
lz4_decode:
sta LZ4_DST+1 ; set to page we want
lda #0
sta LZ4_DST
ldy #0
; calculate LZ4_END based on start and total size in
; first two bytes
clc
lda (LZ4_SRC),Y ; size (low)
adc LZ4_SRC
sta LZ4_END
iny
lda (LZ4_SRC),Y ; size (high)
adc LZ4_SRC+1
sta LZ4_END+1
; skip past size
clc
lda LZ4_SRC
adc #2
sta LZ4_SRC
lda LZ4_SRC+1
adc #0
sta LZ4_SRC+1
unpmain:
ldy #0 ; used to index, always zero
parsetoken:
jsr getsrc ; get next token
pha ; save for later (need bottom 4 bits)
lsr ; number of literals in top 4 bits
lsr ; so shift into place
lsr
lsr
beq copymatches ; if zero, then no literals
; jump ahead and copy
jsr buildcount ; add up all the literal sizes
; result is in ram[count+1]-1:A
tax ; now in ram[count+1]-1:X
jsr docopy ; copy the literals
lda LZ4_SRC ; 16-bit compare
cmp LZ4_END ; to see if we have reached the end
lda LZ4_SRC+1
sbc LZ4_END+1
bcs done
copymatches:
jsr getsrc ; get 16-bit delta value
sta DELTA
jsr getsrc
sta DELTA+1
pla ; restore token
and #$0f ; get bottom 4 bits
; match count. 0 means 4
; 15 means 19+, must be calculated
jsr buildcount ; add up count bits, in ram[count+1]-:A
clc
adc #4 ; adjust count by 4 (minmatch)
tax ; now in ramp[count+1]-1:X
beq copy_no_adjust ; BUGFIX, don't increment if
; exactly a multiple of 0x100
bcc copy_no_adjust
inc COUNT+1 ; increment if we overflowed
copy_no_adjust:
lda LZ4_SRC+1 ; save src on stack
pha
lda LZ4_SRC
pha
sec ; subtract delta
lda LZ4_DST ; from destination, make new src
sbc DELTA
sta LZ4_SRC
lda LZ4_DST+1
sbc DELTA+1
sta LZ4_SRC+1
jsr docopy ; do the copy
pla ; restore the src
sta LZ4_SRC
pla
sta LZ4_SRC+1
jmp parsetoken ; back to parsing tokens
done:
pla
rts
;=========
; getsrc
;=========
; gets byte from src into A, increments pointer
getsrc:
lda (LZ4_SRC), Y ; get a byte from src
inc LZ4_SRC ; increment pointer
bne done_getsrc ; update 16-bit pointer
inc LZ4_SRC+1 ; on 8-bit overflow
done_getsrc:
rts
;============
; buildcount
;============
buildcount:
ldx #1 ; high count starts at 1
stx COUNT+1 ; (loops at zero?)
cmp #$0f ; if LITERAL_COUNT < 15, we are done
bne done_buildcount
buildcount_loop:
sta COUNT ; save LITERAL_COUNT (15)
jsr getsrc ; get the next byte
tax ; put in X
clc
adc COUNT ; add new byte to old value
bcc bc_8bit_oflow ; if overflow, increment high byte
inc COUNT+1
bc_8bit_oflow:
inx ; check if read value was 255
beq buildcount_loop ; if it was, keep looping and adding
done_buildcount:
rts
;============
; getput
;============
; gets a byte, then puts the byte
getput:
jsr getsrc
; fallthrough to putdst
;=============
; putdst
;=============
; store A into destination
putdst:
sta (LZ4_DST), Y ; store A into destination
inc LZ4_DST ; increment 16-bit pointer
bne putdst_end ; if overflow, increment top byte
inc LZ4_DST+1
putdst_end:
rts
;=============================
; docopy
;=============================
; copies ram[count+1]-1:X bytes
; from src to dst
docopy:
docopy_loop:
jsr getput ; get/put byte
dex ; decrement count
bne docopy_loop ; if not zero, loop
dec COUNT+1 ; if zero, decrement high byte
bne docopy_loop ; if not zero, loop
rts

View File

@ -3,10 +3,14 @@ include ../../Makefile.inc
PNG2RLE = ../../gr-utils/png2rle
PNG2LZ4 = ../../gr-utils/png2lz4
all: ootw_c16_end.inc
all: ootw_c16_end.inc logo.inc
#####
logo.inc: $(PNG2RLE) \
logo.png
$(PNG2RLE) asm logo.png logo_rle > logo.inc
ootw_c16_end.inc: $(PNG2RLE) \
wing_bg.png \
left_unfurl1.png left_unfurl2.png \

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -291,17 +291,16 @@ rooftop2_rle: .byte $28 ; ysize=48
.byte $00, $A0,$1F,$AA, $00, $11, $A0,$01,$AA, $A3,$00, $A0,$01,$AA
.byte $99, $00, $A0,$1F,$AA, $A0,$01,$A0, $11, $A0,$01,$AA, $A3,$00
.byte $A0,$01,$AA, $99, $00, $A0,$20,$AA, $11, $A4,$00, $A0,$01,$AA
.byte $99, $A9,$AA, $5A,$5A, $AD,$AA, $8A,$8A, $A4,$AA, $0A
.byte $00,$00, $10, $A0,$01,$A0, $00,$00, $A0,$01,$A0, $A0,$01,$AA, $99
.byte $A0,$14,$AA, $0A, $00,$00, $40, $BB, $88, $A4,$AA
.byte $0A, $A0,$01,$A0, $A0,$01,$AA, $01, $1A, $00,$00, $A0,$01,$AA
.byte $9A, $99, $A0,$14,$AA, $88,$88, $A0,$01,$A0, $44, $AA,$AA
.byte $A0,$01,$A0, $A0,$01,$AA, $00, $A0,$01,$AA, $A0,$01,$A0, $AB,$AA, $FA,$FA
.byte $7A, $FA,$FA, $A5,$AA, $55, $88, $A0,$02,$AA, $B4
.byte $AA,$AA, $00,$00, $0A, $A3,$AA, $A7,$DD, $FD, $FF
.byte $7F, $F7, $FF, $F2, $A5,$DD, $00, $70
.byte $48, $4B, $00,$00, $BB, $99, $A0,$15,$DD, $D4,$D4
.byte $4F, $D4,$D4, $A0,$1C,$DD
.byte $99, $A0,$18,$AA, $8A,$8A, $A4,$AA, $0A, $00,$00, $10
.byte $A0,$01,$A0, $00,$00, $A0,$01,$A0, $A0,$01,$AA, $99, $A0,$14,$AA, $0A
.byte $00,$00, $40, $BB, $88, $A4,$AA, $0A, $A0,$01,$A0
.byte $A0,$01,$AA, $01, $1A, $00,$00, $A0,$01,$AA, $9A, $99
.byte $A0,$14,$AA, $88,$88, $A0,$01,$A0, $44, $AA,$AA, $A0,$01,$A0, $A0,$01,$AA
.byte $00, $A0,$01,$AA, $A0,$01,$A0, $AB,$AA, $FA,$FA, $7A, $FA,$FA
.byte $A6,$AA, $88, $A0,$02,$AA, $B4, $AA,$AA, $00,$00, $0A
.byte $A3,$AA, $A7,$DD, $FD, $FF, $7F, $F7, $FF
.byte $F2, $A5,$DD, $00, $70, $48, $4B, $00,$00
.byte $BB, $99, $A0,$15,$DD, $D4,$D4, $4F, $D4,$D4, $A0,$1C,$DD
.byte $A1
; cycles=859
rooftop3_rle: .byte $28 ; ysize=48

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

62
another_myst/title.s Normal file
View File

@ -0,0 +1,62 @@
; Title Screen / Menu for OOTW
.include "zp.inc"
.include "hardware.inc"
title:
bit SET_GR
bit LORES
bit TEXTGR
bit PAGE0
lda #0
sta DRAW_PAGE
lda #>(logo_rle)
sta GBASH
lda #<(logo_rle)
sta GBASL
lda #$04 ; load image off-screen $c00
jsr load_rle_gr
lda #<title_text
sta OUTL
lda #>title_text
sta OUTH
jsr move_and_print_list
title_loop:
lda #0
sta WHICH_LOAD
wait_for_keypress:
lda KEYPRESS
bpl wait_for_keypress
bit KEYRESET
ready_to_load:
jmp $1400 ; LOADER starts here
.include "text_print.s"
.include "gr_offsets.s"
.include "gr_unrle.s"
.include "ootw_graphics/logo.inc"
title_text:
.byte 13,20, "______",0
.byte 0,21,"BY DEATER, A \/\/\/ SOFTWARE PRODUCTION",0
.byte 26,22,",",0
.byte 4,23,"APOLOGIES TO CYAN AND ERIC CHAHI",0
.byte 255
.align $100
.byte 1
.align $100
.byte 1
.align $100
.byte 1
.align $100
.include "loader.s"