Compare commits

...

3 Commits

Author SHA1 Message Date
Vince Weaver
722db32577 keen: work on hooking up story 2024-05-07 01:24:37 -04:00
Vince Weaver
c1fa8afc05 o2024: add another program 2024-05-07 01:11:44 -04:00
Vince Weaver
88a2e1b23e o2024: update the build 2024-05-07 00:50:26 -04:00
11 changed files with 657 additions and 18 deletions

View File

@ -0,0 +1,66 @@
include ../../../Makefile.inc
DOS33 = ../../../utils/dos33fs-utils/dos33
TOKENIZE = ../../../utils/asoft_basic-utils/tokenize_asoft
EMPTYDISK = ../../../empty_disk/empty.dsk
LINKERSCRIPTS = ../../../linker_scripts/
all: bubble_blob.dsk
bubble_blob.dsk: HELLO BUBBLE_BLOB BUBBLE_BLOB_QUIET
cp $(EMPTYDISK) bubble_blob.dsk
$(DOS33) -y bubble_blob.dsk SAVE A HELLO
$(DOS33) -y bubble_blob.dsk BSAVE -a 0xc00 BUBBLE_BLOB
$(DOS33) -y bubble_blob.dsk BSAVE -a 0xc00 BUBBLE_BLOB_QUIET
###
submit: bubble_blob.zip bubble_blob_small.zip
bubble_blob.zip: BUBBLE_BLOB bubble_blob.s file_id.diz bubble_blob.dsk
mkdir -p outline2024_bubble_blob
cp BUBBLE_BLOB ./outline2024_bubble_blob
cp bubble_blob.s ./outline2024_bubble_blob
cp file_id.diz ./outline2024_bubble_blob
cp bubble_blob.dsk ./outline2024_bubble_blob
cp bubble_blob_720p.mp4 ./outline2024_bubble_blob
cp bubble_blob_screen.png ./outline2024_bubble_blob
zip -r bubble_blob.zip outline2024_bubble_blob
###
bubble_blob_small.zip: BUBBLE_BLOB bubble_blob.s file_id.diz bubble_blob.dsk
mkdir -p outline2024_bubble_blob_small
cp BUBBLE_BLOB ./outline2024_bubble_blob_small
cp bubble_blob.s ./outline2024_bubble_blob_small
cp file_id.diz ./outline2024_bubble_blob_small
cp bubble_blob.dsk ./outline2024_bubble_blob_small
zip -r bubble_blob_small.zip outline2024_bubble_blob_small
###
HELLO: hello.bas
$(TOKENIZE) < hello.bas > HELLO
###
BUBBLE_BLOB: bubble_blob.o
ld65 -o BUBBLE_BLOB bubble_blob.o -C $(LINKERSCRIPTS)/apple2_c00.inc
bubble_blob.o: bubble_blob.s
ca65 -o bubble_blob.o bubble_blob.s -l bubble_blob.lst
###
BUBBLE_BLOB_QUIET: bubble_blob_quiet.o
ld65 -o BUBBLE_BLOB_QUIET bubble_blob_quiet.o -C $(LINKERSCRIPTS)/apple2_c00.inc
bubble_blob_quiet.o: bubble_blob.s
ca65 -o bubble_blob_quiet.o bubble_blob.s -DQUIET=1 -l bubble_blob_quiet.lst
####
clean:
rm -f *~ *.o *.lst HELLO BUBBLE_BLOB BUBBLE_BLOB_QUIET *.zip

View File

