zero_wing: more nonsense

This commit is contained in:
Vince Weaver 2023-01-02 02:22:26 -05:00
parent 8483cc9d95
commit 6f534c297a
18 changed files with 2664 additions and 11 deletions

View File

@ -21,18 +21,19 @@ HELLO: hello.bas
$(TOKENIZE) < hello.bas > HELLO
#submit: apple_desire512.zip
submit: apple2_desire.zip
#apple_desire512.zip: APPLE_DESIRE apple_desire.s file_id.diz apple_desire_512.dsk
# mkdir -p lovebyte2021_apple_desire_512
# cp APPLE_DESIRE ./lovebyte2021_apple_desire_512
# cp *.s ./lovebyte2021_apple_desire_512
# cp file_id.diz ./lovebyte2021_apple_desire_512
# cp apple_desire_512.dsk ./lovebyte2021_apple_desire_512
# cp apple_desire_512.woz ./lovebyte2021_apple_desire_512
# cp apple_desire_720p.mp4 ./lovebyte2021_apple_desire_512
# cp desire2.png ./lovebyte2021_apple_desire_512
# zip -r apple_desire512.zip lovebyte2021_apple_desire_512
apple2_desire.zip: APPLE_DESIRE apple_desire.dsk
mkdir -p demosplash2022_apple2_desire
mkdir -p demosplash2022_apple2_desire/src
cp APPLE_DESIRE ./demosplash2022_apple2_desire
cp *.s ./demosplash2022_apple2_desire/src
cp *.inc ./demosplash2022_apple2_desire/src
cp file_id.diz ./demosplash2022_apple2_desire
cp apple_desire.dsk ./demosplash2022_apple2_desire
cp apple2_desire.mkv ./demosplash2022_apple2_desire
cp a2_desire_screen.png ./demosplash2022_apple2_desire
zip -r apple2_desire.zip demosplash2022_apple2_desire
####

View File

@ -0,0 +1,12 @@
Apple2 Desire
-
1k Apple II demo for Demosplash 2022
it's actually hard to fit a Mockingboard track this small
also messing around with shape tables as per usual
by Deater / dSr
music by mA2E
Note: assumes Mockingboard in Slot#4.
Music only plays on left speaker.

View File

@ -0,0 +1,31 @@
include ../../../Makefile.inc
DOS33 = ../../../utils/dos33fs-utils/dos33
TOKENIZE = ../../../utils/asoft_basic-utils/tokenize_asoft
LINKER_SCRIPTS = ../../../linker_scripts
EMPTY_DISK = ../../../empty_disk
all: budge3d.dsk
budge3d.dsk: HELLO SHIP_CUBE
cp $(EMPTY_DISK)/empty.dsk budge3d.dsk
$(DOS33) -y budge3d.dsk SAVE A HELLO
$(DOS33) -y budge3d.dsk BSAVE -a 0x300 SHIP_CUBE
###
HELLO: hello.bas
$(TOKENIZE) < hello.bas > HELLO
####
SHIP_CUBE: ship_cube.o
ld65 -o SHIP_CUBE ship_cube.o -C $(LINKER_SCRIPTS)/apple2_300.inc
ship_cube.o: ship_cube.s
ca65 -o ship_cube.o ship_cube.s -l ship_cube.lst
####
clean:
rm -f *~ *.o *.lst HELLO SHIP_CUBE

View File

@ -0,0 +1,2 @@
5 HOME
10 PRINT CHR$(4);"CATALOG"

File diff suppressed because it is too large Load Diff

33
music/zero_wing/Makefile Normal file
View File

@ -0,0 +1,33 @@
include ../../Makefile.inc
DOS33 = ../../utils/dos33fs-utils/dos33
EMPTY_DISK = ../../empty_disk/empty.dsk
TOKENIZE = ../../utils/asoft_basic-utils/tokenize_asoft
all: zw.dsk
zw.dsk: HELLO ZW
cp $(EMPTY_DISK) zw.dsk
$(DOS33) -y zw.dsk SAVE A HELLO
$(DOS33) -y zw.dsk BSAVE -a 0x6000 ZW
####
ZW: zw.o
ld65 -o ZW zw.o -C ../../linker_scripts/apple2_6000.inc
zw.o: zw.s zx02_optim.s \
text_print.s \
zp.inc hardware.inc
ca65 -o zw.o zw.s -l zw.lst
####
HELLO: hello.bas
$(TOKENIZE) < hello.bas > HELLO
###
clean:
rm -f *~ *.o *.lst HELLO ZW

