mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-12-25 20:30:31 +00:00
dya: add files
This commit is contained in:
parent
aecf0f01c7
commit
f9f16609f0
88
dya/Makefile
Normal file
88
dya/Makefile
Normal file
@ -0,0 +1,88 @@
|
||||
include ../Makefile.inc
|
||||
|
||||
DOS33 = ../dos33fs-utils/dos33
|
||||
PNG2GR = ../gr-utils/png2gr
|
||||
|
||||
all: chiptune_player.dsk chiptune_unrolled.dsk
|
||||
|
||||
$(DOS33):
|
||||
cd ../dos33fs-utils && make
|
||||
|
||||
chiptune_player.dsk: CHIPTUNE_PLAYER ./krw/INTRO2.KRW HELLO
|
||||
cp chiptune_empty.dsk chiptune_player.dsk
|
||||
$(DOS33) -y chiptune_player.dsk SAVE A HELLO
|
||||
$(DOS33) -y chiptune_player.dsk BSAVE -a 0x0C00 CHIPTUNE_PLAYER
|
||||
$(DOS33) -y chiptune_player.dsk SAVE B ./krw/CAMOUFLAGE.KRW
|
||||
$(DOS33) -y chiptune_player.dsk SAVE B ./krw/CHRISTMAS.KRW
|
||||
$(DOS33) -y chiptune_player.dsk SAVE B ./krw/CRMOROS.KRW
|
||||
$(DOS33) -y chiptune_player.dsk SAVE B ./krw/DEATH2.KRW
|
||||
$(DOS33) -y chiptune_player.dsk SAVE B ./krw/DEMO4.KRW
|
||||
$(DOS33) -y chiptune_player.dsk SAVE B ./krw/HARKONEN.KRW
|
||||
$(DOS33) -y chiptune_player.dsk SAVE B ./krw/INTRO2.KRW
|
||||
# $(DOS33) -y chiptune_player.dsk SAVE B ./krw/KORO.KRW
|
||||
$(DOS33) -y chiptune_player.dsk SAVE B ./krw/LYRA2.KRW
|
||||
# $(DOS33) -y chiptune_player.dsk SAVE B ./krw/MMCM.KRW
|
||||
$(DOS33) -y chiptune_player.dsk SAVE B ./krw/RANDOM.KRW
|
||||
$(DOS33) -y chiptune_player.dsk SAVE B ./krw/ROBOT.KRW
|
||||
$(DOS33) -y chiptune_player.dsk SAVE B ./krw/SDEMO.KRW
|
||||
$(DOS33) -y chiptune_player.dsk SAVE B ./krw/SPUTNIK.KRW
|
||||
$(DOS33) -y chiptune_player.dsk SAVE B ./krw/TECHNO.KRW
|
||||
$(DOS33) -y chiptune_player.dsk SAVE B ./krw/UNIVERSE.KRW
|
||||
$(DOS33) -y chiptune_player.dsk SAVE B ./krw/WAVE.KRW
|
||||
# $(DOS33) -y chiptune_player.dsk SAVE B OUT.LZ4
|
||||
# $(DOS33) -y chiptune_player.dsk BSAVE -a 0x6000 OUT.0
|
||||
|
||||
|
||||
chiptune_unrolled.dsk: CHIPTUNE_UNROLLED ./krw/INTRO2.KRW
|
||||
cp chiptune_empty.dsk chiptune_unrolled.dsk
|
||||
$(DOS33) -y chiptune_unrolled.dsk BSAVE -a 0x0C00 CHIPTUNE_UNROLLED
|
||||
$(DOS33) -y chiptune_unrolled.dsk SAVE B ./krw/CAMOUFLAGE.KRW
|
||||
$(DOS33) -y chiptune_unrolled.dsk SAVE B ./krw/CHRISTMAS.KRW
|
||||
$(DOS33) -y chiptune_unrolled.dsk SAVE B ./krw/CRMOROS.KRW
|
||||
$(DOS33) -y chiptune_unrolled.dsk SAVE B ./krw/DEATH2.KRW
|
||||
$(DOS33) -y chiptune_unrolled.dsk SAVE B ./krw/DEMO4.KRW
|
||||
$(DOS33) -y chiptune_unrolled.dsk SAVE B ./krw/HARKONEN.KRW
|
||||
$(DOS33) -y chiptune_unrolled.dsk SAVE B ./krw/INTRO2.KRW
|
||||
# $(DOS33) -y chiptune_unrolled.dsk SAVE B ./krw/KORO.KRW
|
||||
$(DOS33) -y chiptune_unrolled.dsk SAVE B ./krw/LYRA2.KRW
|
||||
# $(DOS33) -y chiptune_unrolled.dsk SAVE B ./krw/MMCM.KRW
|
||||
$(DOS33) -y chiptune_unrolled.dsk SAVE B ./krw/RANDOM.KRW
|
||||
$(DOS33) -y chiptune_unrolled.dsk SAVE B ./krw/ROBOT.KRW
|
||||
$(DOS33) -y chiptune_unrolled.dsk SAVE B ./krw/SDEMO.KRW
|
||||
$(DOS33) -y chiptune_unrolled.dsk SAVE B ./krw/SPUTNIK.KRW
|
||||
$(DOS33) -y chiptune_unrolled.dsk SAVE B ./krw/TECHNO.KRW
|
||||
$(DOS33) -y chiptune_unrolled.dsk SAVE B ./krw/UNIVERSE.KRW
|
||||
$(DOS33) -y chiptune_unrolled.dsk SAVE B ./krw/WAVE.KRW
|
||||
|
||||
HELLO: hello.bas
|
||||
../asoft_basic-utils/tokenize_asoft < hello.bas > HELLO
|
||||
|
||||
CHIPTUNE_PLAYER: chiptune_player.o
|
||||
ld65 -o CHIPTUNE_PLAYER chiptune_player.o -C ../linker_scripts/apple2_c00.inc
|
||||
|
||||
chiptune_player.o: chiptune_player.s \
|
||||
../asm_routines/mockingboard.s \
|
||||
../asm_routines/dos33_routines.s \
|
||||
../asm_routines/lz4_decode.s \
|
||||
../asm_routines/keypress_minimal.s \
|
||||
rasterbars.s volume_bars.s interrupt_handler.s \
|
||||
chip_title.inc zp.inc
|
||||
ca65 -o chiptune_player.o chiptune_player.s -l chiptune_player.lst
|
||||
|
||||
CHIPTUNE_UNROLLED: chiptune_unrolled.o
|
||||
ld65 -o CHIPTUNE_UNROLLED chiptune_unrolled.o -C ../linker_scripts/apple2_c00.inc
|
||||
|
||||
chiptune_unrolled.o: chiptune_player.s \
|
||||
../asm_routines/mockingboard.s \
|
||||
../asm_routines/dos33_routines.s \
|
||||
../asm_routines/lz4_decode.s \
|
||||
../asm_routines/keypress_minimal.s \
|
||||
rasterbars.s volume_bars.s interrupt_handler_unrolled.s \
|
||||
chip_title.inc zp.inc
|
||||
ca65 -D UNROLLED=1 -o chiptune_unrolled.o chiptune_player.s -l chiptune_unrolled.lst
|
||||
|
||||
|
||||
clean:
|
||||
rm -f *~ TITLE.GR *.o *.lst \
|
||||
CHIPTUNE_PLAYER CHIPTUNE_UNROLLED
|
||||
|
51
dya/chip_title.inc
Normal file
51
dya/chip_title.inc
Normal file
@ -0,0 +1,51 @@
|
||||
chip_title: .byte $28 ; ysize=40
|
||||
.byte $AE,$00, $A3,$10, $40, $A3,$20, $40, $A3,$20, $A0,$14,$00
|
||||
.byte $A3,$10, $11, $A4,$91, $00, $A3,$11, $44, $A3,$22
|
||||
.byte $44, $A3,$22, $00, $A4,$91, $11, $A3,$10, $A8,$00
|
||||
.byte $10, $11, $91,$91, $99, $A3,$D9, $DD, $CD,$CD
|
||||
.byte $C0, $00, $11, $A3,$44, $22, $A3,$44, $22
|
||||
.byte $00, $C0, $CD,$CD, $DD, $A3,$D9, $99, $A3,$91
|
||||
.byte $11, $10, $A3,$00, $10, $91, $D9,$D9, $DD
|
||||
.byte $CD,$CD, $A3,$6C, $A3,$06, $00, $01, $A3,$04, $02
|
||||
.byte $A3,$04, $02, $00, $A3,$06, $A3,$6C, $A3,$CD, $DD
|
||||
.byte $D9,$D9, $91, $10, $00,$00, $11, $A0,$24,$00, $11
|
||||
.byte $00,$00, $11, $00, $20, $22,$22, $00, $22
|
||||
.byte $00, $22, $00, $22, $00, $22,$22, $20
|
||||
.byte $00, $A3,$33, $00, $33, $00, $33, $00
|
||||
.byte $33, $00,$00, $33, $00, $A3,$33, $00, $A3,$33
|
||||
.byte $00, $11, $00,$00, $11, $00, $22, $A3,$00
|
||||
.byte $22, $20, $22, $00, $22, $00, $22
|
||||
.byte $00, $22, $00,$00, $33, $00,$00, $33, $00
|
||||
.byte $33, $00, $33,$33, $30, $33, $00, $33
|
||||
.byte $30, $00,$00, $33, $30,$30, $00, $11, $00,$00
|
||||
.byte $11, $00, $22, $A3,$00, $22, $02, $22
|
||||
.byte $00, $22, $00, $22,$22, $02, $00,$00, $33
|
||||
.byte $00,$00, $33, $00, $33, $00, $33, $00
|
||||
.byte $33,$33, $00, $33, $03, $00,$00, $03,$03, $33
|
||||
.byte $00, $11, $00,$00, $11, $00, $02, $22,$22
|
||||
.byte $00, $22, $00, $22, $00, $22, $00
|
||||
.byte $22, $A4,$00, $33, $00,$00, $A3,$33, $00, $33
|
||||
.byte $00,$00, $33, $00, $A3,$33, $00, $A3,$33, $00
|
||||
.byte $11, $00, $10, $11, $A0,$24,$00, $11, $10
|
||||
.byte $11, $A8,$00, $A0,$15,$40, $A9,$00, $11,$11, $A4,$00, $C0
|
||||
.byte $A3,$00, $44, $A3,$55, $44, $A5,$55, $44, $55
|
||||
.byte $45, $55, $44, $94, $44, $4E, $44
|
||||
.byte $4E, $44, $A6,$00, $C0, $00,$00, $11,$11, $00,$00
|
||||
.byte $C0, $CC, $C0,$C0, $00,$00, $44, $A3,$55, $44
|
||||
.byte $A5,$55, $44, $55, $54, $55, $44, $94
|
||||
.byte $44, $55, $44, $55, $44, $A4,$00, $C0
|
||||
.byte $CC, $C0,$C0, $00, $11,$11, $00, $A4,$9D, $A3,$00
|
||||
.byte $A0,$12,$44, $64, $44, $64, $44, $00,$00, $A4,$9D
|
||||
.byte $00,$00, $11,$11, $00, $A5,$21, $00,$00, $44, $A3,$55
|
||||
.byte $44, $A5,$55, $44, $55, $45, $55, $44
|
||||
.byte $54,$54, $44, $66, $44, $66, $44, $00,$00
|
||||
.byte $A5,$21, $00, $11,$11, $00,$00, $A3,$06, $A3,$00, $44
|
||||
.byte $A3,$55, $44, $A5,$55, $44, $55, $54, $55
|
||||
.byte $44, $45,$45, $44, $46, $44, $46, $44
|
||||
.byte $A3,$00, $A3,$06, $00,$00, $11,$11, $A8,$00, $A0,$15,$44, $57
|
||||
.byte $A8,$00, $11,$11, $A8,$00, $05, $AB,$04, $C4, $D4
|
||||
.byte $C4, $D4, $C4, $D4, $C4, $D4, $04
|
||||
.byte $05, $A8,$00, $11,$11, $A0,$14,$00, $0C, $0D, $0C
|
||||
.byte $0D, $0C, $0D, $0C, $0D, $AA,$00, $11,$11
|
||||
.byte $A0,$26,$10, $11
|
||||
.byte $A1
|
BIN
dya/chiptune_empty.dsk
Normal file
BIN
dya/chiptune_empty.dsk
Normal file
Binary file not shown.
610
dya/chiptune_player.s
Normal file
610
dya/chiptune_player.s
Normal file
@ -0,0 +1,610 @@
|
||||
; VMW Chiptune Player
|
||||
|
||||
.include "zp.inc"
|
||||
; program is ~4k, so from 0xc00 to 0x1C00
|
||||
LZ4_BUFFER EQU $1C00 ; $1C00 - $5C00, 16k for now
|
||||
UNPACK_BUFFER EQU $5E00 ; $5E00 - $9600, 14k, $3800
|
||||
; trying not to hit DOS at $9600
|
||||
; Reserve 3 chunks plus spare (14k)
|
||||
|
||||
NUM_FILES EQU 15
|
||||
|
||||
;=============================
|
||||
; Setup
|
||||
;=============================
|
||||
jsr HOME
|
||||
jsr TEXT
|
||||
|
||||
; init variables
|
||||
|
||||
lda #0
|
||||
sta DRAW_PAGE
|
||||
sta CH
|
||||
sta CV
|
||||
sta DONE_PLAYING
|
||||
sta XPOS
|
||||
sta MB_CHUNK_OFFSET
|
||||
sta DECODE_ERROR
|
||||
|
||||
lda #$ff
|
||||
sta RASTERBARS_ON
|
||||
|
||||
; lda #4 ; start at DEMO4
|
||||
; lda #7 ; start at LYRA
|
||||
lda #10 ; start at SDEMO
|
||||
sta WHICH_FILE
|
||||
|
||||
; print detection message
|
||||
|
||||
lda #<mocking_message ; load loading message
|
||||
sta OUTL
|
||||
lda #>mocking_message
|
||||
sta OUTH
|
||||
jsr move_and_print ; print it
|
||||
|
||||
jsr mockingboard_detect_slot4 ; call detection routine
|
||||
cpx #$1
|
||||
beq mockingboard_found
|
||||
|
||||
lda #<not_message ; if not found, print that
|
||||
sta OUTL
|
||||
lda #>not_message
|
||||
sta OUTH
|
||||
inc CV
|
||||
jsr move_and_print
|
||||
|
||||
; jmp forever_loop ; and wait forever
|
||||
|
||||
mockingboard_found:
|
||||
; lda #<found_message ; print found message
|
||||
; sta OUTL
|
||||
; lda #>found_message
|
||||
; sta OUTH
|
||||
; inc CV
|
||||
; jsr move_and_print
|
||||
|
||||
;============================
|
||||
; Init the Mockingboard
|
||||
;============================
|
||||
|
||||
jsr mockingboard_init
|
||||
jsr reset_ay_both
|
||||
jsr clear_ay_both
|
||||
|
||||
;=========================
|
||||
; Setup Interrupt Handler
|
||||
;=========================
|
||||
; Vector address goes to 0x3fe/0x3ff
|
||||
; FIXME: should chain any existing handler
|
||||
|
||||
lda #<interrupt_handler
|
||||
sta $03fe
|
||||
lda #>interrupt_handler
|
||||
sta $03ff
|
||||
|
||||
;============================
|
||||
; Enable 50Hz clock on 6522
|
||||
;============================
|
||||
|
||||
sei ; disable interrupts just in case
|
||||
|
||||
lda #$40 ; Continuous interrupts, don't touch PB7
|
||||
sta $C40B ; ACR register
|
||||
lda #$7F ; clear all interrupt flags
|
||||
sta $C40E ; IER register (interrupt enable)
|
||||
|
||||
lda #$C0
|
||||
sta $C40D ; IFR: 1100, enable interrupt on timer one oflow
|
||||
sta $C40E ; IER: 1100, enable timer one interrupt
|
||||
|
||||
lda #$E7
|
||||
sta $C404 ; write into low-order latch
|
||||
lda #$4f
|
||||
sta $C405 ; write into high-order latch,
|
||||
; load both values into counter
|
||||
; clear interrupt and start counting
|
||||
|
||||
; 4fe7 / 1e6 = .020s, 50Hz
|
||||
|
||||
|
||||
;============================
|
||||
; Draw title screen
|
||||
;============================
|
||||
|
||||
jsr set_gr_page0 ; set page 0
|
||||
|
||||
lda #$4 ; draw page 1
|
||||
sta DRAW_PAGE
|
||||
|
||||
jsr clear_screens ; clear both screens
|
||||
|
||||
lda #<chip_title ; point to title data
|
||||
sta GBASL
|
||||
lda #>chip_title
|
||||
sta GBASH
|
||||
|
||||
; Load image ; load the image
|
||||
lda #<$400
|
||||
sta BASL
|
||||
lda #>$400
|
||||
sta BASH
|
||||
|
||||
jsr load_rle_gr
|
||||
|
||||
;==================
|
||||
; load first song
|
||||
;==================
|
||||
|
||||
jsr new_song
|
||||
|
||||
;============================
|
||||
; Init Background
|
||||
;============================
|
||||
jsr set_gr_page0
|
||||
|
||||
lda #0
|
||||
sta DRAW_PAGE
|
||||
sta SCREEN_Y
|
||||
|
||||
;============================
|
||||
; Enable 6502 interrupts
|
||||
;============================
|
||||
|
||||
cli ; clear interrupt mask
|
||||
|
||||
|
||||
;============================
|
||||
; Loop forever
|
||||
;============================
|
||||
main_loop:
|
||||
lda DECODE_ERROR
|
||||
beq check_copy
|
||||
sei
|
||||
brk
|
||||
|
||||
check_copy:
|
||||
lda COPY_TIME
|
||||
beq check_decompress ; if zero, skip
|
||||
|
||||
lda #0
|
||||
sta COPY_OFFSET
|
||||
check_copy_loop:
|
||||
jsr page_copy ;6+3621
|
||||
|
||||
inc COPY_OFFSET ; (opt: make subtract?) ; 5
|
||||
|
||||
lda #14 ; NOT HEX URGH!
|
||||
cmp COPY_OFFSET
|
||||
bne check_copy_loop
|
||||
|
||||
lda #0 ; we are done
|
||||
sta COPY_TIME
|
||||
|
||||
check_decompress:
|
||||
lda DECOMPRESS_TIME
|
||||
beq check_done ; if zero, skip
|
||||
|
||||
jsr setup_next_subsong ; decompress
|
||||
|
||||
lda MB_CHUNK_OFFSET
|
||||
sta TIME_TAKEN
|
||||
|
||||
lda #0
|
||||
sta DECOMPRESS_TIME
|
||||
|
||||
;============================
|
||||
; visualization
|
||||
;============================
|
||||
; jsr clear_top
|
||||
; jsr draw_rasters
|
||||
; jsr volume_bars
|
||||
; jsr page_flip
|
||||
|
||||
check_done:
|
||||
lda #$ff
|
||||
bit DONE_PLAYING
|
||||
beq main_loop ; if was all zeros, loop
|
||||
bmi main_loop ; if high bit set, paused
|
||||
bvs minus_song ; if bit 6 set, then left pressed
|
||||
|
||||
; else, either song finished or
|
||||
; right pressed
|
||||
|
||||
plus_song:
|
||||
sei ; disable interrupts
|
||||
jsr increment_file
|
||||
jmp done_play
|
||||
|
||||
minus_song:
|
||||
sei ; disable interrupts
|
||||
jsr decrement_file
|
||||
|
||||
done_play:
|
||||
|
||||
lda #0
|
||||
sta DONE_PLAYING
|
||||
|
||||
lda #0
|
||||
sta CH
|
||||
|
||||
jsr clear_bottoms
|
||||
|
||||
jsr new_song
|
||||
|
||||
cli ; re-enable interrupts
|
||||
|
||||
jmp main_loop
|
||||
|
||||
forever_loop:
|
||||
jmp forever_loop
|
||||
|
||||
|
||||
|
||||
;=================
|
||||
; load a new song
|
||||
;=================
|
||||
|
||||
new_song:
|
||||
|
||||
;=========================
|
||||
; Init Variables
|
||||
;=========================
|
||||
|
||||
lda #$0
|
||||
sta FRAME_COUNT
|
||||
sta A_VOLUME
|
||||
sta B_VOLUME
|
||||
sta C_VOLUME
|
||||
sta COPY_OFFSET
|
||||
sta DECOMPRESS_TIME
|
||||
sta COPY_TIME
|
||||
sta MB_CHUNK_OFFSET
|
||||
lda #$20
|
||||
sta DECODER_STATE
|
||||
lda #3
|
||||
sta CHUNKSIZE
|
||||
|
||||
;===========================
|
||||
; Print loading message
|
||||
;===========================
|
||||
|
||||
jsr clear_bottoms ; clear bottom of page 0/1
|
||||
|
||||
lda #0 ; print LOADING message
|
||||
sta CH
|
||||
lda #21
|
||||
sta CV
|
||||
|
||||
lda #<loading_message
|
||||
sta OUTL
|
||||
lda #>loading_message
|
||||
sta OUTH
|
||||
jsr print_both_pages
|
||||
|
||||
|
||||
;===========================
|
||||
; Load in KRW file
|
||||
;===========================
|
||||
|
||||
jsr get_filename
|
||||
|
||||
lda #8
|
||||
sta CH
|
||||
lda #21
|
||||
sta CV
|
||||
|
||||
lda INL
|
||||
sta OUTL
|
||||
lda INH
|
||||
sta OUTH
|
||||
jsr print_both_pages
|
||||
|
||||
disk_buff EQU LZ4_BUFFER
|
||||
read_size EQU $4000
|
||||
|
||||
jsr read_file ; read KRW file from disk
|
||||
|
||||
|
||||
;=========================
|
||||
; Print Info
|
||||
;=========================
|
||||
|
||||
jsr clear_bottoms ; clear bottom of page 0/1
|
||||
|
||||
lda #>LZ4_BUFFER ; point to LZ4 data
|
||||
sta OUTH
|
||||
lda #<LZ4_BUFFER
|
||||
sta OUTL
|
||||
|
||||
ldy #3 ; skip KRW magic at front
|
||||
|
||||
; print title
|
||||
lda #20 ; VTAB 20: HTAB from file
|
||||
jsr print_header_info
|
||||
|
||||
; Print Author
|
||||
lda #21 ; VTAB 21: HTAB from file
|
||||
jsr print_header_info
|
||||
|
||||
; Print clock
|
||||
lda #23 ; VTAB 23: HTAB from file
|
||||
jsr print_header_info
|
||||
|
||||
; Print Left Arrow (INVERSE)
|
||||
lda #'<'
|
||||
sta $750
|
||||
sta $B50
|
||||
|
||||
lda #'-'
|
||||
sta $751
|
||||
sta $B51
|
||||
|
||||
; Print Rright Arrow (INVERSE)
|
||||
lda #'-'
|
||||
sta $776
|
||||
sta $B76
|
||||
|
||||
lda #'>'
|
||||
sta $777
|
||||
sta $B77
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; Point LZ4 src at proper place
|
||||
|
||||
ldy #0
|
||||
lda #>(LZ4_BUFFER+3)
|
||||
sta LZ4_SRC+1
|
||||
lda #<(LZ4_BUFFER+3)
|
||||
sta LZ4_SRC
|
||||
|
||||
lda (LZ4_SRC),Y ; get header skip
|
||||
clc
|
||||
adc LZ4_SRC
|
||||
sta LZ4_SRC
|
||||
lda LZ4_SRC+1
|
||||
adc #0
|
||||
sta LZ4_SRC+1
|
||||
|
||||
lda #<UNPACK_BUFFER ; set input pointer
|
||||
sta INL
|
||||
lda #>UNPACK_BUFFER
|
||||
sta INH
|
||||
|
||||
; Decompress first chunks
|
||||
|
||||
lda #$0
|
||||
sta COPY_OFFSET
|
||||
sta DECOMPRESS_TIME
|
||||
lda #$3
|
||||
sta CHUNKSIZE
|
||||
lda #$20
|
||||
sta DECODER_STATE
|
||||
sta COPY_TIME
|
||||
|
||||
jsr setup_next_subsong
|
||||
|
||||
rts
|
||||
|
||||
;=================
|
||||
; next sub-song
|
||||
;=================
|
||||
setup_next_subsong:
|
||||
|
||||
ldy #0
|
||||
|
||||
lda (LZ4_SRC),Y ; get next size value
|
||||
sta LZ4_END
|
||||
iny
|
||||
lda (LZ4_SRC),Y
|
||||
sta LZ4_END+1
|
||||
|
||||
lda #2 ; increment pointer
|
||||
clc
|
||||
adc LZ4_SRC
|
||||
sta LZ4_SRC
|
||||
lda LZ4_SRC+1
|
||||
adc #0
|
||||
sta LZ4_SRC+1
|
||||
|
||||
jsr lz4_decode ; decode
|
||||
|
||||
; tail-call?
|
||||
|
||||
rts
|
||||
|
||||
|
||||
|
||||
;===================
|
||||
; print header info
|
||||
;===================
|
||||
; shortcut to print header info
|
||||
; a = VTAB
|
||||
|
||||
print_header_info:
|
||||
|
||||
sta CV
|
||||
|
||||
iny ; adjust pointer
|
||||
tya
|
||||
ldy #0
|
||||
clc
|
||||
adc OUTL
|
||||
sta OUTL
|
||||
lda OUTH
|
||||
adc #$0
|
||||
sta OUTH
|
||||
|
||||
lda (OUTL),Y ; get HTAB value
|
||||
sta CH
|
||||
|
||||
inc OUTL ; increment 16-bits
|
||||
bne bloop22
|
||||
inc OUTH
|
||||
bloop22:
|
||||
|
||||
jmp print_both_pages ; print, tail call
|
||||
|
||||
|
||||
;==============================================
|
||||
; plan: takes 256 50Hz to play a chunk
|
||||
; need to copy 14 256-byte blocks
|
||||
; PLAY A (copying C)
|
||||
; PLAY B (copying C)
|
||||
; PLAY D (decompressing A/B/C)
|
||||
|
||||
|
||||
;========================
|
||||
; page copy
|
||||
;========================
|
||||
; want to copy:
|
||||
; SRC: chunk_buffer+(2*256)+(COPY_OFFSET*3*256)
|
||||
; DST: chunk_buffer+$2A00+(COPY_OFFSET*256)
|
||||
page_copy:
|
||||
clc ; 2
|
||||
lda #>(UNPACK_BUFFER+512) ; 3
|
||||
adc COPY_OFFSET ; 3
|
||||
adc COPY_OFFSET ; 3
|
||||
adc COPY_OFFSET ; 3
|
||||
sta page_copy_loop+2 ; self modify ; 5
|
||||
|
||||
lda #>(UNPACK_BUFFER+$2A00) ; 2
|
||||
adc COPY_OFFSET ; 3
|
||||
sta page_copy_loop+5 ; self modify ; 5
|
||||
|
||||
ldx #$00 ; 2
|
||||
page_copy_loop:
|
||||
lda $1000,x ; 4
|
||||
sta $1000,X ; 5
|
||||
inx ; 2
|
||||
bne page_copy_loop ; 2nt/3
|
||||
rts ; 6
|
||||
;======================
|
||||
; 2+14*256+6+29= 3621
|
||||
|
||||
|
||||
;==================
|
||||
; Get filename
|
||||
;==================
|
||||
; WHICH_FILE holds number
|
||||
; MAX_FILES has max
|
||||
; Scroll through until find
|
||||
; point INH:INL to it
|
||||
get_filename:
|
||||
|
||||
ldy #0
|
||||
ldx WHICH_FILE
|
||||
|
||||
lda #<krw_file ; point to filename
|
||||
sta INL
|
||||
lda #>krw_file
|
||||
sta INH
|
||||
|
||||
get_filename_loop:
|
||||
cpx #0
|
||||
beq filename_found
|
||||
|
||||
inner_loop:
|
||||
iny
|
||||
lda (INL),Y
|
||||
bne inner_loop
|
||||
|
||||
iny
|
||||
|
||||
dex
|
||||
jmp get_filename_loop
|
||||
|
||||
filename_found:
|
||||
tya
|
||||
clc
|
||||
adc INL
|
||||
sta INL
|
||||
lda INH
|
||||
adc #0
|
||||
sta INH
|
||||
|
||||
rts
|
||||
|
||||
;===============================
|
||||
; Increment file we want to load
|
||||
;===============================
|
||||
increment_file:
|
||||
inc WHICH_FILE
|
||||
lda WHICH_FILE
|
||||
cmp #NUM_FILES
|
||||
bne done_increment
|
||||
lda #0
|
||||
sta WHICH_FILE
|
||||
done_increment:
|
||||
rts
|
||||
|
||||
;===============================
|
||||
; Decrement file we want to load
|
||||
;===============================
|
||||
decrement_file:
|
||||
dec WHICH_FILE
|
||||
bpl done_decrement
|
||||
lda #(NUM_FILES-1)
|
||||
sta WHICH_FILE
|
||||
done_decrement:
|
||||
rts
|
||||
|
||||
;==========
|
||||
; filenames
|
||||
;==========
|
||||
krw_file:
|
||||
.asciiz "CAMOUFLAGE.KRW"
|
||||
.asciiz "CHRISTMAS.KRW"
|
||||
.asciiz "CRMOROS.KRW"
|
||||
.asciiz "DEATH2.KRW"
|
||||
.asciiz "DEMO4.KRW"
|
||||
.asciiz "HARKONEN.KRW"
|
||||
.asciiz "INTRO2.KRW"
|
||||
.asciiz "LYRA2.KRW"
|
||||
.asciiz "RANDOM.KRW"
|
||||
.asciiz "ROBOT.KRW"
|
||||
.asciiz "SDEMO.KRW"
|
||||
.asciiz "SPUTNIK.KRW"
|
||||
.asciiz "TECHNO.KRW"
|
||||
.asciiz "UNIVERSE.KRW"
|
||||
.asciiz "WAVE.KRW"
|
||||
|
||||
|
||||
|
||||
|
||||
;=========
|
||||
;routines
|
||||
;=========
|
||||
.include "../asm_routines/gr_offsets.s"
|
||||
.include "text_print.s"
|
||||
.include "../asm_routines/mockingboard_a.s"
|
||||
.include "../asm_routines/gr_fast_clear.s"
|
||||
.include "../asm_routines/pageflip.s"
|
||||
.include "../asm_routines/gr_unrle.s"
|
||||
.include "../asm_routines/gr_setpage.s"
|
||||
.include "../asm_routines/dos33_routines.s"
|
||||
.include "../asm_routines/gr_hlin.s"
|
||||
.include "../asm_routines/lz4_decode.s"
|
||||
.include "../asm_routines/keypress_minimal.s"
|
||||
.include "rasterbars.s"
|
||||
.include "volume_bars.s"
|
||||
.if .def(UNROLLED)
|
||||
.include "interrupt_handler_unrolled.s"
|
||||
.else
|
||||
.include "interrupt_handler.s"
|
||||
.endif
|
||||
;=========
|
||||
; strings
|
||||
;=========
|
||||
mocking_message: .asciiz "LOOKING FOR MOCKINGBOARD IN SLOT #4"
|
||||
not_message: .byte "NOT "
|
||||
found_message: .asciiz "FOUND"
|
||||
;done_message: .asciiz "DONE PLAYING"
|
||||
loading_message: .asciiz "LOADING"
|
||||
|
||||
;============
|
||||
; graphics
|
||||
;============
|
||||
.include "chip_title.inc"
|
5
dya/hello.bas
Normal file
5
dya/hello.bas
Normal file
@ -0,0 +1,5 @@
|
||||
5 PRINT
|
||||
10 PRINT "LOADING VMW CHIPTUNE PLAYER"
|
||||
20 PRINT "DYA SPECIAL EDITION V1.0"
|
||||
50 PRINT
|
||||
100 PRINT CHR$ (4)"BRUN CHIPTUNE_PLAYER"
|
376
dya/interrupt_handler.s
Normal file
376
dya/interrupt_handler.s
Normal file
@ -0,0 +1,376 @@
|
||||
;================================
|
||||
;================================
|
||||
; mockingboard interrupt handler
|
||||
;================================
|
||||
;================================
|
||||
; On Apple II/6502 the interrupt handler jumps to address in 0xfffe
|
||||
; This is in the ROM, which saves the registers
|
||||
; on older IIe it saved A to $45 (which could mess with DISK II)
|
||||
; newer IIe doesn't do that.
|
||||
; It then calculates if it is a BRK or not (which trashes A)
|
||||
; Then it sets up the stack like an interrupt and calls 0x3fe
|
||||
|
||||
TIME_OFFSET EQU 13
|
||||
|
||||
interrupt_handler:
|
||||
; pha ; save A ; 3
|
||||
; A is saved in $45 by firmware
|
||||
txa
|
||||
pha ; save X
|
||||
tya
|
||||
pha ; save Y
|
||||
|
||||
|
||||
|
||||
; inc $0404 ; debug (flashes char onscreen)
|
||||
|
||||
bit $C404 ; clear 6522 interrupt by reading T1C-L ; 4
|
||||
|
||||
|
||||
lda DONE_PLAYING ; 3
|
||||
beq mb_play_music ; if song done, don't play music ; 3/2nt
|
||||
jmp check_keyboard ; 3
|
||||
;============
|
||||
; 13
|
||||
|
||||
mb_play_music:
|
||||
|
||||
|
||||
;======================================
|
||||
; Write frames to Mockingboard
|
||||
;======================================
|
||||
; actually plays frame loaded at end of
|
||||
; last interrupt, so 20ms behind?
|
||||
|
||||
mb_write_frame:
|
||||
|
||||
|
||||
ldx #0 ; set up reg count ; 2
|
||||
;============
|
||||
; 2
|
||||
|
||||
;==================================
|
||||
; loop through the 14 registers
|
||||
; reading the value, then write out
|
||||
;==================================
|
||||
; inlined "write_ay_both" to save up to 156 (12*13) cycles
|
||||
; unrolled
|
||||
|
||||
mb_write_loop:
|
||||
lda REGISTER_DUMP,X ; load register value ; 4
|
||||
cmp REGISTER_OLD,X ; compare with old values ; 4
|
||||
beq mb_no_write ; 3/2nt
|
||||
;=============
|
||||
; typ 11
|
||||
|
||||
; special case R13. If it is 0xff, then don't update
|
||||
; otherwise might spuriously reset the envelope settings
|
||||
|
||||
cpx #13 ; 2
|
||||
bne mb_not_13 ; 3/2nt
|
||||
cmp #$ff ; 2
|
||||
beq mb_skip_13 ; 3/2nt
|
||||
;============
|
||||
; typ 5
|
||||
mb_not_13:
|
||||
|
||||
|
||||
; address
|
||||
stx MOCK_6522_ORA1 ; put address on PA1 ; 4
|
||||
stx MOCK_6522_ORA2 ; put address on PA2 ; 4
|
||||
lda #MOCK_AY_LATCH_ADDR ; latch_address for PB1 ; 2
|
||||
sta MOCK_6522_ORB1 ; latch_address on PB1 ; 4
|
||||
sta MOCK_6522_ORB2 ; latch_address on PB2 ; 4
|
||||
lda #MOCK_AY_INACTIVE ; go inactive ; 2
|
||||
sta MOCK_6522_ORB1 ; 4
|
||||
sta MOCK_6522_ORB2 ; 4
|
||||
|
||||
; value
|
||||
lda REGISTER_DUMP,X ; load register value ; 4
|
||||
sta MOCK_6522_ORA1 ; put value on PA1 ; 4
|
||||
sta MOCK_6522_ORA2 ; put value on PA2 ; 4
|
||||
lda #MOCK_AY_WRITE ; ; 2
|
||||
sta MOCK_6522_ORB1 ; write on PB1 ; 4
|
||||
sta MOCK_6522_ORB2 ; write on PB2 ; 4
|
||||
lda #MOCK_AY_INACTIVE ; go inactive ; 2
|
||||
sta MOCK_6522_ORB1 ; 4
|
||||
sta MOCK_6522_ORB2 ; 4
|
||||
;===========
|
||||
; 62
|
||||
mb_no_write:
|
||||
inx ; point to next register ; 2
|
||||
cpx #14 ; if 14 we're done ; 2
|
||||
bmi mb_write_loop ; otherwise, loop ; 3/2nt
|
||||
;============
|
||||
; 7
|
||||
mb_skip_13:
|
||||
|
||||
|
||||
;=====================================
|
||||
; Copy registers to old
|
||||
;=====================================
|
||||
ldx #13 ; 2
|
||||
mb_reg_copy:
|
||||
lda REGISTER_DUMP,X ; load register value ; 4
|
||||
sta REGISTER_OLD,X ; compare with old values ; 4
|
||||
dex ; 2
|
||||
bpl mb_reg_copy ; 2nt/3
|
||||
;=============
|
||||
; 171
|
||||
|
||||
;===================================
|
||||
; Load all 14 registers in advance
|
||||
;===================================
|
||||
; note, assuming not cross page boundary, not any slower
|
||||
; then loading from zero page?
|
||||
|
||||
mb_load_values:
|
||||
|
||||
ldx #0 ; set up reg count ; 2
|
||||
ldy MB_CHUNK_OFFSET ; get chunk offset ; 3
|
||||
;=============
|
||||
; 5
|
||||
|
||||
mb_load_loop:
|
||||
lda (INL),y ; load register value ; 5
|
||||
sta REGISTER_DUMP,X ; 4
|
||||
;============
|
||||
; 9
|
||||
;====================
|
||||
; point to next page
|
||||
;====================
|
||||
|
||||
clc ; point to next interleaved ; 2
|
||||
lda INH ; page by adding CHUNKSIZE (3/1); 3
|
||||
adc CHUNKSIZE ; 3
|
||||
sta INH ; 3
|
||||
|
||||
inx ; point to next register ; 2
|
||||
cpx #14 ; if 14 we're done ; 2
|
||||
bmi mb_load_loop ; otherwise, loop ; 3/2nt
|
||||
;============
|
||||
; 18
|
||||
|
||||
;=========================================
|
||||
; if A_COARSE_TONE is $ff then we are done
|
||||
|
||||
lda A_COARSE_TONE ; 3
|
||||
bpl mb_not_done ; 3/2nt
|
||||
|
||||
lda #1 ; set done playing ; 2
|
||||
|
||||
jmp quiet_exit ; 3
|
||||
;===========
|
||||
; typ 6
|
||||
mb_not_done:
|
||||
|
||||
;==============================================
|
||||
; incremement offset. If 0 move to next chunk
|
||||
;==============================================
|
||||
|
||||
increment_offset:
|
||||
|
||||
inc MB_CHUNK_OFFSET ; increment offset ; 5
|
||||
bne back_to_first_reg ; if not zero, done ; 3/2nt
|
||||
|
||||
|
||||
;=====================
|
||||
; move to next state
|
||||
;=====================
|
||||
|
||||
clc
|
||||
rol DECODER_STATE ; next state ; 5
|
||||
; 20 -> 40 -> 80 -> c+00
|
||||
bcs wraparound_to_a ; 3/2nt
|
||||
|
||||
bit DECODER_STATE ;bit7->N bit6->V
|
||||
bvs back_to_first_reg ; do nothing on B ; 3/2nt
|
||||
|
||||
start_c:
|
||||
lda #1
|
||||
sta CHUNKSIZE
|
||||
|
||||
; setup next three chunks of song
|
||||
|
||||
lda #1 ; start decompressing
|
||||
sta DECOMPRESS_TIME ; outside of handler
|
||||
|
||||
jmp back_to_first_reg
|
||||
|
||||
wraparound_to_a:
|
||||
lda #$3
|
||||
sta CHUNKSIZE
|
||||
lda #$20
|
||||
sta DECODER_STATE
|
||||
sta COPY_TIME ; start copying
|
||||
|
||||
lda DECOMPRESS_TIME
|
||||
beq blah
|
||||
lda #1
|
||||
sta DECODE_ERROR
|
||||
blah:
|
||||
;==============================
|
||||
; After 14th reg, reset back to
|
||||
; read R0 data
|
||||
;==============================
|
||||
|
||||
back_to_first_reg:
|
||||
lda #0 ; 2
|
||||
bit DECODER_STATE ; 3
|
||||
bmi back_to_first_reg_c ; 2nt/3
|
||||
bvc back_to_first_reg_a ; 2nt/3
|
||||
|
||||
back_to_first_reg_b:
|
||||
lda #$1 ; offset by 1
|
||||
|
||||
back_to_first_reg_a:
|
||||
clc ; 2
|
||||
adc #>UNPACK_BUFFER ; in proper chunk 1 or 2 ; 2
|
||||
|
||||
jmp update_r0_pointer ; 3
|
||||
|
||||
back_to_first_reg_c:
|
||||
lda #>(UNPACK_BUFFER+$2A00) ; in linear C area ; 2
|
||||
|
||||
update_r0_pointer:
|
||||
sta INH ; update r0 pointer ; 3
|
||||
|
||||
|
||||
|
||||
;=================================
|
||||
; Finally done with this interrupt
|
||||
;=================================
|
||||
|
||||
done_interrupt:
|
||||
|
||||
|
||||
;=====================
|
||||
; Update time counter
|
||||
;=====================
|
||||
update_time:
|
||||
inc FRAME_COUNT ; 5
|
||||
lda FRAME_COUNT ; 3
|
||||
cmp #50 ; 3
|
||||
bne done_time ; 3/2nt
|
||||
|
||||
lda #$0 ; 2
|
||||
sta FRAME_COUNT ; 3
|
||||
|
||||
update_second_ones:
|
||||
inc $7d0+TIME_OFFSET+3 ; 6
|
||||
inc $bd0+TIME_OFFSET+3 ; 6
|
||||
lda $bd0+TIME_OFFSET+3 ; 4
|
||||
cmp #$ba ; one past '9' ; 2
|
||||
bne done_time ; 3/2nt
|
||||
lda #'0'+$80 ; 2
|
||||
sta $7d0+TIME_OFFSET+3 ; 4
|
||||
sta $bd0+TIME_OFFSET+3 ; 4
|
||||
update_second_tens:
|
||||
inc $7d0+TIME_OFFSET+2 ; 6
|
||||
inc $bd0+TIME_OFFSET+2 ; 6
|
||||
lda $bd0+TIME_OFFSET+2 ; 4
|
||||
cmp #$b6 ; 6 (for 60 seconds) ; 2
|
||||
bne done_time ; 3/2nt
|
||||
lda #'0'+$80 ; 2
|
||||
sta $7d0+TIME_OFFSET+2 ; 4
|
||||
sta $bd0+TIME_OFFSET+2 ; 4
|
||||
update_minutes:
|
||||
inc $7d0+TIME_OFFSET ; 6
|
||||
inc $bd0+TIME_OFFSET ; 6
|
||||
; we don't handle > 9:59 songs yet
|
||||
done_time:
|
||||
;=============
|
||||
; 90 worst
|
||||
|
||||
|
||||
;=================================
|
||||
; Moved visualization here as a hack
|
||||
;=================================
|
||||
|
||||
;============================
|
||||
; Visualization
|
||||
;============================
|
||||
|
||||
jsr clear_top
|
||||
lda RASTERBARS_ON
|
||||
beq skip_rasters
|
||||
jsr draw_rasters
|
||||
skip_rasters:
|
||||
jsr volume_bars
|
||||
jsr page_flip
|
||||
|
||||
|
||||
check_keyboard:
|
||||
|
||||
jsr get_key
|
||||
lda LASTKEY
|
||||
beq exit_interrupt
|
||||
|
||||
cmp #(' '+$80)
|
||||
bne key_R
|
||||
key_space:
|
||||
lda #$80
|
||||
eor DONE_PLAYING
|
||||
jmp quiet_exit
|
||||
|
||||
key_R:
|
||||
cmp #'R'
|
||||
bne key_left
|
||||
|
||||
lda #$ff
|
||||
eor RASTERBARS_ON
|
||||
sta RASTERBARS_ON
|
||||
jmp done_key
|
||||
|
||||
key_left:
|
||||
cmp #'A'
|
||||
bne key_right
|
||||
|
||||
lda #$40
|
||||
bne quiet_exit
|
||||
|
||||
key_right:
|
||||
cmp #'D'
|
||||
bne done_key
|
||||
|
||||
lda #$20
|
||||
bne quiet_exit
|
||||
|
||||
done_key:
|
||||
jmp exit_interrupt
|
||||
|
||||
quiet_exit:
|
||||
sta DONE_PLAYING
|
||||
jsr clear_ay_both
|
||||
|
||||
;=====================================
|
||||
; clear register area
|
||||
;=====================================
|
||||
ldx #13 ; 2
|
||||
lda #0 ; 2
|
||||
mb_clear_reg:
|
||||
sta REGISTER_DUMP,X ; clear register value ; 4
|
||||
sta REGISTER_OLD,X ; clear old values ; 4
|
||||
dex ; 2
|
||||
bpl mb_clear_reg ; 2nt/3
|
||||
|
||||
exit_interrupt:
|
||||
|
||||
; pla ; restore a ; 4
|
||||
|
||||
pla
|
||||
tay ; restore Y
|
||||
pla
|
||||
tax ; restore X
|
||||
lda $45 ; restore A
|
||||
|
||||
|
||||
rti ; return from interrupt ; 6
|
||||
|
||||
;============
|
||||
; typical
|
||||
; ???? cycles
|
||||
|
||||
|
||||
REGISTER_OLD:
|
||||
.byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
299
dya/rasterbars.s
Normal file
299
dya/rasterbars.s
Normal file
@ -0,0 +1,299 @@
|
||||
; Not quite a raster-bar, but why not
|
||||
|
||||
|
||||
; OPTIMIZATION (as originally it was 16,200 instructions, a bit much
|
||||
; for a max 20,000 cycle interrupt handler)
|
||||
|
||||
; -120 : Unroll the zero loop, saved 120 cycles
|
||||
; -5000 : Inline the vlin_double code
|
||||
|
||||
;===========
|
||||
; CONSTANTS
|
||||
;===========
|
||||
|
||||
ELEMENTS EQU 64
|
||||
NUM_ROWS EQU 20
|
||||
|
||||
;=====================
|
||||
; Rasterbars
|
||||
;=====================
|
||||
|
||||
;===========================
|
||||
;===========================
|
||||
; Main Loop
|
||||
;===========================
|
||||
;===========================
|
||||
draw_rasters:
|
||||
|
||||
; clear rows
|
||||
|
||||
; ldy #(NUM_ROWS-1) ; 2
|
||||
lda #0 ; 2
|
||||
init_rows:
|
||||
sta row_color+0 ; 4
|
||||
sta row_color+1
|
||||
sta row_color+2
|
||||
sta row_color+3
|
||||
sta row_color+4
|
||||
sta row_color+5
|
||||
sta row_color+6
|
||||
sta row_color+7
|
||||
sta row_color+8
|
||||
sta row_color+9
|
||||
sta row_color+10
|
||||
sta row_color+11
|
||||
sta row_color+12
|
||||
sta row_color+13
|
||||
sta row_color+14
|
||||
sta row_color+15
|
||||
sta row_color+16
|
||||
sta row_color+17
|
||||
sta row_color+18
|
||||
sta row_color+19
|
||||
|
||||
|
||||
|
||||
|
||||
; sta row_color,Y ; 5
|
||||
; dey ; 2
|
||||
; bpl init_rows ; 2nt/3
|
||||
;==============
|
||||
; Originally 4+20*10 = 204 cyles / 10 bytes
|
||||
; now 2+4*20 = 82 cycles / 62 bytes
|
||||
|
||||
;================
|
||||
; set colors
|
||||
|
||||
ldy SCREEN_Y ; 3
|
||||
|
||||
lda #COLOR_BOTH_DARKBLUE ; d. blue ; 2
|
||||
jsr set_row_color ; 6+136
|
||||
|
||||
lda #COLOR_BOTH_MEDIUMBLUE ; m.blue ; 2
|
||||
jsr set_row_color ; 6+136
|
||||
|
||||
lda #COLOR_BOTH_AQUA ; aqua ; 2
|
||||
jsr set_row_color ; 6+136
|
||||
|
||||
lda #COLOR_BOTH_PINK ; pink ; 2
|
||||
jsr set_row_color ; 6+136
|
||||
|
||||
lda #COLOR_BOTH_RED ; red ; 2
|
||||
jsr set_row_color ; 6+136
|
||||
|
||||
;==============
|
||||
; new = 5 * 142 = 710
|
||||
; original = 1152
|
||||
|
||||
;=================
|
||||
; draw rows
|
||||
|
||||
ldy #(NUM_ROWS-1) ; 2
|
||||
draw_rows_loop:
|
||||
lda row_color,Y ; 5
|
||||
beq draw_rows_skip ; skip if black ; 2nt/3
|
||||
|
||||
sta COLOR ; 3
|
||||
|
||||
sty TEMPY ; 3
|
||||
tya ; y*2 ; 2
|
||||
asl ; 2
|
||||
tay ; 2
|
||||
|
||||
; hlin_setup inlined
|
||||
|
||||
lda gr_offsets,Y ; lookup low-res memory address ; 4
|
||||
sta GBASL ; 3
|
||||
iny ; 2
|
||||
lda gr_offsets,Y ; 4
|
||||
clc ; 2
|
||||
adc DRAW_PAGE ; add in draw page offset ; 3
|
||||
sta GBASH ; 3
|
||||
|
||||
ldy #39 ; 2
|
||||
lda COLOR ; 3
|
||||
double_loop:
|
||||
sta (GBASL),Y ; 6
|
||||
dey ; 2
|
||||
bpl double_loop ; 2nt/3
|
||||
|
||||
ldy TEMPY ; 3
|
||||
|
||||
draw_rows_skip:
|
||||
dey ; 2
|
||||
bpl draw_rows_loop ; 3/2nt
|
||||
|
||||
;==============================
|
||||
; Original: 20 * 741 = 14,820
|
||||
; new = 2+ 20*(53+11*40)=9862
|
||||
; (note, worst case)
|
||||
;==================
|
||||
; update y pointer
|
||||
;==================
|
||||
ldy SCREEN_Y ; 3
|
||||
iny ; 2
|
||||
cpy #ELEMENTS ; 2
|
||||
bne not_there ; 3/2nt
|
||||
ldy #0 ; 2
|
||||
not_there:
|
||||
sty SCREEN_Y ; 3
|
||||
|
||||
rts ; 6
|
||||
|
||||
;===========
|
||||
; 24
|
||||
|
||||
;=====================================
|
||||
; original total= 16,200
|
||||
; new total (worst case)= 10,678
|
||||
; (realistic) = 5,748
|
||||
|
||||
;===================
|
||||
;===================
|
||||
; set_row_color
|
||||
;===================
|
||||
;===================
|
||||
; color in A
|
||||
; Y=offset
|
||||
; Y incremented
|
||||
; A, X trashed
|
||||
|
||||
set_row_color:
|
||||
sta COLOR ; 3
|
||||
tya ; wrap y offset ; 2
|
||||
and #(ELEMENTS-1) ; 2
|
||||
tax ; 2
|
||||
|
||||
lda fine_sine,X ; lookup sine value ; 4
|
||||
; pre-shifted right by 4, sign-extended
|
||||
; 18 added to center
|
||||
|
||||
sin_no_more:
|
||||
|
||||
pha ; save row value ; 3
|
||||
jsr put_color ; put color at row ; 6+44
|
||||
pla ; restore row value ; 4
|
||||
|
||||
clc ; increment row value ; 2
|
||||
adc #1 ; 2
|
||||
|
||||
jsr put_color ; put color at row ; 6+44
|
||||
|
||||
iny ; increment for next time ; 2
|
||||
|
||||
rts ; 6
|
||||
;=============
|
||||
; 132
|
||||
|
||||
;==================
|
||||
; put_color
|
||||
;==================
|
||||
; A = row to set color of
|
||||
; A trashed
|
||||
put_color:
|
||||
clc ; 2
|
||||
ror ; row/2, with even/odd in carry ; 2
|
||||
tax ; put row/2 in X ; 2
|
||||
|
||||
bcc even_line ; if even, skip to even ; 2nt/3
|
||||
odd_line:
|
||||
lda #$f0 ; load mask for odd ; 2
|
||||
bcs finish_line ; 2nt/3
|
||||
even_line:
|
||||
lda #$0f ; load mask for even ; 2
|
||||
finish_line:
|
||||
sta MASK ; 3
|
||||
|
||||
and COLOR ; mask off color ; 3
|
||||
sta COLOR2 ; store for later ; 3
|
||||
|
||||
lda MASK ; 3
|
||||
eor #$ff ; invert mask ; 2
|
||||
and row_color,X ; load existing color ; 4
|
||||
|
||||
ora COLOR2 ; combine ; 3
|
||||
sta row_color,X ; store back ; 5
|
||||
|
||||
rts ; 6
|
||||
|
||||
;===========
|
||||
; 44
|
||||
;======================
|
||||
; some arrays
|
||||
;======================
|
||||
|
||||
row_color:
|
||||
.byte $00,$00,$00,$00,$00, $00,$00,$00,$00,$00
|
||||
.byte $00,$00,$00,$00,$00, $00,$00,$00,$00,$00
|
||||
|
||||
; arithmatically shifted right by 4, sign extended, added 18 to center
|
||||
|
||||
; FIXME: exploit symmetry and get rid of 3/4 of this table
|
||||
; possibly not worth the extra code
|
||||
fine_sine:
|
||||
.byte $00+18 ; 0.000000
|
||||
.byte $01+18 ; 0.098017
|
||||
.byte $03+18 ; 0.195090
|
||||
.byte $04+18 ; 0.290285
|
||||
.byte $06+18 ; 0.382683
|
||||
.byte $07+18 ; 0.471397
|
||||
.byte $08+18 ; 0.555570
|
||||
.byte $0A+18 ; 0.634393
|
||||
.byte $0B+18 ; 0.707107
|
||||
.byte $0C+18 ; 0.773010
|
||||
.byte $0D+18 ; 0.831470
|
||||
.byte $0E+18 ; 0.881921
|
||||
.byte $0E+18 ; 0.923880
|
||||
.byte $0F+18 ; 0.956940
|
||||
.byte $0F+18 ; 0.980785
|
||||
.byte $0F+18 ; 0.995185
|
||||
.byte $0F+18 ; 1.000000
|
||||
.byte $0F+18 ; 0.995185
|
||||
.byte $0F+18 ; 0.980785
|
||||
.byte $0F+18 ; 0.956940
|
||||
.byte $0E+18 ; 0.923880
|
||||
.byte $0E+18 ; 0.881921
|
||||
.byte $0D+18 ; 0.831470
|
||||
.byte $0C+18 ; 0.773010
|
||||
.byte $0B+18 ; 0.707107
|
||||
.byte $0A+18 ; 0.634393
|
||||
.byte $08+18 ; 0.555570
|
||||
.byte $07+18 ; 0.471397
|
||||
.byte $06+18 ; 0.382683
|
||||
.byte $04+18 ; 0.290285
|
||||
.byte $03+18 ; 0.195090
|
||||
.byte $01+18 ; 0.098017
|
||||
.byte $00+18 ; 0.000000
|
||||
|
||||
.byte ($FE+18)&$ff ; -0.098017
|
||||
.byte ($FC+18)&$ff ; -0.195090
|
||||
.byte ($FB+18)&$ff ; -0.290285
|
||||
.byte ($F9+18)&$ff ; -0.382683
|
||||
.byte ($F8+18)&$ff ; -0.471397
|
||||
.byte ($F7+18)&$ff ; -0.555570
|
||||
.byte ($F5+18)&$ff ; -0.634393
|
||||
.byte ($F4+18)&$ff ; -0.707107
|
||||
.byte ($F3+18)&$ff ; -0.773010
|
||||
.byte ($F2+18)&$ff ; -0.831470
|
||||
.byte ($F1+18)&$ff ; -0.881921
|
||||
.byte ($F1+18)&$ff ; -0.923880
|
||||
.byte ($F0+18)&$ff ; -0.956940
|
||||
.byte ($F0+18)&$ff ; -0.980785
|
||||
.byte ($F0+18)&$ff ; -0.995185
|
||||
.byte ($F0+18)&$ff ; -1.000000
|
||||
.byte ($F0+18)&$ff ; -0.995185
|
||||
.byte ($F0+18)&$ff ; -0.980785
|
||||
.byte ($F0+18)&$ff ; -0.956940
|
||||
.byte ($F1+18)&$ff ; -0.923880
|
||||
.byte ($F1+18)&$ff ; -0.881921
|
||||
.byte ($F2+18)&$ff ; -0.831470
|
||||
.byte ($F3+18)&$ff ; -0.773010
|
||||
.byte ($F4+18)&$ff ; -0.707107
|
||||
.byte ($F5+18)&$ff ; -0.634393
|
||||
.byte ($F7+18)&$ff ; -0.555570
|
||||
.byte ($F8+18)&$ff ; -0.471397
|
||||
.byte ($F9+18)&$ff ; -0.382683
|
||||
.byte ($FB+18)&$ff ; -0.290285
|
||||
.byte ($FC+18)&$ff ; -0.195090
|
||||
.byte ($FE+18)&$ff ; -0.098017
|
||||
|
80
dya/text_print.s
Normal file
80
dya/text_print.s
Normal file
@ -0,0 +1,80 @@
|
||||
;================================
|
||||
; htab_vtab
|
||||
;================================
|
||||
; move to CH/CV
|
||||
htab_vtab:
|
||||
lda CV
|
||||
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
|
||||
|
||||
rts
|
||||
|
||||
;================================
|
||||
; move_and_print
|
||||
;================================
|
||||
; move to CH/CV
|
||||
move_and_print:
|
||||
jsr htab_vtab
|
||||
|
||||
;================================
|
||||
; print_string
|
||||
;================================
|
||||
|
||||
print_string:
|
||||
ldy #0
|
||||
print_string_loop:
|
||||
lda (OUTL),Y
|
||||
beq done_print_string
|
||||
ora #$80
|
||||
sta (BASL),Y
|
||||
iny
|
||||
bne print_string_loop
|
||||
done_print_string:
|
||||
rts
|
||||
|
||||
;====================
|
||||
; point_to_end_string
|
||||
;====================
|
||||
point_to_end_string:
|
||||
iny
|
||||
tya
|
||||
clc
|
||||
adc OUTL
|
||||
sta OUTL
|
||||
lda #0
|
||||
adc OUTH
|
||||
sta OUTH
|
||||
|
||||
rts
|
||||
|
||||
|
||||
;================================
|
||||
; print_both_pages
|
||||
;================================
|
||||
print_both_pages:
|
||||
lda DRAW_PAGE
|
||||
pha
|
||||
|
||||
lda #0
|
||||
sta DRAW_PAGE
|
||||
jsr move_and_print
|
||||
|
||||
lda #4
|
||||
sta DRAW_PAGE
|
||||
jsr move_and_print
|
||||
|
||||
pla
|
||||
sta DRAW_PAGE
|
||||
|
||||
rts ; oops forgot this initially
|
||||
; explains the weird vertical stripes on the screen
|
||||
|
226
dya/volume_bars.s
Normal file
226
dya/volume_bars.s
Normal file
@ -0,0 +1,226 @@
|
||||
;==============================
|
||||
;==============================
|
||||
; Draw volume bars
|
||||
;==============================
|
||||
;==============================
|
||||
|
||||
volume_bars:
|
||||
; hline Y,V2 at A
|
||||
; top line
|
||||
|
||||
lda #COLOR_BOTH_GREY ; 2
|
||||
sta COLOR ; remove for crazy effect ; 3
|
||||
ldy #12 ; 2
|
||||
lda #26 ; 2
|
||||
sta V2 ; 3
|
||||
lda #6 ; 2
|
||||
jsr hlin_double ; 6
|
||||
; 63+14*16=287
|
||||
;=====================
|
||||
; 307
|
||||
; middle
|
||||
|
||||
lda #8 ; 2
|
||||
middle_loop:
|
||||
pha ; 3
|
||||
|
||||
cmp #8 ; 2
|
||||
beq middle_black ; 2nt/3
|
||||
cmp #26 ; 2
|
||||
beq middle_black ; 2nt/3
|
||||
|
||||
cmp #10 ; 2
|
||||
bne not_top ; 2nt/3
|
||||
|
||||
ldx #$3B ; pink/purple ; 2
|
||||
stx A_COLOR ; 3
|
||||
ldx #$7E ; light-blue/aqua ; 2
|
||||
stx B_COLOR ; 3
|
||||
ldx #$CD ; light-green/yellow ; 2
|
||||
stx C_COLOR ; 3
|
||||
jmp calc_volume ; 3
|
||||
|
||||
not_top:
|
||||
ldx #COLOR_BOTH_RED ; 2
|
||||
stx A_COLOR ; 3
|
||||
ldx #COLOR_BOTH_DARKBLUE ; 2
|
||||
stx B_COLOR ; 3
|
||||
ldx #COLOR_BOTH_DARKGREEN ; 2
|
||||
stx C_COLOR ; 3
|
||||
|
||||
calc_volume:
|
||||
|
||||
; 10 14/15 24-x = 14 PLUS=none, zero=bottom, neg=all
|
||||
; 12 12/13 12
|
||||
; 14 10/11 10
|
||||
; 16 8/9 8
|
||||
; 18 6/7 6
|
||||
; 20 4/5 4
|
||||
; 22 2/3 2
|
||||
; 24 0/1 0
|
||||
|
||||
; FIXME: there must be a way to make this faster
|
||||
|
||||
mod_a:
|
||||
pha ; 3
|
||||
sec ; 2
|
||||
eor #$ff ; negate ; 2
|
||||
adc #24 ; 24-A ; 2
|
||||
sec ; 2
|
||||
sbc A_VOLUME ; 2
|
||||
bmi mod_b ; 2nt/3
|
||||
beq mod_a_bottom ; 2nt/3
|
||||
mod_a_zero:
|
||||
lda #0 ; 2
|
||||
beq done_a ; 2nt/3
|
||||
mod_a_bottom:
|
||||
lda A_COLOR ; 2
|
||||
and #$f0 ; 2
|
||||
done_a:
|
||||
sta A_COLOR ; 2
|
||||
|
||||
mod_b:
|
||||
pla ; 4
|
||||
pha ; 3
|
||||
sec ; 2
|
||||
eor #$ff ; negate ; 2
|
||||
adc #24 ; 24-A ; 2
|
||||
sec ; 2
|
||||
sbc B_VOLUME ; 2
|
||||
bmi mod_c ; 2nt/3
|
||||
beq mod_b_bottom ; 2nt/3
|
||||
mod_b_zero:
|
||||
lda #0 ; 2
|
||||
beq done_b ; 2nt/3
|
||||
mod_b_bottom:
|
||||
lda B_COLOR ; 3
|
||||
and #$f0 ; 2
|
||||
done_b:
|
||||
sta B_COLOR ; 3
|
||||
|
||||
mod_c:
|
||||
pla ; 4
|
||||
pha ; 3
|
||||
sec ; 2
|
||||
eor #$ff ; negate ; 2
|
||||
adc #24 ; 24-A ; 2
|
||||
sec ; 2
|
||||
sbc C_VOLUME ; 2
|
||||
bmi mod_d ; 2nt/3
|
||||
beq mod_c_bottom ; 2nt/3
|
||||
mod_c_zero:
|
||||
lda #0 ; 2
|
||||
beq done_c ; 2nt/3
|
||||
mod_c_bottom:
|
||||
lda C_COLOR ; 3
|
||||
and #$f0 ; 2
|
||||
done_c:
|
||||
sta C_COLOR ; 3
|
||||
|
||||
mod_d:
|
||||
pla ; 4
|
||||
|
||||
jmp middle_color_done ; 3
|
||||
|
||||
middle_black:
|
||||
ldx #COLOR_BOTH_BLACK ; 2
|
||||
stx A_COLOR ; 3
|
||||
stx B_COLOR ; 3
|
||||
stx C_COLOR ; 3
|
||||
|
||||
middle_color_done:
|
||||
|
||||
; left border
|
||||
ldy #COLOR_BOTH_GREY ; 2
|
||||
sty COLOR ; 3
|
||||
|
||||
ldy #12 ; 2
|
||||
sty V2 ; 3
|
||||
ldy #12 ; 2
|
||||
|
||||
jsr hlin_double ; 6
|
||||
; 63+1*16=79
|
||||
; border space
|
||||
lda #COLOR_BOTH_BLACK ; 2
|
||||
sta COLOR ; 3
|
||||
|
||||
ldx #1 ; 2
|
||||
jsr hlin_double_continue ; 10+1*16=27
|
||||
|
||||
; A volume
|
||||
lda A_COLOR ; 3
|
||||
sta COLOR ; 3
|
||||
|
||||
ldx #3 ; 2
|
||||
jsr hlin_double_continue ; 10+3*16=58
|
||||
|
||||
; A space
|
||||
lda #COLOR_BOTH_BLACK ; 2
|
||||
sta COLOR ; 3
|
||||
|
||||
ldx #1 ; 2
|
||||
jsr hlin_double_continue ; 6
|
||||
; 10+1*16=27
|
||||
; B volume
|
||||
lda B_COLOR ; 3
|
||||
sta COLOR ; 3
|
||||
|
||||
ldx #3 ; 2
|
||||
jsr hlin_double_continue ; 6
|
||||
; 10+3*16=58
|
||||
; B space
|
||||
lda #COLOR_BOTH_BLACK ; 2
|
||||
sta COLOR ; 3
|
||||
|
||||
ldx #1 ; 2
|
||||
jsr hlin_double_continue ; 6
|
||||
; 10+1*16=27
|
||||
|
||||
; C volume
|
||||
lda C_COLOR ; 3
|
||||
sta COLOR ; 3
|
||||
|
||||
ldx #3 ; 2
|
||||
jsr hlin_double_continue ; 6
|
||||
; 10+3*16=58
|
||||
|
||||
; C space
|
||||
lda #COLOR_BOTH_BLACK ; 2
|
||||
sta COLOR ; 3
|
||||
|
||||
ldx #1 ; 2
|
||||
jsr hlin_double_continue ; 6
|
||||
; 10+1*16=27
|
||||
; Right border
|
||||
|
||||
lda #COLOR_BOTH_GREY ; 2
|
||||
sta COLOR ; 3
|
||||
|
||||
ldx #1 ; 2
|
||||
jsr hlin_double_continue ; 6
|
||||
; 10+1*16=27
|
||||
|
||||
pla ; 4
|
||||
clc ; 2
|
||||
adc #2 ; 2
|
||||
cmp #28 ; 2
|
||||
beq bottom_line ; 2nt/3
|
||||
jmp middle_loop ; 3
|
||||
|
||||
bottom_line:
|
||||
; bottom line
|
||||
|
||||
lda #COLOR_BOTH_GREY ; 2
|
||||
sta COLOR ; 3
|
||||
ldy #12 ; 2
|
||||
lda #26 ; 2
|
||||
sta V2 ; 3
|
||||
lda #28 ; 2
|
||||
jsr hlin_double ; 6
|
||||
; 63+14*16=287
|
||||
|
||||
rts ; 6
|
||||
|
||||
|
||||
|
||||
; 309+ 684*10 + 313 = roughly worst case 7462
|
251
dya/zp.inc
Normal file
251
dya/zp.inc
Normal file
@ -0,0 +1,251 @@
|
||||
.define EQU =
|
||||
|
||||
LZ4_SRC EQU $00
|
||||
LZ4_DST EQU $02
|
||||
LZ4_END EQU $04
|
||||
COUNT EQU $06
|
||||
DELTA EQU $08
|
||||
|
||||
;; Zero page monitor routines addresses
|
||||
|
||||
WNDLFT EQU $20
|
||||
WNDWDTH EQU $21
|
||||
WNDTOP EQU $22
|
||||
WNDBTM EQU $23
|
||||
CH EQU $24
|
||||
CV EQU $25
|
||||
GBASL EQU $26
|
||||
GBASH EQU $27
|
||||
BASL EQU $28
|
||||
BASH EQU $29
|
||||
H2 EQU $2C
|
||||
V2 EQU $2D
|
||||
MASK EQU $2E
|
||||
COLOR EQU $30
|
||||
;INVFLG EQU $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 EQU $60
|
||||
RWTSH EQU $61
|
||||
DOSBUFL EQU $62
|
||||
DOSBUFH EQU $63
|
||||
FILEML EQU $64
|
||||
FILEMH EQU $65
|
||||
;TURNING EQU $60
|
||||
;SCREEN_X EQU $61 ; not used?
|
||||
;SCREEN_Y EQU $62
|
||||
|
||||
|
||||
;ANGLE EQU $63
|
||||
;HORIZ_SCALE_I EQU $64
|
||||
;HORIZ_SCALE_F EQU $65
|
||||
;FACTOR_I EQU $66
|
||||
;FACTOR_F EQU $67
|
||||
;DX_I EQU $68
|
||||
;DX_F EQU $69
|
||||
;SPACEX_I EQU $6A
|
||||
;SPACEX_F EQU $6B
|
||||
;CX_I EQU $6C
|
||||
;CX_F EQU $6D
|
||||
;DY_I EQU $6E
|
||||
;DY_F EQU $6F
|
||||
|
||||
REGISTER_DUMP EQU $70
|
||||
A_FINE_TONE EQU $70
|
||||
A_COARSE_TONE EQU $71
|
||||
B_FINE_TONE EQU $72
|
||||
B_COARSE_TONE EQU $73
|
||||
C_FINE_TONE EQU $74
|
||||
C_COARSE_TONE EQU $75
|
||||
NOISE EQU $76
|
||||
ENABLE EQU $77
|
||||
A_VOLUME EQU $78
|
||||
B_VOLUME EQU $79
|
||||
C_VOLUME EQU $7A
|
||||
ENVELOPE_FINE EQU $7B
|
||||
ENVELOPE_COARSE EQU $7C
|
||||
ENVELOPE_SHAPE EQU $7D
|
||||
COPY_OFFSET EQU $7E
|
||||
DECODER_STATE EQU $7F
|
||||
;SPACEY_I EQU $70
|
||||
;SPACEY_F EQU $71
|
||||
;CY_I EQU $72
|
||||
;CY_F EQU $73
|
||||
;TEMP_I EQU $74
|
||||
;TEMP_F EQU $75
|
||||
;DISTANCE_I EQU $76
|
||||
;DISTANCE_F EQU $77
|
||||
;SPACEZ_I EQU $78
|
||||
;SPACEZ_F EQU $79
|
||||
;DRAW_SPLASH EQU $7A
|
||||
;SPEED EQU $7B
|
||||
;SPLASH_COUNT EQU $7C
|
||||
;OVER_LAND EQU $7D
|
||||
;NUM1L EQU $7E
|
||||
;NUM1H EQU $7F
|
||||
CHUNKSIZE EQU $80
|
||||
LZ4_DONE EQU $81
|
||||
DECODE_ERROR EQU $82
|
||||
|
||||
A_COLOR EQU $83
|
||||
B_COLOR EQU $84
|
||||
C_COLOR EQU $85
|
||||
COPY_TIME EQU $86
|
||||
DECOMPRESS_TIME EQU $87
|
||||
TIME_TAKEN EQU $88
|
||||
SCREEN_Y EQU $89
|
||||
WHICH_FILE EQU $8A
|
||||
;NUM2L EQU $80
|
||||
;NUM2H EQU $81
|
||||
;RESULT EQU $82 ; 83,84,85
|
||||
;NEGATE EQU $86 ; UNUSED?
|
||||
;LAST_SPACEX_I EQU $87
|
||||
;LAST_SPACEY_I EQU $88
|
||||
;LAST_MAP_COLOR EQU $89
|
||||
;DRAW_SKY EQU $8A
|
||||
COLOR_MASK EQU $8B
|
||||
RASTERBARS_ON EQU $8C
|
||||
;KEY_COUNT EQU $8C
|
||||
;KEY_OFFSET EQU $8D
|
||||
;DRAW_BLUE_SKY EQU $8E
|
||||
RANDOM_POINTER EQU $8F
|
||||
FRAME_COUNT EQU $90
|
||||
MB_VALUE EQU $91
|
||||
;MB_CHUNK EQU $92
|
||||
MB_ADDRL EQU $91
|
||||
MB_ADDRH EQU $92
|
||||
DONE_PLAYING EQU $93
|
||||
;MB_FRAME_DIFF EQU $94
|
||||
MB_CHUNK_OFFSET EQU $94
|
||||
;LZSS_RL EQU $95
|
||||
;LZSS_RH EQU $96
|
||||
;LZSS_COUNT EQU $97
|
||||
;LZSS_MASK EQU $98
|
||||
;LZSS_ENDL EQU $99
|
||||
;LZSS_ENDH EQU $9A
|
||||
;MB_FRAME_DIFF2 EQU $9F
|
||||
|
||||
; More zero-page addresses
|
||||
; we try not to conflict with anything DOS, MONITOR or BASIC related
|
||||
|
||||
;COLOR1 EQU $E0
|
||||
COLOR2 EQU $E1
|
||||
;MATCH EQU $E2
|
||||
XX EQU $E3
|
||||
;YY EQU $E4
|
||||
;SHIPY EQU $E4
|
||||
;YADD EQU $E5
|
||||
;LOOP EQU $E6
|
||||
;MEMPTRL EQU $E7
|
||||
;MEMPTRH EQU $E8
|
||||
;NAMEL EQU $E9
|
||||
;NAMEH EQU $EA
|
||||
;NAMEX EQU $EB
|
||||
;CHAR EQU $EC
|
||||
DISP_PAGE EQU $ED
|
||||
DRAW_PAGE EQU $EE
|
||||
|
||||
;FIRST EQU $F0
|
||||
LASTKEY EQU $F1
|
||||
;PADDLE_STATUS EQU $F2
|
||||
XPOS EQU $F3
|
||||
YPOS EQU $F4
|
||||
TEMP EQU $FA
|
||||
;RUN EQU $FA
|
||||
;TEMP2 EQU $FB
|
||||
TEMPY EQU $FB
|
||||
INL EQU $FC
|
||||
INH EQU $FD
|
||||
OUTL EQU $FE
|
||||
OUTH EQU $FF
|
||||
|
||||
|
||||
|
||||
KEYPRESS EQU $C000
|
||||
KEYRESET EQU $C010
|
||||
|
||||
;; SOFT SWITCHES
|
||||
CLR80COL EQU $C000 ; PAGE0/PAGE1 normal
|
||||
SET80COL EQU $C001 ; PAGE0/PAGE1 switches PAGE0 in Aux instead
|
||||
EIGHTYCOL EQU $C00D
|
||||
SPEAKER EQU $C030
|
||||
SET_GR EQU $C050
|
||||
SET_TEXT EQU $C051
|
||||
FULLGR EQU $C052
|
||||
TEXTGR EQU $C053
|
||||
PAGE0 EQU $C054
|
||||
PAGE1 EQU $C055
|
||||
LORES EQU $C056 ; Enable LORES graphics
|
||||
HIRES EQU $C057 ; Enable HIRES graphics
|
||||
AN3 EQU $C05E ; Annunciator 3
|
||||
|
||||
PADDLE_BUTTON0 EQU $C061
|
||||
PADDL0 EQU $C064
|
||||
PTRIG EQU $C070
|
||||
|
||||
;; BASIC ROUTINES
|
||||
|
||||
NORMAL EQU $F273
|
||||
|
||||
;; MONITOR ROUTINES
|
||||
|
||||
HLINE EQU $F819 ;; HLINE Y,$2C at A
|
||||
VLINE EQU $F828 ;; VLINE A,$2D at Y
|
||||
CLRSCR EQU $F832 ;; Clear low-res screen
|
||||
CLRTOP EQU $F836 ;; clear only top of low-res screen
|
||||
SETCOL EQU $F864 ;; COLOR=A
|
||||
TEXT EQU $FB36
|
||||
TABV EQU $FB5B ;; VTAB to A
|
||||
BASCALC EQU $FBC1 ;;
|
||||
VTAB EQU $FC22 ;; VTAB to CV
|
||||
HOME EQU $FC58 ;; Clear the text screen
|
||||
WAIT EQU $FCA8 ;; delay 1/2(26+27A+5A^2) us
|
||||
SETINV EQU $FE80 ;; INVERSE
|
||||
SETNORM EQU $FE84 ;; NORMAL
|
||||
COUT EQU $FDED ;; output A to screen
|
||||
COUT1 EQU $FDF0 ;; output A to screen
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
COLOR_BLACK EQU 0
|
||||
COLOR_RED EQU 1
|
||||
COLOR_DARKBLUE EQU 2
|
||||
COLOR_PURPLE EQU 3
|
||||
COLOR_DARKGREEN EQU 4
|
||||
COLOR_GREY EQU 5
|
||||
COLOR_MEDIUMBLUE EQU 6
|
||||
COLOR_LIGHTBLUE EQU 7
|
||||
COLOR_BROWN EQU 8
|
||||
COLOR_ORANGE EQU 9
|
||||
COLOR_GREY2 EQU 10
|
||||
COLOR_PINK EQU 11
|
||||
COLOR_LIGHTGREEN EQU 12
|
||||
COLOR_YELLOW EQU 13
|
||||
COLOR_AQUA EQU 14
|
||||
COLOR_WHITE EQU 15
|
||||
|
||||
COLOR_BOTH_BLACK EQU $00
|
||||
COLOR_BOTH_RED EQU $11
|
||||
COLOR_BOTH_DARKBLUE EQU $22
|
||||
COLOR_BOTH_DARKGREEN EQU $44
|
||||
COLOR_BOTH_GREY EQU $55
|
||||
COLOR_BOTH_MEDIUMBLUE EQU $66
|
||||
COLOR_BOTH_LIGHTBLUE EQU $77
|
||||
COLOR_BOTH_BROWN EQU $88
|
||||
COLOR_BOTH_ORANGE EQU $99
|
||||
COLOR_BOTH_PINK EQU $BB
|
||||
COLOR_BOTH_LIGHTGREEN EQU $CC
|
||||
COLOR_BOTH_YELLOW EQU $DD
|
||||
COLOR_BOTH_AQUA EQU $EE
|
||||
COLOR_BOTH_WHITE EQU $FF
|
||||
|
||||
AUX_BOTH_MEDIUMBLUE EQU $33 ; 0011 0011
|
||||
AUX_BOTH_GREY EQU $AA ; 1010 1010
|
Loading…
Reference in New Issue
Block a user