@ -0,0 +1,378 @@
; bubble universe -- Apple II Hires
; even more size optimized version
; by Vince `deater` Weaver
; this version based on fast c64 code by serato_fig
; as posted to the sizecoding discord
; based on his TIC-80 variant
; originally was working off the BASIC code posted on the pouet forum
; original effect by yuruyrau on twitter
; for this code I always is 1
; 217 bytes -- original bubble_rom code
; 202 bytes -- remove unnecessary code if I==1
; 231 bytes -- add palette swap every 256 frames
; soft-switches
KEYPRESS = $C000
KEYRESET = $C010
SPEAKER = $C030
PAGE1 = $C054
PAGE2 = $C055
; ROM routines
BKGNDZ = $F3F2 ; clear current page to 0
BKGND0 = $F3F4 ; clear current page to A
HGR2 = $F3D8 ; set hires page2 and clear $4000-$5fff
HGR = $F3E2 ; set hires page1 and clear $2000-$3fff
HPLOT0 = $F457 ; plot at (Y,X), (A)
HCOLOR1 = $F6F0 ; set HGR_COLOR to value in X
; zero page
I = $D0
J = $D1
T = $D7
U = $D8
V = $D9
IT = $DA
IS = $DB
FRAMEH = $DC
HGR_PAGE = $E6
OUTL = $FC
OUTH = $FD
;sines = sines_base-$1A ; overlaps some code
;sines2 = sines+$100 ; duplicate so we can index cosine into it
;cosines = sines+$c0
sines = $6000
fifty_nines = sines+58
sines2 = sines+$100
cosines = sines+$c0
bubble_rom:
;=============================
; reconstruct sine base table
;=============================
; first part linear (26 bytes)
; have to adjust once for doubled $42
; middle part copied from sine_data (32 bytes)
; end part all $59 (7 bytes)
; offset counts down from 31 to 0
; sines-6,Y = linear
; sines+26+offset = sines_data+offset
; sines+58+offset = $59
ldy #$1F ; offset
ldx #$48 ; want to write $48 downto $30
; with $42 doubled
looper:
txa
sta sines-6,Y ;
lda sines_data,Y
sta sines+26,Y
lda #$59 ; also write $59 off the top
sta fifty_nines,Y
cpy #$19 ; we could save more bytes if we didn't
beq skipper ; bother trying to be exact
dex
skipper:
dey
bpl looper
;==========================
; make sine/cosine tables
;==========================
; floor(s*sin((x-96)*PI*2/256.0)+48.5);
;===================================
; final_sine[i]=quarter_sine[i]; // 0..64
; final_sine[128-i]=quarter_sine[i]; // 64..128
; final_sine[128+i]=0x60-quarter_sine[i]; // 128..192
; final_sine[256-i]=0x60-quarter_sine[i]; // 192..256
setup_sine_table:
ldx #64
ldy #64
setup_sine_loop:
lda sines,X
; sta sines,X
sta sines,Y
lda #$60
sec
sbc sines,X
sta sines+128,X
sta sines+128,Y
iny
dex
bpl setup_sine_loop
;=======================
; init variables
;=======================
; wipe all of zero page but $FF
; in theory we only need to clear/copy $00..$C0
; but not sure how to use to our advantage
inx ; X=0
ldy #0 ; Y=0
init_loop:
; sta a:$D0,X ; force 16-bit so doesn't wrap
; because I guess it's bad to wipe zero page?
; maybe it isn't?
sty $D0,X ; clear zero page
lda sines,X ; duplicate sine table for cosine use
sta sines2,X
dex
bne init_loop
;=======================
; init graphics
jsr HGR2
ldx #7
jsr HCOLOR1
;=========================
;=========================
; main loop
;=========================
;=========================
next_frame:
; reset I*T
lda T
sta IT
; reset I*S
lda #0 ; Y should be 0 here?
sta IS
;i_smc:
; lda #1 ; 40
; sta I
;i_loop:
j_smc:
lda #$80
sta J
j_loop:
; where S=41 (approximately 1/6.28)
; calc: a=i*s+v;
; calc: b=i+t+u;
; u=sines[a]+sines[b];
; v=cosines[a]+cosines[b];
clc
lda IS
adc V
tay
clc
lda IT
adc U
tax
clc ; 2
lda cosines,Y ; 4+
adc cosines,X ; 4+
sta V
; max value for both $60 so carry not set
lda sines,Y ; 4+
adc sines,X ; 4+
sta U ; 3
;===========================================================
; HPLOT U+44,V+96
; U is centered at 96, to get to center of 280 screen add 44
; U already in A
adc #44 ; 2
tax ; 2
; calculate Ypos
lda V
; HPLOT0 -- plot at (Y,X), (A)
ldy #0
jsr HPLOT0
;================================
; play some sound based on ypos
.ifndef QUIET
lda V
ror
bcc skip
bit SPEAKER
skip:
.endif
dec J
bne j_loop
done_j:
; clc
; lda IS
; adc #41 ; 1/6.28 = 0.16 = 0 0 1 0 1 0 0 0 = 0x28
; sta IS
; dec I
; bne i_loop
done_i:
inc T
bne done_frame
inc FRAMEH
lda FRAMEH
ror
bcc frame_odd
frame_even:
ldx #0
jsr HCOLOR1
lda #$ff
bne done_frame_related
frame_odd:
ldx #7
jsr HCOLOR1
lda #$0
done_frame_related:
sta bg_color_smc+1
done_frame:
;==================================
; speed up the first half of frame
;==================================
lda T
bmi urgh
tpos:
lda #$20
bne done_urgh
urgh:
lda #$80
done_urgh:
sta j_smc+1
flip_pages:
; flip pages
; if $20 (draw PAGE1) draw PAGE2, SHOW page1
; if $40 (draw PAGE2) draw PAGE1, SHOW page2
lda HGR_PAGE
eor #$60
sta HGR_PAGE
cmp #$40
bne flip2
flip1:
sta PAGE1
beq done_flip
flip2:
sta PAGE2
done_flip:
;=======================
; clear screen
; note can be ~8192 cycles faster at expense of few bytes
; if we use self-modifying code instead of indirect-Y
; lda HGR_PAGE
sta OUTH
ldy #$0
clear_loop_fix:
bg_color_smc:
lda #$00 ; set color to black
; assume OUTL starts at 0 from clearing earlier
clear_loop:
sta (OUTL),Y
iny
bne clear_loop
inc OUTH
lda OUTH
and #$1f
bne clear_loop_fix
; beq next_frame ; bra
jmp next_frame
; need 26 bytes of destroyable area?
; alternately, need code to copy 26 bytes
; 26 bytes to gen
; 32 bytes of base
; 7 59s
; .byte $30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$3A,$3B,$3C,$3D,$3E,$3F
; .byte $40,$41,$42
;old_sines_base:
; .byte $42,$43,$44,$45,$46,$47,$48,
sines_data:
;sines_base:
.byte $48,$49,$4A,$4B,$4C,$4C
.byte $4D,$4E,$4E,$4F,$50,$50,$51,$52,$52,$53,$53,$54,$54,$55,$55,$55
.byte $56,$56,$57,$57,$57,$58,$58,$58,$58,$58
;fifty_nines:
; .byte $59,$59,$59,$59,$59,$59
; .byte $59
; floor(s*cos((x-96)*PI*2/256.0)+48.5);