View File

@ -0,0 +1,5 @@
gr_offsets:
.word $400,$480,$500,$580,$600,$680,$700,$780
.word $428,$4a8,$528,$5a8,$628,$6a8,$728,$7a8
.word $450,$4d0,$550,$5d0,$650,$6d0,$750,$7d0

View File

@ -0,0 +1,37 @@
include ../../../Makefile.inc
ZX02 = ~/research/6502_compression/zx02.git/build/zx02
PNG_TO_HGR = ../../../utils/hgr-utils/png2hgr
all: cats.hgr.zx02 captain.hgr.zx02 operator.hgr.zx02
####
cats.hgr.zx02: cats.hgr
$(ZX02) cats.hgr cats.hgr.zx02
cats.hgr: cats.png
$(PNG_TO_HGR) cats.png > cats.hgr
####
captain.hgr.zx02: captain.hgr
$(ZX02) captain.hgr captain.hgr.zx02
captain.hgr: captain.png
$(PNG_TO_HGR) captain.png > captain.hgr
####
operator.hgr.zx02: operator.hgr
$(ZX02) operator.hgr operator.hgr.zx02
operator.hgr: operator.png
$(PNG_TO_HGR) operator.png > operator.hgr
####
clean:
rm -f *~

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -0,0 +1,87 @@
;; HARDWARE LOCATIONS
KEYPRESS = $C000
KEYRESET = $C010
;; SOFT SWITCHES
CLR80COL = $C000 ; PAGE0/PAGE1 normal
SET80COL = $C001 ; PAGE0/PAGE1 switches PAGE0 in Aux instead
EIGHTYCOLOFF = $C00C
EIGHTYCOLON = $C00D
SPEAKER = $C030
SET_GR = $C050
SET_TEXT = $C051
FULLGR = $C052
TEXTGR = $C053
PAGE0 = $C054
PAGE1 = $C055
LORES = $C056 ; Enable LORES graphics
HIRES = $C057 ; Enable HIRES graphics
AN3 = $C05E ; Annunciator 3
PADDLE_BUTTON0 = $C061
PADDL0 = $C064
PTRIG = $C070
;; BASIC ROUTINES
NORMAL = $F273
;; MONITOR ROUTINES
HLINE = $F819 ;; HLINE Y,$2C at A
VLINE = $F828 ;; VLINE A,$2D at Y
CLRSCR = $F832 ;; Clear low-res screen
CLRTOP = $F836 ;; clear only top of low-res screen
SETCOL = $F864 ;; COLOR=A
TEXT = $FB36
TABV = $FB5B ;; VTAB to A
BASCALC = $FBC1 ;;
VTAB = $FC22 ;; VTAB to CV
HOME = $FC58 ;; Clear the text screen
WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us
SETINV = $FE80 ;; INVERSE
SETNORM = $FE84 ;; NORMAL
COUT = $FDED ;; output A to screen
COUT1 = $FDF0 ;; output A to screen
HGR2 = $F3D8
HGR = $F3E2
COLOR_BLACK = 0
COLOR_RED = 1
COLOR_DARKBLUE = 2
COLOR_PURPLE = 3
COLOR_DARKGREEN = 4
COLOR_GREY = 5
COLOR_MEDIUMBLUE = 6
COLOR_LIGHTBLUE = 7
COLOR_BROWN = 8
COLOR_ORANGE = 9
COLOR_GREY2 = 10
COLOR_PINK = 11
COLOR_LIGHTGREEN = 12
COLOR_YELLOW = 13
COLOR_AQUA = 14
COLOR_WHITE = 15
COLOR_BOTH_BLACK = $00
COLOR_BOTH_RED = $11
COLOR_BOTH_DARKBLUE = $22
COLOR_BOTH_DARKGREEN = $44
COLOR_BOTH_GREY = $55
COLOR_BOTH_MEDIUMBLUE = $66
COLOR_BOTH_LIGHTBLUE = $77
COLOR_BOTH_BROWN = $88
COLOR_BOTH_ORANGE = $99
COLOR_BOTH_PINK = $BB
COLOR_BOTH_LIGHTGREEN = $CC
COLOR_BOTH_YELLOW = $DD
COLOR_BOTH_AQUA = $EE
COLOR_BOTH_WHITE = $FF

