driven: more fine tuning

This commit is contained in:
Vince Weaver 2024-11-13 01:33:36 -05:00
parent 65225bd144
commit 9562798536
14 changed files with 530 additions and 56 deletions

View File

@ -12,7 +12,6 @@ driven.dsk: QBOOT QLOAD \
MUSIC \
music.inc qload.inc \
./part00_intro/INTRO \
./part01_dni/DNI \
./part05_atrus/ATRUS \
./part07_maglev/MOVIE_MAGLEV_RIDE \
./part10_graphics/GRAPHICS \
@ -25,7 +24,6 @@ driven.dsk: QBOOT QLOAD \
$(DOS33_RAW) driven.dsk 2 0 MUSIC 0 0
$(DOS33_RAW) driven.dsk 5 0 ./part00_intro/INTRO 0 0
$(DOS33_RAW) driven.dsk 8 0 ./part20_credits/CREDITS 0 0
$(DOS33_RAW) driven.dsk 11 0 ./part01_dni/DNI 0 0
$(DOS33_RAW) driven.dsk 12 0 ./part05_atrus/ATRUS 0 0
$(DOS33_RAW) driven.dsk 15 0 ./part10_graphics/GRAPHICS 0 0
$(DOS33_RAW) driven.dsk 21 0 ./part07_maglev/MOVIE_MAGLEV_RIDE 0 0
@ -65,8 +63,7 @@ qboot_sector.o: qboot_sector.s qboot_stage2.s
QLOAD: qload.o
ld65 -o QLOAD qload.o -C $(LINKER_SCRIPTS)/apple2_1200.inc
qload.o: zp.inc hardware.inc common_defines.inc qload.s \
music.inc \
qload.o: zp.inc hardware.inc common_defines.inc music.inc qload.s \
gr_offsets.s \
wait.s wait_a_bit.s \
lc_detect.s gr_fast_clear.s \
@ -111,6 +108,7 @@ qload.inc: generate_common QLOAD
./generate_common -a 0x1200 -s gr_offsets qload.lst >> qload.inc
./generate_common -a 0x1200 -s inc_base5 qload.lst >> qload.inc
./generate_common -a 0x1200 -s draw_full_dni_number qload.lst >> qload.inc
./generate_common -a 0x1200 -s gr_flip_page qload.lst >> qload.inc
####

View File