View File

@ -0,0 +1,25 @@
Bubble Blob
-
256-byte Intro for Apple II, Outline 2024
by Deater / dSr
Bubble universe has two paramaters, I and J.
If you set I to 1 you get a much more restrained
set of shapes.
Apple II 'hi-res' 280x192 6 color mode
Core routine based on serato_fig's
C64 version
Using ROM routines for plot (which are slow).
ROM clear-screen routing way too slow so
spending some bytes on a moderately fast
clear screen.
I was hoping to get this down to 128 bytes but
can't seem to get it below 200 bytes, so added
in some extra effects.
There is sound but admittedly it
isn't the best.

View File

@ -0,0 +1,10 @@
5 HOME
10 PRINT " BUBBLE_BLOB -- 256B FOR OUTLINE 2024"
15 PRINT " BY DEATER / DSR"
20 PRINT CHR$(4)"CATALOG"
22 PRINT:PRINT "PRESS Q TO RUN VERSION W/O SOUND"
25 PRINT:PRINT "ANY OTHER KEY TO 'BRUN BUBBLE_BLOB'"
30 GET A$
32 IF A$="Q" OR A$="q" THEN PRINT:PRINT CHR$(4)"BRUN BUBBLE_BLOB_QUIET"
35 PRINT
40 PRINT CHR$(4)"BRUN BUBBLE_BLOB"