View File

@ -0,0 +1,2 @@
5 HOME
105 PRINT CHR$ (4)"BRUN ZW"

View File

@ -0,0 +1,63 @@
;================================
; move_and_print
;================================
; get X,Y from OUTL/OUTH
; then print following string to that address
; stop at NUL
; convert to APPLE ASCII (or with 0x80)
; leave OUTL/OUTH pointing to next string
move_and_print:
ldy #0
lda (OUTL),Y
sta CH
iny
lda (OUTL),Y
asl
tay
lda gr_offsets,Y ; lookup low-res memory address
clc
adc CH ; add in xpos
sta BASL ; store out low byte of addy
lda gr_offsets+1,Y ; look up high byte
adc DRAW_PAGE ;
sta BASH ; and store it out
; BASH:BASL now points at right place
clc
lda OUTL
adc #2
sta OUTL
lda OUTH
adc #0
sta OUTH
;================================
; print_string
;================================
print_string:
ldy #0
print_string_loop:
lda (OUTL),Y
beq done_print_string
ps_smc1:
ora #$80 ; make sure we are not inverse
sta (BASL),Y
iny
bne print_string_loop
done_print_string:
iny
clc
tya
adc OUTL
sta OUTL
lda OUTH
adc #0
sta OUTH
rts

View File

@ -0,0 +1,5 @@
wait_until_keypress:
lda KEYPRESS ; 4
bpl wait_until_keypress ; 3
bit KEYRESET ; clear the keyboard buffer
rts ; 6

190
music/zero_wing/zp.inc Normal file
View File