@ -25,6 +25,9 @@ static void find_address(char *symbol_name, int routine_offset) {
exit(-1);
}
/* UGH: bug here if partial substring match */
/* e.g. gr_page_flip and hgr_page_flip */
result=strstr(string,temp_name);
if (result!=NULL) {
string[6]=0;

View File

@ -0,0 +1,21 @@
;==========
; gr flip page
;==========
gr_flip_page:
lda DRAW_PAGE
beq gr_draw_page2
gr_draw_page1:
bit PAGE2
lda #0
beq gr_done_flip
gr_draw_page2:
bit PAGE1
lda #$4
gr_done_flip:
sta DRAW_PAGE
rts

View File

@ -4,12 +4,15 @@
.include "hardware.inc"
.include "zp.inc"
;.include "qload.inc"
;.include "common_defines.inc"
memcpy_routines:
.include "aux_memcopy.s"
;dni_routines:
; .include "part01_dni/dni_plasma.s"
music_lib:
PT3_ENABLE_APPLE_IIC = 1
@ -26,6 +29,7 @@ PT3_ENABLE_APPLE_IIC = 1
.include "pt3_lib_mockingboard_detect.s"
; only load one music track, self modify to make other
.align $100

View File

@ -3,7 +3,7 @@ include ../../../Makefile.inc
LINKER_SCRIPTS = ../../../linker_scripts/
ZX02 = ~/research/6502_compression/zx02.git/build/zx02
all: INTRO INTRO.ZX02
all: INTRO
####
@ -19,6 +19,7 @@ intro.o: intro.s \
../zx02_optim.s \
../zp.inc ../hardware.inc ../qload.inc ../common_defines.inc \
erase.s \
../part01_dni/dni_plasma.s \
graphics/logo_frame01.hgr.zx02 \
graphics/logo_frame46.hgr.zx02 \
graphics/d_sprites.inc

View File

@ -59,7 +59,7 @@ efo_y2_smc:
erase_frame_done:
sty ERASE_OFFSET
lda #5
lda #4
jsr wait_ticks
; jsr wait_until_keypress

View File

@ -23,6 +23,12 @@ desire_start:
; Load graphics
;===================
load_loop:
; jsr wait_until_keypress
; dni
; jsr dni_plasma
; already in hires when we come in?
@ -244,11 +250,12 @@ logo_transit3_inner_loop:
; wait a bit
lda #3
jsr wait_seconds
; wait for intro music to stop
wait_till_right_pattern:
lda #4
jsr wait_for_pattern
bcc wait_till_right_pattern
; done
logo_done:
@ -277,6 +284,8 @@ masks_reverse:
.include "graphics/d_sprites.inc"
.include "../part01_dni/dni_plasma.s"
;.include "../hgr_sprite.s"
d_sprite_h:

View File

@ -5,7 +5,7 @@ PNG_TO_40x96 = ../../utils/gr-utils/png_to_40x96
LINKERSCRIPTS = ../../../linker_scripts/
all: DNI
all:
###

View File

@ -22,25 +22,26 @@ Table2 = $74D0 ; 40 bytes
;======================================
; start of code
; do some dni counting with plasma
;======================================
plasma_mask:
dni_plasma:
bit SET_GR
bit LORES ; set lo-res
bit FULLGR
; bit SET_GR
; bit LORES ; set lo-res
; bit FULLGR
;======================
; init variables
;======================
lda #0
sta DRAW_PAGE
sta NUMBER_HIGH
sta NUMBER_LOW
sta WHICH_TRACK
; lda #0
; sta DRAW_PAGE
; sta NUMBER_HIGH
; sta NUMBER_LOW
; sta WHICH_TRACK
.if 0
;======================
; draw plain number
;======================
@ -67,7 +68,7 @@ draw_plain_number_loop:
jsr inc_base5
jsr flip_page
jsr gr_page_flip
lda #200
jsr wait
@ -78,7 +79,7 @@ draw_plain_number_loop:
bne draw_plain_number_loop ; bra
.endif
next_scene:
@ -222,8 +223,6 @@ display_line_loop:
lda gr_offsets+1,Y
sta GBASH
; jsr GBASCALC
; set up pointer for mask
ldy WHICH_TRACK ; CURRENT_EFFECT
@ -389,7 +388,7 @@ no_inc_effect1:
done_effect:
jsr flip_page
jsr gr_page_flip
inc COMPT1
beq zoop
@ -404,10 +403,15 @@ zoop:
zoop2:
wait_till_right_pattern:
lda #2
jsr wait_for_pattern
bcc wait_till_right_pattern
; beq do_plasma ; bra
jmp do_plasma ; bra
done_dni_plasma:
rts
.align $100
@ -438,8 +442,7 @@ sin3=sin1+$200
;.include "../gr_offsets.s"
;.include "inc_base5.s"
;.include "../wait.s"
.include "page_flip.s"
;.include "../gr_page_flip.s"
;======================

View File

@ -0,0 +1,447 @@
; Plasma D'ni Numbers
; by Vince `deater` Weaver / Dsr
; originally based on Plasmagoria (GPL3) code by French Touch
; Memory:
; Plasma uses $2000-$23ff
; Uses $2400-$27FF (1k) for color lookup table
; Uses 80 bytes for Tables
lores_colors_fine=$2400
; was in page0, we don't really have room
Table1 = $28A0 ; 40 bytes
Table2 = $28D0 ; 40 bytes
;======================================
; do some dni counting with plasma
;======================================
dni_plasma:
next_scene:
lda #$0
sta DRAW_PAGE
bit PAGE1
; clears $20-$24 to white for some reason?
ldx #$20 ; address
lda #$FF ; white
jsr clear_1k
; ============================================================================
; init lores colors (inline)
; ============================================================================
lda #<lores_colors_fine
sta INL
lda #>lores_colors_fine
sta INH
multiple_init_lores_colors:
init_lores_colors:
ldx #0
ldy #0
init_lores_colors_loop:
lcl_smc1:
lda lores_colors_lookup,X
sta (INL),Y
iny
sta (INL),Y
iny
sta (INL),Y
iny
sta (INL),Y
iny
beq done_init_lores_colors
inx
txa
and #$f
tax
jmp init_lores_colors_loop
done_init_lores_colors:
lda lcl_smc1+1
clc
adc #$10
sta lcl_smc1+1
inc INH
lda INH
cmp #$84
bne multiple_init_lores_colors
;====================================
; do plasma
;====================================
do_plasma:
; init
BP3:
;=============================
; adjust color palette
; lda WHICH_TRACK
; clc
; adc #$80
; sta display_lookup_smc+2
; ============================================================================
; Precalculate some values (inlined)
; ============================================================================
precalc:
lda PARAM1 ; self modify various parts
sta pc_off1+1
lda PARAM2
sta pc_off2+1
lda PARAM3
sta pc_off3+1
lda PARAM4
sta pc_off4+1
; Table1(X) = sin1(PARAM1+X)+sin2(PARAM1+X)
; Table2(X) = sin3(PARAM3+X)+sin1(PARAM4+X)
ldx #$28 ; 40
pc_b1:
pc_off1:
lda sin1
pc_off2:
adc sin2
sta Table1,X
pc_off3:
lda sin3
pc_off4:
adc sin1
sta Table2,X
inc pc_off1+1
inc pc_off2+1
inc pc_off3+1
inc pc_off4+1
dex
bpl pc_b1
inc PARAM1
inc PARAM1
dec PARAM2
inc PARAM3
dec PARAM4
; ============================================================================
; Display Routines
; ============================================================================
display_normal:
ldx #23 ; lines 0-23 lignes 0-23
display_line_loop:
txa
asl
tay
lda gr_offsets,Y
sta GBASL
lda gr_offsets+1,Y
sta GBASH
; set up pointer for mask
ldy WHICH_TRACK ; CURRENT_EFFECT
lda GBASL
sta INL
lda GBASH
clc
adc #$1c ; load from $2000-$2400
sta INH
lda GBASH ; adjust to proper output page
clc
adc DRAW_PAGE
sta GBASH
ldy #39 ; col 0-39
lda Table2,X ; setup base sine value for row
sta display_row_sin_smc+1
display_col_loop:
lda Table1,Y ; load in column sine value
display_row_sin_smc:
adc #00 ; add in row value
; MASKING happens HERE
and (INL),Y
sta display_lookup_smc+1 ; patch in low byte of lookup
display_lookup_smc:
lda lores_colors_fine ; attention: must be aligned
sta (GBASL),Y
dey
bpl display_col_loop
dex
bpl display_line_loop
; ============================================================================
lda #4
sta XPOS
lda #5
sta YPOS
lda NUMBER_HIGH
and #$3
clc
adc #$80
sta display_lookup_smc+2
lda NUMBER_HIGH
and #$f
cmp #0
beq effect3
cmp #1
beq effect4
cmp #2
beq effect0
cmp #3
beq effect1
cmp #4
beq effect2
effect2:
ldx #$20
lda #$00 ; black
sta SIN_COUNT
jsr clear_1k
lda DRAW_PAGE
pha
lda #$1c ; draw DNI number to $1c+$4
sta DRAW_PAGE
jsr draw_full_dni_number
pla
sta DRAW_PAGE
ldx #$20 ; invert it
jsr invert_1k
inc FRAMEL
lda FRAMEL
and #$3
bne no_inc_effect2
jsr inc_base5
no_inc_effect2:
jmp done_effect
effect0:
; full mask, so full plasma
ldx #$20
lda #$FF ; white
jsr clear_1k
; overlay with number
jsr draw_full_dni_number
; increment each 8th frame
inc FRAMEL
lda FRAMEL
and #$3
bne no_inc_effect0
jsr inc_base5
no_inc_effect0:
jmp done_effect
effect3:
ldx SIN_COUNT
lda sine_table,X
sta YPOS
effect4:
effect1:
ldx #$20
lda #$0 ; black
jsr clear_1k
lda DRAW_PAGE
pha
lda #$1c
sta DRAW_PAGE
jsr draw_full_dni_number
pla
sta DRAW_PAGE
inc SIN_COUNT
lda SIN_COUNT
cmp #25
bne sin_ok
lda #0
sta SIN_COUNT
sin_ok:
inc FRAMEL
lda FRAMEL
and #$3
bne no_inc_effect1
jsr inc_base5
no_inc_effect1:
done_effect:
jsr gr_flip_page
lda #2
jsr wait_for_pattern
bcs done_dni_plasma
inc COMPT1
beq zoop
; bne BP3
jmp BP3
zoop:
dec COMPT2
beq zoop2
; bne BP3
jmp BP3
zoop2:
jmp do_plasma ; bra
done_dni_plasma:
rts
.align $100
lores_colors_lookup:
; dark
.byte $00,$88,$55,$99,$ff,$bb,$33,$22,$66,$77,$44,$cc,$ee,$dd,$99,$11
; pink
.byte $00,$11,$33,$BB,$FF,$BB,$33,$11,$00,$11,$33,$BB,$FF,$BB,$33,$11
; blue
.byte $00,$22,$66,$77,$FF,$77,$66,$22,$00,$22,$66,$77,$FF,$77,$66,$22
; green
.byte $00,$44,$CC,$DD,$FF,$DD,$CC,$44,$00,$44,$CC,$DD,$FF,$DD,$CC,$44
;.include "make_tables.s"
.align $100
sin1:
.incbin "tables"
sin2=sin1+$100
sin3=sin1+$200
;.include "print_dni_numbers.s"
;.include "number_sprites.inc"
;.include "../gr_offsets.s"
;.include "inc_base5.s"
;.include "../wait.s"
;.include "../gr_page_flip.s"
;======================
;
;======================
; X = page
; A = value
clear_1k:
stx OUTH
ldx #0
stx OUTL
ldx #4
; lda #0
ldy #0
inner_loop:
sta (OUTL),Y
iny
bne inner_loop
inc OUTH
dex
bne inner_loop
rts
;======================
;
;======================
; X = page
invert_1k:
stx OUTH
ldx #0
stx OUTL
ldx #4
ldy #0
invert_inner_loop:
lda (OUTL),Y
eor #$FF
sta (OUTL),Y
iny
bne invert_inner_loop
inc OUTH
dex
bne invert_inner_loop
rts
sine_table:
.byte 5,6,7,8,9
.byte 10,10,10,10,9
.byte 8,7,6,5,4
.byte 3,2,1,0,0
.byte 0,1,2,3,4

View File

@ -1,21 +0,0 @@
;==========
; flip page
;==========
flip_page:
lda DRAW_PAGE
beq draw_page2
draw_page1:
bit PAGE2
lda #0
beq done_flip
draw_page2:
bit PAGE1
lda #$4
done_flip:
sta DRAW_PAGE
rts

View File

@ -29,6 +29,11 @@ atrus_opener:
bit TEXTGR
bit PAGE1
; lda #$A0
; sta clear_all_color+1
jsr clear_bottoms
;=================================
; atrus greetings
;=================================

View File

@ -220,11 +220,12 @@ PT3_ENABLE_APPLE_IIC = 1
.include "part01_dni/print_dni_numbers.s"
.include "part01_dni/number_sprites.inc"
.include "part01_dni/inc_base5.s"
.include "wait_keypress.s"
.include "zx02_optim.s"
.include "gs_interrupt.s"
.include "pt3_lib_mockingboard_patch.s"
.include "hardware_detect.s"
.include "wait_keypress.s"
.include "zx02_optim.s"
.include "gs_interrupt.s"
.include "pt3_lib_mockingboard_patch.s"
.include "hardware_detect.s"
.include "gr_page_flip.s"
.include "start.s"

View File

@ -332,6 +332,9 @@ forever:
;=========================
; print next dni number
print_next_dni:
lda #0
sta clear_all_color+1
jsr clear_all
ldy #$4