View File

@ -1,16 +1,17 @@
include ../../Makefile.inc
include ../../../Makefile.inc
DOS33 = ../../utils/dos33fs-utils/dos33
TOKENIZE = ../../utils/asoft_basic-utils/tokenize_asoft
EMPTYDISK = ../../empty_disk/empty.dsk
LINKERSCRIPTS = ../../linker_scripts/
DOS33 = ../../../utils/dos33fs-utils/dos33
TOKENIZE = ../../../utils/asoft_basic-utils/tokenize_asoft
EMPTYDISK = ../../../empty_disk/empty.dsk
LINKERSCRIPTS = ../../../linker_scripts/
all: cosmic_fish.dsk
cosmic_fish.dsk: HELLO COSMIC_FISH
cosmic_fish.dsk: HELLO COSMIC_FISH COSMIC_FISH_QUIET
cp $(EMPTYDISK) cosmic_fish.dsk
$(DOS33) -y cosmic_fish.dsk SAVE A HELLO
$(DOS33) -y cosmic_fish.dsk BSAVE -a 0x2000 COSMIC_FISH
$(DOS33) -y cosmic_fish.dsk BSAVE -a 0x2000 COSMIC_FISH_QUIET
###
@ -50,7 +51,16 @@ COSMIC_FISH: cosmic_fish.o
cosmic_fish.o: cosmic_fish.s
ca65 -o cosmic_fish.o cosmic_fish.s -l cosmic_fish.lst
###
COSMIC_FISH_QUIET: cosmic_fish_quiet.o
ld65 -o COSMIC_FISH_QUIET cosmic_fish_quiet.o -C $(LINKERSCRIPTS)/apple2_2000.inc
cosmic_fish_quiet.o: cosmic_fish.s
ca65 -o cosmic_fish_quiet.o cosmic_fish.s -DQUIET=1 -l cosmic_fish_quiet.lst
####
clean:
rm -f *~ *.o *.lst HELLO COSMIC_FISH *.zip
rm -f *~ *.o *.lst HELLO COSMIC_FISH COSMIC_FISH_QUIET *.zip

View File

@ -311,8 +311,9 @@ vsmc:
cmp #48
bcs no_plot
.ifndef QUIET
bit SPEAKER ; click speaker
.endif
jsr PLOT ; PLOT AT Y,A

View File

@ -0,0 +1,10 @@
5 HOME
10 PRINT " COSMIC_FISH -- 256B FOR OUTLINE 2024"
15 PRINT " BY DEATER / DSR"
20 PRINT CHR$(4)"CATALOG"
22 PRINT:PRINT "PRESS Q TO RUN VERSION W/O SOUND"
25 PRINT:PRINT "ANY OTHER KEY TO 'BRUN COSMIC_FISH'"
30 GET A$
32 IF A$="Q" OR A$="q" THEN PRINT:PRINT CHR$(4)"BRUN COSMIC_FISH_QUIET"
35 PRINT
40 PRINT CHR$(4)"BRUN COSMIC_FISH"

View File

@ -1,8 +0,0 @@
5 HOME
10 PRINT " COSMIC_FISH -- 256 BYTES FOR OUTLINE 2024"
15 PRINT " BY DEATER / DSR"
20 PRINT CHR$(4)"CATALOG"
25 PRINT:PRINT "PRESS ANY KEY TO 'BRUN COSMIC_FISH'"
30 GET A$
35 PRINT
40 PRINT CHR$(4)"BRUN COSMIC_FISH"

View File