@ -0,0 +1,190 @@
;; Zero Page
;; ZX0 addresses
ZX0_src = $00
ZX0_dst = $02
offset = $04
bitr = $06
pntr = $07
;; Zero page monitor routines addresses
WNDLFT = $20
WNDWDTH = $21
WNDTOP = $22
WNDBTM = $23
CH = $24
CV = $25
GBASL = $26
GBASH = $27
BASL = $28
BASH = $29
H2 = $2C
V2 = $2D
MASK = $2E
COLOR = $30
;INVFLG = $32
; dos33 zero page = 26-2f, 35-38, 3e 3f 40-4d
; overlap applesoft 67-6a,6f,70,af,b0,ca-cd,d8
; DOS33: Confirmed kills $68
RWTSL = $60
RWTSH = $61
DOSBUFL = $62
DOSBUFH = $63
FILEML = $64
FILEMH = $65
FRAME = $60
FRAMEH = $61
WAITING = $62
LETTERL = $63
LETTERH = $64
LETTERX = $65
LETTERY = $66
LETTERD = $67
LETTER = $68
BLARGH = $69
;FACTOR_I = $66
;FACTOR_F = $67
;DX_I = $68
;DX_F = $69
;SPACEX_I = $6A
;SPACEX_F = $6B
;CX_I = $6C
;CX_F = $6D
;DY_I = $6E
;DY_F = $6F
ZPOS = $78
REGISTER_DUMP = $70
A_FINE_TONE = $70
A_COARSE_TONE = $71
B_FINE_TONE = $72
B_COARSE_TONE = $73
C_FINE_TONE = $74
C_COARSE_TONE = $75
NOISE = $76
ENABLE = $77
A_VOLUME = $78
B_VOLUME = $79
C_VOLUME = $7A
ENVELOPE_FINE = $7B
ENVELOPE_COARSE = $7C
ENVELOPE_SHAPE = $7D
COPY_OFFSET = $7E
DECODER_STATE = $7F
REGISTER_DUMP2 = $80
A_FINE_TONE2 = $80
A_COARSE_TONE2 = $81
B_FINE_TONE2 = $82
B_COARSE_TONE2 = $83
C_FINE_TONE2 = $84
C_COARSE_TONE2 = $85
NOISE2 = $86
ENABLE2 = $87
A_VOLUME2 = $88
B_VOLUME2 = $89
C_VOLUME2 = $8A
ENVELOPE_FINE2 = $8B
ENVELOPE_COARS2 = $8C
ENVELOPE_SHAPE2 = $8D
LYRICSL = $8E
LYRICSH = $8F
FRAME_COUNT = $90
MB_VALUE = $91
MB_ADDRL = $91
MB_ADDRH = $92
DONE_PLAYING = $93
MB_CHUNK_OFFSET = $94
MB_FRAME = $94
MB_PATTERN = $95
CHUNKSIZE = $95
LZ4_DONE = $96
DECODE_ERROR = $97
COPY_TIME = $98
DECOMPRESS_TIME = $99
TIME_TAKEN = $9A
LYRICS_ACTIVE = $9B
;FORTYCOL = $9C
CURSOR = $9D
; More zero-page addresses
; we try not to conflict with anything DOS, MONITOR or BASIC related
;COLOR1 = $E0
;COLOR2 = $E1
;MATCH = $E2
XX = $E3
YY = $E4
HGR_COLOR = $E4
;SHIPY = $E4
;YADD = $E5
;LOOP = $E6
;MEMPTRL = $E7
;MEMPTRH = $E8
;NAMEL = $E9
;NAMEH = $EA
;NAMEX = $EB
;CHAR = $EC
STATE = $ED
DISP_PAGE = $ED
DRAW_PAGE = $EE
OFFSET = $EF
;FIRST = $F0
LASTKEY = $F1
PADDLE_STATUS = $F2
SPRITETEMP = $F2
XPOS = $F3
YPOS = $F4
TEMP = $FA
TEMPY = $FB
INL = $FC
INH = $FD
OUTL = $FE
OUTH = $FF
; read any file slot 6 version
; based on FASTLD6 and RTS copyright (c) Peter Ferrie 2011-2013,2018
; modified to assembled with ca64 -- vmw
; added code to patch it to run from current disk slot -- vmw
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
ldsizel = $f0
ldsizeh = $f1
namlo = $fb
namhi = $fc
step = $fd ; state for stepper motor
tmptrk = $fe ; temporary copy of current track
phase = $ff ; current phase for /seek

131
music/zero_wing/zw.s Normal file
View File

@ -0,0 +1,131 @@
; Zero Wing Into
;
; by deater (Vince Weaver) <vince@deater.net>
.include "zp.inc"
.include "hardware.inc"
hires_start:
;===================
; set graphics mode
;===================
jsr HOME
jsr HGR
;===================
; Load graphics
;===================
load_loop:
;=============================
; OPERATOR
;=============================
jsr HOME
lda #<operator_data
sta zx_src_l+1
lda #>operator_data
sta zx_src_h+1
lda #$20
jsr zx02_full_decomp
lda #<operator_text
sta OUTL
lda #>operator_text
sta OUTH
jsr move_and_print
jsr move_and_print
jsr wait_until_keypress
;=============================
; CATS
;=============================
jsr HOME
lda #<cats_data
sta zx_src_l+1
lda #>cats_data
sta zx_src_h+1
lda #$20
jsr zx02_full_decomp
lda #<cats_text
sta OUTL
lda #>cats_text
sta OUTH
jsr move_and_print
jsr wait_until_keypress
;=============================
; CAPTAIN
;=============================
jsr HOME
lda #<captain_data
sta zx_src_l+1
lda #>captain_data
sta zx_src_h+1
lda #$20
jsr zx02_full_decomp
lda #<captain_text
sta OUTL
lda #>captain_text
sta OUTH
jsr move_and_print
jsr wait_until_keypress
jmp load_loop
.align $100
.include "wait_keypress.s"
.include "zx02_optim.s"
.include "text_print.s"
.include "gr_offsets.s"
cats_data:
.incbin "graphics/cats.hgr.zx02"
cats_text:
.byte 0,21,"CATS: HOW ARE YOU GENTLEMEN !!",0
captain_data:
.incbin "graphics/captain.hgr.zx02"
captain_text:
.byte 0,21,"CAPTAIN: WHAT YOU SAY !!",0
operator_data:
.incbin "graphics/operator.hgr.zx02"
operator_text:
.byte 0,20,"OPERATOR: WE GET SIGNAL.",0
.byte 1,22,"CAPTAIN: WHAT !",0

View File

@ -0,0 +1,159 @@
; De-compressor for ZX02 files
; ----------------------------
;
; Decompress ZX02 data (6502 optimized format), optimized for speed and size
; 138 bytes code, 58.0 cycles/byte in test file.
;
; Compress with:
; zx02 input.bin output.zx0
;
; (c) 2022 DMSC
; Code under MIT license, see LICENSE file.
;ZP=$80
;offset = ZP+0
;ZX0_src = ZP+2
;ZX0_dst = ZP+4
;bitr = ZP+6
;pntr = ZP+7
; Initial values for offset, source, destination and bitr
;zx0_ini_block:
; .byte $00, $00, <comp_data, >comp_data, <out_addr, >out_addr, $80
;--------------------------------------------------
; Decompress ZX0 data (6502 optimized format)
zx02_full_decomp:
; ; Get initialization block
; ldy #7
;
;copy_init: lda zx0_ini_block-1, y
; sta offset-1, y
; dey
; bne copy_init
sta ZX0_dst+1 ; page to output to in A
zx_src_l:
ldy #$dd
sty ZX0_src
zx_src_h:
ldy #$dd
sty ZX0_src+1
ldy #$80
sty bitr
ldy #0
sty offset
sty offset+1
sty ZX0_dst ; always on even page
; Decode literal: Ccopy next N bytes from compressed file
; Elias(length) byte[1] byte[2] ... byte[N]
decode_literal:
jsr get_elias
cop0: lda (ZX0_src), y
inc ZX0_src
bne plus1
inc ZX0_src+1
plus1: sta (ZX0_dst),y
inc ZX0_dst
bne plus2
inc ZX0_dst+1
plus2: dex
bne cop0
asl bitr
bcs dzx0s_new_offset
; Copy from last offset (repeat N bytes from last offset)
; Elias(length)
jsr get_elias
dzx0s_copy:
lda ZX0_dst
sbc offset ; C=0 from get_elias
sta pntr
lda ZX0_dst+1
sbc offset+1
sta pntr+1
cop1:
lda (pntr), y
inc pntr
bne plus3
inc pntr+1
plus3: sta (ZX0_dst),y
inc ZX0_dst
bne plus4
inc ZX0_dst+1
plus4: dex
bne cop1
asl bitr
bcc decode_literal
; Copy from new offset (repeat N bytes from new offset)
; Elias(MSB(offset)) LSB(offset) Elias(length-1)
dzx0s_new_offset:
; Read elias code for high part of offset
jsr get_elias
beq exit ; Read a 0, signals the end
; Decrease and divide by 2
dex
txa
lsr ; @
sta offset+1
; Get low part of offset, a literal 7 bits
lda (ZX0_src), y
inc ZX0_src
bne plus5
inc ZX0_src+1
plus5:
; Divide by 2
ror ; @
sta offset
; And get the copy length.
; Start elias reading with the bit already in carry:
ldx #1
jsr elias_skip1
inx
bcc dzx0s_copy
; Read an elias-gamma interlaced code.
; ------------------------------------
get_elias:
; Initialize return value to #1
ldx #1
bne elias_start
elias_get: ; Read next data bit to result
asl bitr
rol ; @
tax
elias_start:
; Get one bit
asl bitr
bne elias_skip1
; Read new bit from stream
lda (ZX0_src), y
inc ZX0_src
bne plus6
inc ZX0_src+1
plus6: ;sec ; not needed, C=1 guaranteed from last bit
rol ;@
sta bitr
elias_skip1:
txa
bcs elias_get
; Got ending bit, stop reading
exit:
rts