@ -11,7 +11,7 @@ EMPTY_DISK = ../../empty_disk/empty.dsk
all: keen1_lores.dsk
keen1_lores.dsk: HELLO LOADER TITLE ENGINE MARS \
keen1_lores.dsk: HELLO LOADER TITLE STORY ENGINE MARS \
LEVEL1 LEVEL2 LEVEL3 LEVEL4 \
LEVEL5 LEVEL6 LEVEL7 LEVEL8 \
LEVEL9 LEVEL10 LEVEL11 LEVEL12 \
@ -20,6 +20,7 @@ keen1_lores.dsk: HELLO LOADER TITLE ENGINE MARS \
$(DOS33) -y keen1_lores.dsk SAVE A HELLO
$(DOS33) -y keen1_lores.dsk BSAVE -a 0x1000 LOADER
$(DOS33) -y keen1_lores.dsk BSAVE -a 0x4000 TITLE
$(DOS33) -y keen1_lores.dsk BSAVE -a 0x4000 STORY
$(DOS33) -y keen1_lores.dsk BSAVE -a 0x4000 ENGINE
$(DOS33) -y keen1_lores.dsk BSAVE -a 0x4000 MARS
$(DOS33) -y keen1_lores.dsk BSAVE -a 0x6000 LEVEL1
@ -64,6 +65,18 @@ title.o: title.s zp.inc hardware.inc \
####
STORY: story.o
ld65 -o STORY story.o -C ../../linker_scripts/apple2_4000.inc
story.o: story.s zp.inc hardware.inc \
zx02_optim.s \
graphics/keen1_story.hgr.zx02 \
story/story_data.zx02
ca65 -o story.o story.s -l story.lst
####
MARS: mars.o
ld65 -o MARS mars.o -C ../../linker_scripts/apple2_4000.inc
@ -252,7 +265,9 @@ maps/level1_map.lzsa:
####
clean:
rm -f *~ *.o *.lst HELLO LOADER TITLE ENGINE MARS LEVEL1 LEVEL2
rm -f *~ *.o *.lst HELLO LOADER TITLE ENGINE MARS STORY \
LEVEL1 LEVEL2 LEVEL3 LEVEL4 LEVEL5 LEVEL6 LEVEL7 LEVEL8 \
LEVEL9 LEVEL10 LEVEL11 LEVEL12 LEVEL13 LEVEL14 LEVEL15 LEVEL16
cd graphics && make clean
cd maps && make clean
# cd title && make clean

132
games/keen/story.s Normal file
View File

@ -0,0 +1,132 @@
; Keen1 Story
; by deater (Vince Weaver) <vince@deater.net>
; Zero Page
.include "zp.inc"
.include "hardware.inc"
.include "common_defines.inc"
story_data = $7000
keen_story_start:
;===================
; init screen
;===================
bit KEYRESET
bit SET_GR
bit PAGE1
bit HIRES
bit FULLGR
;===================
; Load story data
;===================
lda #<compressed_story_data
sta ZX0_src
lda #>compressed_story_data
sta ZX0_src+1
lda #>story_data ; decompress to story data location
jsr full_decomp
;===================
; Load hires graphics
;===================
load_background:
lda #<story_bg
sta ZX0_src
lda #>story_bg
sta ZX0_src+1
lda #$20 ; decompress to hgr page1
jsr full_decomp
wait_until_keypress:
lda KEYPRESS
bpl wait_until_keypress
bit KEYRESET
lda #LOAD_TITLE
sta WHICH_LOAD
rts
;==========================
; includes
;==========================
.include "gr_pageflip.s"
.include "gr_copy.s"
; .include "wait_a_bit.s"
.include "gr_offsets.s"
.include "zx02_optim.s"
.include "text_help.s"
.include "gr_fast_clear.s"
.include "text_print.s"
; .include "lc_detect.s"
story_bg:
.incbin "graphics/keen1_story.hgr.zx02"
compressed_story_data:
.incbin "story/story_data.zx02"
;====================================
; wait for keypress or a few seconds
;====================================
wait_a_bit:
bit KEYRESET
tax
keyloop:
lda #200 ; delay a bit
jsr WAIT
lda KEYPRESS
bmi done_keyloop
; bmi keypress_exit
dex
bne keyloop
done_keyloop:
bit KEYRESET
cmp #'H'|$80
bne really_done_keyloop
bit SET_TEXT
jsr print_help
bit SET_GR
bit PAGE1
ldx #100
jmp keyloop
really_done_keyloop:
rts