xmas2019: getting closer

This commit is contained in:
Vince Weaver 2019-12-20 16:47:35 -05:00
parent bca37d313b
commit 325499f6aa
9 changed files with 3730 additions and 8 deletions

View File

@ -68,4 +68,4 @@ sine_table.o: sine_table.c
####
clean:
rm -f *~ *.o *.lst FIREWORKS.BAS
rm -f *~ *.o *.lst

Binary file not shown.

2010
xmas_2019/pt3_lib_core.s Normal file

File diff suppressed because it is too large Load Diff

577
xmas_2019/pt3_lib_init.s Normal file
View File

@ -0,0 +1,577 @@
; pt3_lib_init.s
; Initialize a song
; this is done before song starts playing so it is not
; as performance / timing critical
;====================================
; pt3_init_song
;====================================
;
pt3_init_song:
lda #$0
sta DONE_SONG ; 3
ldx #(end_vars-begin_vars)
zero_song_structs_loop:
dex
sta note_a,X
bne zero_song_structs_loop
sta pt3_noise_period_smc+1 ; 4
sta pt3_noise_add_smc+1 ; 4
sta pt3_envelope_period_l_smc+1 ; 4
sta pt3_envelope_period_h_smc+1 ; 4
sta pt3_envelope_slide_l_smc+1 ; 4
sta pt3_envelope_slide_h_smc+1 ; 4
sta pt3_envelope_slide_add_l_smc+1 ; 4
sta pt3_envelope_slide_add_h_smc+1 ; 4
sta pt3_envelope_add_smc+1 ; 4
sta pt3_envelope_type_smc+1 ; 4
sta pt3_envelope_type_old_smc+1 ; ok as set_env always ; 4
sta pt3_envelope_delay_smc+1 ; 4
sta pt3_envelope_delay_orig_smc+1 ; 4
sta PT3_MIXER_VAL ; 3
sta current_pattern_smc+1 ; 4
sta current_line_smc+1 ; 4
sta current_subframe_smc+1 ; 4
lda #$f ; 2
sta note_a+NOTE_VOLUME ; 4
sta note_b+NOTE_VOLUME ; 4
sta note_c+NOTE_VOLUME ; 4
; default ornament/sample in A
; X is zero coming in here
;ldx #(NOTE_STRUCT_SIZE*0) ; 2
jsr load_ornament0_sample1 ; 6+93
; default ornament/sample in B
ldx #(NOTE_STRUCT_SIZE*1) ; 2
jsr load_ornament0_sample1 ; 6+93
; default ornament/sample in C
ldx #(NOTE_STRUCT_SIZE*2) ; 2
jsr load_ornament0_sample1 ; 6+93
;=======================
; load default speed
lda PT3_LOC+PT3_SPEED ; 4
sta pt3_speed_smc+1 ; 4
;=======================
; load loop
lda PT3_LOC+PT3_LOOP ; 4
; sta pt3_loop_smc+1 ; 4
sta sp_pt3_loop_smc+1
;========================
;========================
; set up note/freq table
; this saves some space and makes things marginally faster longrun
;========================
;========================
; note (heh) that there are separate tables if version 3.3
; but we are going to assume we are only going to be playing
; newer 3.4+ version files so only need the newer tables
ldx PT3_LOC+PT3_HEADER_FREQUENCY ; 4
beq use_freq_table_0
dex
beq use_freq_table_1
dex
beq use_freq_table_2
; fallthrough (freq table 3)
use_freq_table_3:
;=================================================
; Create Table #3, v4+, "PT3NoteTable_REAL_34_35"
;=================================================
ldy #11 ; !2
freq_table_3_copy_loop:
; note, high lookup almost same as 2v4, just need to adjust one value
lda base2_v4_high,Y ; !3
sta NoteTable_high,Y ; !3
lda base3_low,Y ; !3
sta NoteTable_low,Y ; !3
dey ; !1
bpl freq_table_3_copy_loop ; !2
dec NoteTable_high ; adjust to right value
jsr NoteTablePropogate ; !3
lda #<table3_v4_adjust
sta note_table_adjust_smc+1
lda #>table3_v4_adjust
sta note_table_adjust_smc+2
jsr NoteTableAdjust
jmp done_set_freq_table
use_freq_table_2:
;=================================================
; Create Table #2, v4+, "PT3NoteTable_ASM_34_35"
;=================================================
ldy #11
freq_table_2_copy_loop:
lda base2_v4_high,Y
sta NoteTable_high,Y
lda base2_v4_low,Y
sta NoteTable_low,Y
dey
bpl freq_table_2_copy_loop
jsr NoteTablePropogate ; !3
lda #<table2_v4_adjust
sta note_table_adjust_smc+1
lda #>table2_v4_adjust
sta note_table_adjust_smc+2
jsr NoteTableAdjust
jmp done_set_freq_table
use_freq_table_1:
;=================================================
; Create Table #1, "PT3NoteTable_ST"
;=================================================
ldy #11
freq_table_1_copy_loop:
lda base1_high,Y
sta NoteTable_high,Y
lda base1_low,Y
sta NoteTable_low,Y
dey
bpl freq_table_1_copy_loop
jsr NoteTablePropogate ; !3
; last adjustments
lda #$FD ; Tone[23]=$3FD
sta NoteTable_low+23
dec NoteTable_low+46 ; Tone[46]-=1;
jmp done_set_freq_table
use_freq_table_0:
;=================================================
; Create Table #0, "PT3NoteTable_PT_34_35"
;=================================================
ldy #11
freq_table_0_copy_loop:
lda base0_v4_high,Y
sta NoteTable_high,Y
lda base0_v4_low,Y
sta NoteTable_low,Y
dey
bpl freq_table_0_copy_loop
jsr NoteTablePropogate ; !3
lda #<table0_v4_adjust
sta note_table_adjust_smc+1
lda #>table0_v4_adjust
sta note_table_adjust_smc+2
jsr NoteTableAdjust
done_set_freq_table:
;======================
; calculate version
ldx #6 ; 2
lda PT3_LOC+PT3_VERSION ; 4
sec ; 2
sbc #'0' ; 2
cmp #9 ; 2
bcs not_ascii_number ; bge ; 2/3
tax ; 2
not_ascii_number:
; adjust version<6 SMC code in the slide code
; FIXME: I am sure there's a more clever way to do this
lda #$2C ; BIT ; 2
cpx #$6 ; 2
bcs version_greater_than_or_equal_6 ; bgt ; 3
; less than 6, jump
; also carry is known to be clear
adc #$20 ; BIT->JMP 2C->4C ; 2
version_greater_than_or_equal_6:
sta version_smc ; 4
pick_volume_table:
;=======================
; Pick which volume number, based on version
; if (PlParams.PT3.PT3_Version <= 4)
cpx #5 ; 2
; carry clear = 3.3/3.4 table
; carry set = 3.5 table
;==========================
; VolTableCreator
;==========================
; Creates the appropriate volume table
; based on z80 code by Ivan Roshin ZXAYHOBETA/VTII10bG.asm
;
; Called with carry==0 for 3.3/3.4 table
; Called with carry==1 for 3.5 table
; 177f-1932 = 435 bytes, not that much better than 512 of lookup
VolTableCreator:
; Init initial variables
lda #$0
sta z80_d_smc+1
ldy #$11
; Set up self modify
ldx #$2A ; ROL for self-modify
bcs vol_type_35
vol_type_33:
; For older table, we set initial conditions a bit
; different
dey
tya
ldx #$ea ; NOP for self modify
vol_type_35:
sty z80_l_smc+1 ; l=16 or 17
sta z80_e_smc+1 ; e=16 or 0
stx vol_smc ; set the self-modify code
ldy #16 ; skip first row, all zeros
ldx #16 ; c=16
vol_outer:
clc ; add HL,DE
z80_l_smc:
lda #$d1
z80_e_smc:
adc #$d1
sta z80_e_smc+1
lda #0
z80_d_smc:
adc #$d1
sta z80_d_smc+1 ; carry is important
; sbc hl,hl
lda #0
adc #$ff
eor #$ff
vol_write:
sta z80_h_smc+1
pha
vol_inner:
pla
pha
vol_smc:
nop ; nop or ROL depending
z80_h_smc:
lda #$d1
adc #$0 ; a=a+carry;
sta VolumeTable,Y
iny
pla ; add HL,DE
adc z80_e_smc+1
pha
lda z80_h_smc+1
adc z80_d_smc+1
sta z80_h_smc+1
inx ; inc C
txa ; a=c
and #$f
bne vol_inner
pla
lda z80_e_smc+1 ; a=e
cmp #$77
bne vol_m3
inc z80_e_smc+1
vol_m3:
txa ; a=c
bne vol_outer
vol_done:
rts
;=========================================
; copy note table seed to proper location
;=========================================
; faster inlined
;NoteTableCopy:
; ldy #11 ; !2
;note_table_copy_loop:
;ntc_smc1:
; lda base1_high,Y ; !3
; sta NoteTable_high,Y ; !3
;ntc_smc2:
; lda base1_low,Y ; !3
; sta NoteTable_low,Y ; !3
; dey ; !1
; bpl note_table_copy_loop ; !2
; rts ; !1
;==========================================
; propogate the freq down, dividing by two
;==========================================
NoteTablePropogate:
ldy #0
note_table_propogate_loop:
clc
lda NoteTable_high,Y
ror
sta NoteTable_high+12,Y
lda NoteTable_low,Y
ror
sta NoteTable_low+12,Y
iny
cpy #84
bne note_table_propogate_loop
rts
;================================================
; propogation isn't enough, various values
; are often off by one, so adjust using a bitmask
;================================================
NoteTableAdjust:
ldx #0
note_table_adjust_outer:
note_table_adjust_smc:
lda table0_v4_adjust,X
sta PT3_TEMP
; reset smc
lda #<NoteTable_low
sta ntl_smc+1
lda #>NoteTable_low
sta ntl_smc+2
ldy #7
note_table_adjust_inner:
ror PT3_TEMP
bcc note_table_skip_adjust
ntl_smc:
inc NoteTable_low,X
note_table_skip_adjust:
clc
lda #12
adc ntl_smc+1
sta ntl_smc+1
lda #0
adc ntl_smc+2 ; unnecessary if aligned
sta ntl_smc+2
skip_adjust_done:
dey
bpl note_table_adjust_inner
inx
cpx #12
bne note_table_adjust_outer
rts
;base0_v3_high:
;.byte $0C,$0B,$0A,$0A,$09,$09,$08,$08,$07,$07,$06,$06
;base0_v3_low:
;.byte $21,$73,$CE,$33,$A0,$16,$93,$18,$A4,$36,$CE,$6D
; note: same as base0_v3_high
base0_v4_high:
.byte $0C,$0B,$0A,$0A,$09,$09,$08,$08,$07,$07,$06,$06
base0_v4_low:
.byte $22,$73,$CF,$33,$A1,$17,$94,$19,$A4,$37,$CF,$6D
base1_high:
.byte $0E,$0E,$0D,$0C,$0B,$0B,$0A,$09,$09,$08,$08,$07
base1_low:
.byte $F8,$10,$60,$80,$D8,$28,$88,$F0,$60,$E0,$58,$E0
;base2_v3_high:
;.byte $0D,$0C,$0B,$0B,$0A,$09,$09,$08,$08,$07,$07,$07
;base2_v3_low:
;.byte $3E,$80,$CC,$22,$82,$EC,$5C,$D6,$58,$E0,$6E,$04
; note almost same as above
base2_v4_high:
.byte $0D,$0C,$0B,$0A,$0A,$09,$09,$08,$08,$07,$07,$06
base2_v4_low:
.byte $10,$55,$A4,$FC,$5F,$CA,$3D,$B8,$3B,$C5,$55,$EC
; note almost same as above
;base3_high:
;.byte $0C,$0C,$0B,$0A,$0A,$09,$09,$08,$08,$07,$07,$06
base3_low:
.byte $DA,$22,$73,$CF,$33,$A1,$17,$94,$19,$A4,$37,$CF
; Adjustment factors
table0_v4_adjust:
.byte $40,$e6,$9c,$66,$40,$2c,$20,$30,$48,$6c,$1c,$5a
table2_v4_adjust:
.byte $20,$a8,$40,$f8,$bc,$90,$78,$70,$74,$08,$2a,$50
table3_v4_adjust:
.byte $B4,$40,$e6,$9c,$66,$40,$2c,$20,$30,$48,$6c,$1c
; Table #1 of Pro Tracker 3.3x - 3.5x
;PT3NoteTable_ST_high:
;.byte $0E,$0E,$0D,$0C,$0B,$0B,$0A,$09
;.byte $09,$08,$08,$07,$07,$07,$06,$06
;.byte $05,$05,$05,$04,$04,$04,$04,$03
;.byte $03,$03,$03,$03,$02,$02,$02,$02
;.byte $02,$02,$02,$01,$01,$01,$01,$01
;.byte $01,$01,$01,$01,$01,$01,$01,$00
;.byte $00,$00,$00,$00,$00,$00,$00,$00
;.byte $00,$00,$00,$00,$00,$00,$00,$00
;.byte $00,$00,$00,$00,$00,$00,$00,$00
;.byte $00,$00,$00,$00,$00,$00,$00,$00
;.byte $00,$00,$00,$00,$00,$00,$00,$00
;.byte $00,$00,$00,$00,$00,$00,$00,$00
;PT3NoteTable_ST_low:
;.byte $F8,$10,$60,$80,$D8,$28,$88,$F0
;.byte $60,$E0,$58,$E0,$7C,$08,$B0,$40
;.byte $EC,$94,$44,$F8,$B0,$70,$2C,$FD
;.byte $BE,$84,$58,$20,$F6,$CA,$A2,$7C
;.byte $58,$38,$16,$F8,$DF,$C2,$AC,$90
;.byte $7B,$65,$51,$3E,$2C,$1C,$0A,$FC
;.byte $EF,$E1,$D6,$C8,$BD,$B2,$A8,$9F
;.byte $96,$8E,$85,$7E,$77,$70,$6B,$64
;.byte $5E,$59,$54,$4F,$4B,$47,$42,$3F
;.byte $3B,$38,$35,$32,$2F,$2C,$2A,$27
;.byte $25,$23,$21,$1F,$1D,$1C,$1A,$19
;.byte $17,$16,$15,$13,$12,$11,$10,$0F
; Table #2 of Pro Tracker 3.4x - 3.5x
;PT3NoteTable_ASM_34_35_high:
;.byte $0D,$0C,$0B,$0A,$0A,$09,$09,$08
;.byte $08,$07,$07,$06,$06,$06,$05,$05
;.byte $05,$04,$04,$04,$04,$03,$03,$03
;.byte $03,$03,$02,$02,$02,$02,$02,$02
;.byte $02,$01,$01,$01,$01,$01,$01,$01
;.byte $01,$01,$01,$01,$01,$00,$00,$00
;.byte $00,$00,$00,$00,$00,$00,$00,$00
;.byte $00,$00,$00,$00,$00,$00,$00,$00
;.byte $00,$00,$00,$00,$00,$00,$00,$00
;.byte $00,$00,$00,$00,$00,$00,$00,$00
;.byte $00,$00,$00,$00,$00,$00,$00,$00
;.byte $00,$00,$00,$00,$00,$00,$00,$00
;PT3NoteTable_ASM_34_35_low:
;.byte $10,$55,$A4,$FC,$5F,$CA,$3D,$B8
;.byte $3B,$C5,$55,$EC,$88,$2A,$D2,$7E
;.byte $2F,$E5,$9E,$5C,$1D,$E2,$AB,$76
;.byte $44,$15,$E9,$BF,$98,$72,$4F,$2E
;.byte $0F,$F1,$D5,$BB,$A2,$8B,$74,$60
;.byte $4C,$39,$28,$17,$07,$F9,$EB,$DD
;.byte $D1,$C5,$BA,$B0,$A6,$9D,$94,$8C
;.byte $84,$7C,$75,$6F,$69,$63,$5D,$58
;.byte $53,$4E,$4A,$46,$42,$3E,$3B,$37
;.byte $34,$31,$2F,$2C,$29,$27,$25,$23
;.byte $21,$1F,$1D,$1C,$1A,$19,$17,$16
;.byte $15,$14,$12,$11,$10,$0F,$0E,$0D
;PT3VolumeTable_33_34:
;.byte $0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0
;.byte $0,$0,$0,$0,$0,$0,$0,$0,$1,$1,$1,$1,$1,$1,$1,$1
;.byte $0,$0,$0,$0,$0,$0,$1,$1,$1,$1,$1,$2,$2,$2,$2,$2
;.byte $0,$0,$0,$0,$1,$1,$1,$1,$2,$2,$2,$2,$3,$3,$3,$3
;.byte $0,$0,$0,$0,$1,$1,$1,$2,$2,$2,$3,$3,$3,$4,$4,$4
;.byte $0,$0,$0,$1,$1,$1,$2,$2,$3,$3,$3,$4,$4,$4,$5,$5
;.byte $0,$0,$0,$1,$1,$2,$2,$3,$3,$3,$4,$4,$5,$5,$6,$6
;.byte $0,$0,$1,$1,$2,$2,$3,$3,$4,$4,$5,$5,$6,$6,$7,$7
;.byte $0,$0,$1,$1,$2,$2,$3,$3,$4,$5,$5,$6,$6,$7,$7,$8
;.byte $0,$0,$1,$1,$2,$3,$3,$4,$5,$5,$6,$6,$7,$8,$8,$9
;.byte $0,$0,$1,$2,$2,$3,$4,$4,$5,$6,$6,$7,$8,$8,$9,$A
;.byte $0,$0,$1,$2,$3,$3,$4,$5,$6,$6,$7,$8,$9,$9,$A,$B
;.byte $0,$0,$1,$2,$3,$4,$4,$5,$6,$7,$8,$8,$9,$A,$B,$C
;.byte $0,$0,$1,$2,$3,$4,$5,$6,$7,$7,$8,$9,$A,$B,$C,$D
;.byte $0,$0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$A,$B,$C,$D,$E
;.byte $0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$A,$B,$C,$D,$E,$F
;PT3VolumeTable_35:
;.byte $0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0
;.byte $0,$0,$0,$0,$0,$0,$0,$0,$1,$1,$1,$1,$1,$1,$1,$1
;.byte $0,$0,$0,$0,$1,$1,$1,$1,$1,$1,$1,$1,$2,$2,$2,$2
;.byte $0,$0,$0,$1,$1,$1,$1,$1,$2,$2,$2,$2,$2,$3,$3,$3
;.byte $0,$0,$1,$1,$1,$1,$2,$2,$2,$2,$3,$3,$3,$3,$4,$4
;.byte $0,$0,$1,$1,$1,$2,$2,$2,$3,$3,$3,$4,$4,$4,$5,$5
;.byte $0,$0,$1,$1,$2,$2,$2,$3,$3,$4,$4,$4,$5,$5,$6,$6
;.byte $0,$0,$1,$1,$2,$2,$3,$3,$4,$4,$5,$5,$6,$6,$7,$7
;.byte $0,$1,$1,$2,$2,$3,$3,$4,$4,$5,$5,$6,$6,$7,$7,$8
;.byte $0,$1,$1,$2,$2,$3,$4,$4,$5,$5,$6,$7,$7,$8,$8,$9
;.byte $0,$1,$1,$2,$3,$3,$4,$5,$5,$6,$7,$7,$8,$9,$9,$A
;.byte $0,$1,$1,$2,$3,$4,$4,$5,$6,$7,$7,$8,$9,$A,$A,$B
;.byte $0,$1,$2,$2,$3,$4,$5,$6,$6,$7,$8,$9,$A,$A,$B,$C
;.byte $0,$1,$2,$3,$3,$4,$5,$6,$7,$8,$9,$A,$A,$B,$C,$D
;.byte $0,$1,$2,$3,$4,$5,$6,$7,$7,$8,$9,$A,$B,$C,$D,$E
;.byte $0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$A,$B,$C,$D,$E,$F

View File

@ -0,0 +1,403 @@
; Mockingboad programming:
; + Has two 6522 I/O chips connected to two AY-3-8910 chips
; + Optionally has some speech chips controlled via the outport on the AY
; + Often in slot 4
; TODO: how to auto-detect?
; References used:
; http://macgui.com/usenet/?group=2&id=8366
; 6522 Data Sheet
; AY-3-8910 Data Sheet
;========================
; Mockingboard card
; Essentially two 6522s hooked to the Apple II bus
; Connected to AY-3-8910 chips
; PA0-PA7 on 6522 connected to DA0-DA7 on AY
; PB0 on 6522 connected to BC1
; PB1 on 6522 connected to BDIR
; PB2 on 6522 connected to RESET
; left speaker
MOCK_6522_ORB1 = $C400 ; 6522 #1 port b data
MOCK_6522_ORA1 = $C401 ; 6522 #1 port a data
MOCK_6522_DDRB1 = $C402 ; 6522 #1 data direction port B
MOCK_6522_DDRA1 = $C403 ; 6522 #1 data direction port A
; right speaker
MOCK_6522_ORB2 = $C480 ; 6522 #2 port b data
MOCK_6522_ORA2 = $C481 ; 6522 #2 port a data
MOCK_6522_DDRB2 = $C482 ; 6522 #2 data direction port B
MOCK_6522_DDRA2 = $C483 ; 6522 #2 data direction port A
; AY-3-8910 commands on port B
; RESET BDIR BC1
MOCK_AY_RESET = $0 ; 0 0 0
MOCK_AY_INACTIVE = $4 ; 1 0 0
MOCK_AY_READ = $5 ; 1 0 1
MOCK_AY_WRITE = $6 ; 1 1 0
MOCK_AY_LATCH_ADDR = $7 ; 1 1 1
;========================
; Mockingboard Init
;========================
; Initialize the 6522s
; set the data direction for all pins of PortA/PortB to be output
mockingboard_init:
lda #$ff ; all output (1)
sta MOCK_6522_DDRB1
sta MOCK_6522_DDRA1
sta MOCK_6522_DDRB2
sta MOCK_6522_DDRA2
rts
;======================
; Reset Left AY-3-8910
;======================
reset_ay_both:
lda #MOCK_AY_RESET
sta MOCK_6522_ORB1
lda #MOCK_AY_INACTIVE
sta MOCK_6522_ORB1
;======================
; Reset Right AY-3-8910
;======================
;reset_ay_right:
;could be merged with both
lda #MOCK_AY_RESET
sta MOCK_6522_ORB2
lda #MOCK_AY_INACTIVE
sta MOCK_6522_ORB2
rts
; Write sequence
; Inactive -> Latch Address -> Inactive -> Write Data -> Inactive
;=========================================
; Write Right/Left to save value AY-3-8910
;=========================================
; register in X
; value in MB_VALUE
write_ay_both:
; 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 on PB1 ; 2
sta MOCK_6522_ORB1 ; latch_address on PB1 ; 4
sta MOCK_6522_ORB2 ; latch_address on PB2 ; 4
ldy #MOCK_AY_INACTIVE ; go inactive ; 2
sty MOCK_6522_ORB1 ; 4
sty MOCK_6522_ORB2 ; 4
;===========
; 28
; value
lda MB_VALUE ; 3
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
sty MOCK_6522_ORB1 ; 4
sty MOCK_6522_ORB2 ; 4
;===========
; 29
rts ; 6
;===========
; 63
write_ay_both_end:
.assert >write_ay_both = >write_ay_both_end, error, "write_ay_both crosses page"
;=======================================
; clear ay -- clear all 14 AY registers
; should silence the card
;=======================================
; 7+(74*14)+5=1048
clear_ay_both:
ldx #13 ; 2
lda #0 ; 2
sta MB_VALUE ; 3
clear_ay_left_loop:
jsr write_ay_both ; 6+63
dex ; 2
bpl clear_ay_left_loop ; 3
; -1
rts ; 6
clear_ay_end:
.assert >clear_ay_both = >clear_ay_end, error, "clea_ay_both crosses page"
;=======================================
; Detect a Mockingboard card
;=======================================
; Based on code from the French Touch "Pure Noise" Demo
; Attempts to time an instruction sequence with a 6522
;
; If found, puts in bMB
; MB_ADDRL:MB_ADDRH has address of Mockingboard
; returns X=0 if not found, X=1 if found
mockingboard_detect:
lda #0
sta MB_ADDRL
mb_detect_loop: ; self-modifying
lda #$07 ; we start in slot 7 ($C7) and go down to 0 ($C0)
ora #$C0 ; make it start with C
sta MB_ADDRH
ldy #04 ; $CX04
ldx #02 ; 2 tries?
mb_check_cycle_loop:
lda (MB_ADDRL),Y ; timer 6522 (Low Order Counter)
; count down
sta PT3_TEMP ; 3 cycles
lda (MB_ADDRL),Y ; + 5 cycles = 8 cycles
; between the two accesses to the timer
sec
sbc PT3_TEMP ; subtract to see if we had 8 cycles
cmp #$f8 ; -8
bne mb_not_in_this_slot
dex ; decrement, try one more time
bne mb_check_cycle_loop ; loop detection
inx ; Mockingboard found (X=1)
done_mb_detect:
;stx bMB ; store result to bMB
rts ; return
mb_not_in_this_slot:
dec mb_detect_loop+1 ; decrement the "slot" (self_modify)
bne mb_detect_loop ; loop down to one
ldx #00
beq done_mb_detect
;alternative MB detection from Nox Archaist
; lda #$04
; sta MB_ADDRL
; ldx #$c7
;
;find_mb:
; stx MB_ADDRH
;
; ;detect sound I
;
; sec
; ldy #$00
; lda (MB_ADDRL), y
; sbc (MB_ADDRL), y
; cmp #$05
; beq found_mb
; dex
; cpx #$c0
; bne find_mb
; ldx #$00 ;no mockingboard found
; rts
;
;found_mb:
; ldx #$01 ;mockingboard found
; rts
;
; ;optionally detect sound II
;
; sec
; ldy #$80
; lda (MB_ADDRL), y
; sbc (MB_ADDRL), y
; cmp #$05
; beq found_mb
;=======================================
; Detect a Mockingboard card in Slot4
;=======================================
; Based on code from the French Touch "Pure Noise" Demo
; Attempts to time an instruction sequence with a 6522
;
; MB_ADDRL:MB_ADDRH has address of Mockingboard
; returns X=0 if not found, X=1 if found
mockingboard_detect_slot4:
lda #0
sta MB_ADDRL
mb4_detect_loop: ; self-modifying
lda #$04 ; we're only looking in Slot 4
ora #$C0 ; make it start with C
sta MB_ADDRH
ldy #04 ; $CX04
ldx #02 ; 2 tries?
mb4_check_cycle_loop:
lda (MB_ADDRL),Y ; timer 6522 (Low Order Counter)
; count down
sta PT3_TEMP ; 3 cycles
lda (MB_ADDRL),Y ; + 5 cycles = 8 cycles
; between the two accesses to the timer
sec
sbc PT3_TEMP ; subtract to see if we had 8 cycles
cmp #$f8 ; -8
bne mb4_not_in_this_slot
dex ; decrement, try one more time
bne mb4_check_cycle_loop ; loop detection
inx ; Mockingboard found (X=1)
done_mb4_detect:
rts ; return
mb4_not_in_this_slot:
ldx #00
beq done_mb4_detect
;=============================
; Setup
;=============================
.if 0
pt3_setup_interrupt:
;===========================
; Check for Apple IIc
;===========================
; it does interrupts differently
lda $FBB3 ; IIe and newer is $06
cmp #6
beq apple_iie_or_newer
jmp done_apple_detect
apple_iie_or_newer:
lda $FBC0 ; 0 on a IIc
bne done_apple_detect
apple_iic:
; activate IIc mockingboard?
; this might only be necessary to allow detection
; I get the impression the Mockingboard 4c activates
; when you access any of the 6522 ports in Slot 4
lda #$ff
sta $C403
sta $C404
; bypass the firmware interrupt handler
; should we do this on IIe too? probably faster
done_apple_detect:
sei ; disable interrupts
lda $c08b ; disable ROM (enable language card)
lda $c08b
lda #<interrupt_handler
sta $fffe
lda #>interrupt_handler
sta $ffff
lda #$EA ; nop out the "lda $45" in the irq hand
sta interrupt_smc
sta interrupt_smc+1
;=========================
; 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 60Hz clock on 6522
;============================
; yes this is horrible for PT3 files
; but in our case we are matching the screen refresh
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 #$1A
sta $C404 ; write into low-order latch
lda #$41
sta $C405 ; write into high-order latch,
; load both values into counter
; clear interrupt and start counting
; 9c40 / 1e6 = .040s, 25Hz
; 4fe7 / 1e6 = .020s, 50Hz
; 411a / 1e6 = .016s, 60Hz
rts
.endif
;==================================
; Print mockingboard detect message
;==================================
; note: on IIc must do this before enabling interrupt
; as we disable ROM (COUT won't work?)
print_mockingboard_detect:
; print detection message
; ldy #0
;print_mocking_message:
; lda mocking_message,Y ; load loading message
; beq done_mocking_message
; ora #$80
; jsr COUT
; iny
; jmp print_mocking_message
;done_mocking_message:
; jsr CROUT1
rts
print_mocking_notfound:
; ldy #0
;print_not_message:
; lda not_message,Y ; load loading message
; beq print_not_message_done
; ora #$80
; jsr COUT
; iny
; jmp print_not_message
;print_not_message_done:
rts
print_mocking_found:
; ldy #0
;print_found_message:
; lda found_message,Y ; load loading message
; beq done_found_message
; ora #$80
; jsr COUT
; iny
; jmp print_found_message
done_found_message:
rts
;=========
; strings
;=========
;mocking_message: .asciiz "LOOKING FOR MOCKINGBOARD IN SLOT #4"
;not_message: .byte "NOT "
;found_message: .asciiz "FOUND"

View File

@ -0,0 +1,302 @@
; ZZ points to offset from pointer
;D000 ;0 $9000,$9100,$9200 = A Low (reg0)
;D100 ;1 $9300,$9400,$9500 = A high (reg1) [top], B high (reg3) [bottom]
;D200 ;2 $9600,$9700,$9800 = B Low (reg2)
;D300 ;3 $9900,$9A00,$9B00 = C Low (reg4)
;D400 ;4 $9C00,$9D00,$9E00 = Envelope Shape (r13) [top], C high (reg5) [bot]
;D500 ;5 $9F00,$A000,$A100 = Noise (r6), bit7 = don't change envelope
;D600 ;6 $A200,$A300,$A400 = Enable (r7)
;D700 ;7 $A500,$A600,$A700 = A amp (r8), bit 5 of r8,r9,r10
;D800 ;8 $A800,$A900,$AA00 = C amp (r10) [top], B amp (r9) [bottom]
;D900 ;9 $AB00,$AC00,$AD00 = ENV low (r11)
;DA00 ;a $AE00,$AF00,$B000 = ENV high (r12)
; 3+ 72 + 72 + 83 + 74 + 72 + 77 + 19 + 70 + 74 + 72 +
; 77 + 18 + 82 + 85 + 72 + 72 + 10 + 127 + 6 = 1237 /////1180
play_frame_compressed:
ldy FRAME_PLAY_OFFSET ; 3
; Register 0: A fine
ldx #0 ; 2
r0_smc:
lda $D000,Y ; 4+
jsr play_mb_write ; 6+60
;======
; 72
; Register 2: B fine
ldx #2 ; 2
r2_smc:
lda $D200,Y ; 4+
jsr play_mb_write ; 6+60
;======
; 72
; Register 1: A coarse
ldx #1 ; 2
r1_smc:
lda $D100,Y ; 4+
pha ; 3
lsr ; 2
lsr ; 2
lsr ; 2
lsr ; 2
jsr play_mb_write ; 6+60
;======
; 83
; Register 3: B low
ldx #3 ; 2
pla ; 4
and #$f ; 2
jsr play_mb_write ; 6+60
;======
; 74
; Register 4: C fine
ldx #4 ; 2
r4_smc:
lda $D300,Y ; 4+
jsr play_mb_write ; 6+60
;=======
; 72
; Register 5: C coarse
ldx #5 ; 2
r13_smc:
lda $D400,Y ; 4+
pha ; 3
and #$f ; 2
jsr play_mb_write ; 6+60
;========
; 77
; Register 13: E type
pla ; 4
lsr ; 2
lsr ; 2
lsr ; 2
lsr ; 2
r5_smc:
ldx $D500,Y ; check for env update ; 4
bmi skip_envelope_write ; 3
;============
; 19
; -1
ldx #13 ; 2
jsr play_mb_write ; 6+60
jmp done_envelope_write ; 3
;=====
; 70
skip_envelope_write:
; KILL CYCLES... Need to kill 70
; delay 25+a (so 70-2-25=43)
lda #43 ; 2
jsr delay_a ; 25+43
;======
; 70
done_envelope_write:
; Register 6: Noise
ldx #6 ; 2
r6_smc:
lda $D500,Y ; 4+
and #$1f ; 2
jsr play_mb_write ; 6+60
;=======
; 74
; Register 7: Enable
ldx #7 ; 2
r7_smc:
lda $D600,Y ; 4+
jsr play_mb_write ; 6+60
;========
; 72
; Register 8: a-amp
ldx #8 ; 2
r8_smc:
lda $D700,Y ; 4+
pha ; 3
and #$1f ; 2
jsr play_mb_write ; 6+60
;=======
; 77
pla ; 4
and #$e0 ; 2
lsr ; 2
sta AY_WRITE_TEMP ; 3
lsr ; 2
and #$10 ; 2
sta AY_WRITE_TEMP2 ; 3
;====
; 18
; Register 9: b-amp (bottom)
ldx #9 ; 2
r9_smc:
lda $D800,Y ; 4+
pha ; 3
and #$f ; 2
ora AY_WRITE_TEMP ; 3
and #$1f ; 2
jsr play_mb_write ; 6+60
;=======
; 82
; Register 10: c-amp (top)
ldx #10 ; 2
pla ; 4
lsr ; 2
lsr ; 2
lsr ; 2
lsr ; 2
ora AY_WRITE_TEMP2 ; 3
and #$1f ; 2
jsr play_mb_write ; 6+60
;======
; 85
; Register 11: E fine
ldx #11 ; 2
r11_smc:
lda $D900,Y ; 4+
jsr play_mb_write ; 6+60
;======
; 72
; Register 12: E coarse
ldx #12 ; 2
r12_smc:
lda $DA00,Y ; 4+
jsr play_mb_write ; 6+60
;======
; 72
; incrememnt offset
; wrap to next
iny ; 2
sty FRAME_PLAY_OFFSET ; 3
cpy #63*4 ; FIXME: song specific ; 2
beq frame_wrap ; 3
;==========
; 10
no_frame_wrap:
; -1
; delay 127+1-3=125
lda #98 ; 2
jsr delay_a ; 125-2-25=98
jmp done_frame_wrap ; 3
frame_wrap:
lda #0 ; 2
sta FRAME_PLAY_OFFSET ; 3
inc FRAME_PLAY_PAGE ; 5
jsr update_pt3_play ; 6+111
;=====
; 127
done_frame_wrap:
rts ; 6
;========================
; 28+26+6= 60
; trashes A,X
play_mb_write:
; address
stx MOCK_6522_ORA1 ; put address on PA1 ; 4
stx MOCK_6522_ORA2 ; put address on PA2 ; 4
ldx #MOCK_AY_LATCH_ADDR ; latch_address for PB1 ; 2
stx MOCK_6522_ORB1 ; latch_address on PB1 ; 4
stx MOCK_6522_ORB2 ; latch_address on PB2 ; 4
ldx #MOCK_AY_INACTIVE ; go inactive ; 2
stx MOCK_6522_ORB1 ; 4
stx MOCK_6522_ORB2 ; 4
;===========
; 28
; value
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
stx MOCK_6522_ORB1 ; 4
stx MOCK_6522_ORB2 ; 4
;===========
; 26
rts ; 6
;===========================
; update the SMC counters
; 13+92+6=111
update_pt3_play:
lda FRAME_PLAY_PAGE ; 3
asl ; 2
asl ; 2
asl ; 2
asl ; 2
tay ; 2
;===
; 13
lda music_addr_table+0,Y ; 4
sta r0_smc+2 ; 4 ; D0
lda music_addr_table+1,Y ; 4
sta r1_smc+2 ; 4 ; D1
lda music_addr_table+2,Y ; 4
sta r2_smc+2 ; 4 ; D2
lda music_addr_table+3,Y ; 4
sta r4_smc+2 ; 4 ; D3
lda music_addr_table+4,Y ; 4
sta r13_smc+2 ; 4 ; D4
lda music_addr_table+5,Y ; 4
sta r5_smc+2 ; 4 ; D5
sta r6_smc+2 ; 4 ; D5
lda music_addr_table+6,Y ; 4 ; D6
sta r7_smc+2 ; 4
lda music_addr_table+7,Y ; 4 ; D7
sta r8_smc+2 ; 4
lda music_addr_table+8,Y ; 4 ; D8
sta r9_smc+2 ; 4
lda music_addr_table+9,Y ; 4 ; D9
sta r11_smc+2 ; 4
lda music_addr_table+10,Y ; 4 ; DA
sta r12_smc+2 ; 4
;==========
; 11*8+4 = 92
rts ; 6

View File

@ -0,0 +1,156 @@
; ZZ points to offset from pointer
;D0 F1 ;0 $9000,$9100,$9200 = A Low (reg0)
;D1 F2 ;1 $9300,$9400,$9500 = A high (reg1) [top], B high (reg3) [bottom]
;D2 F3 ;2 $9600,$9700,$9800 = B Low (reg2)
;D3 F4 ;3 $9900,$9A00,$9B00 = C Low (reg4)
;D4 F5 ;4 $9C00,$9D00,$9E00 = Envelope Shape (r13) [top], C high (reg5) [bot]
;D5 F6 ;5 $9F00,$A000,$A100 = Noise (r6), bit7 = don't change envelope
;D6 F7 ;6 $A200,$A300,$A400 = Enable (r7)
;D7 F8 ;7 $A500,$A600,$A700 = A amp (r8), bit 5 of r8,r9,r10
;D8 F9 ;8 $A800,$A900,$AA00 = C amp (r10) [top], B amp (r9) [bottom]
;D9 FA ;9 $AB00,$AC00,$AD00 = ENV low (r11)
;DA FB ;a $AE00,$AF00,$B000 = ENV high (r12)
pt3_write_frame:
ldy FRAME_OFFSET ; 3
;=====================
; Register 0: A fine
lda A_FINE_TONE
r0_wrsmc:
sta $D000,Y
;==========================
; Register 1/3: A/B coarse
lda A_COARSE_TONE
asl
asl
asl
asl
ora B_COARSE_TONE
r1_wrsmc:
sta $D100,Y
;====================
; Register 2: B fine
lda B_FINE_TONE
r2_wrsmc:
sta $D200,Y
;====================
; Register 3: B coarse already done
;=============================
; Register 4: C fine
lda C_FINE_TONE
r4_wrsmc:
sta $D300,Y
;=======================================
; Register 5: Envelope Shape [top] / C coarse [bottom]
lda C_COARSE_TONE
and #$f
sta C_COARSE_TEMP
lda ENVELOPE_SHAPE
cmp #$ff
beq no_envelope
yes_envelope:
lda ENVELOPE_SHAPE
asl
asl
asl
asl
ora C_COARSE_TEMP
sta C_COARSE_TEMP
lda #0
jmp done_envelope
no_envelope:
lda #$80
done_envelope:
sta ENV_SHAPE_TEMP
lda C_COARSE_TEMP
r13_wrsmc:
sta $D400,Y
;=====================
; Register 6: Noise
lda NOISE
and #$1f
ora ENV_SHAPE_TEMP
r6_wrsmc:
sta $D500,Y
;=====================
; Register 7: Enable
lda ENABLE
r7_wrsmc:
sta $D600,Y
;=====================
; Register 8: a-amp
lda A_VOLUME
and #$1f
sta A_VOL_TEMP
lda B_VOLUME
and #$10
asl
ora A_VOL_TEMP
sta A_VOL_TEMP
lda C_VOLUME
and #$10
asl
asl
ora A_VOL_TEMP
r8_wrsmc:
sta $D700,Y
;============================
; Register 9/10: b-amp (bottom) , c-amp (top)
lda B_VOLUME
and #$f
sta A_VOL_TEMP
lda C_VOLUME
asl
asl
asl
asl
ora A_VOL_TEMP
r9_wrsmc:
sta $D800,Y
;=====================
; Register 10: c-amp already handled
;=====================
; Register 11: E fine
lda ENVELOPE_FINE
r11_wrsmc:
sta $D900,Y
;=======================
; Register 12: E coarse
lda ENVELOPE_COARSE
r12_wrsmc:
sta $DA00,Y
;=============================
; Register 13: already handled
rts ; 6

View File

@ -0,0 +1,158 @@
;====================================
; generate 4 patterns worth of music
; at address $7000-$FC00
pt3_write_lc_4:
; page offset
lda #0
sta FRAME_PAGE
lc4_frame_decode_loop:
jsr pt3_set_pages
jsr pt3_write_lc
lda FRAME_PAGE
cmp #8
bne lc4_frame_decode_loop
rts
pt3_write_lc_9:
; page offset
lda #0
sta FRAME_PAGE
lc9_frame_decode_loop:
jsr pt3_set_pages
jsr pt3_write_lc
lda FRAME_PAGE
cmp #9
bne lc9_frame_decode_loop
rts
;==============================
; write one page of frame data
pt3_write_lc_1:
; page offset
lda #0
sta FRAME_PAGE
jsr pt3_set_pages
jsr pt3_write_lc
rts
;==============================
; write one page of frame data
pt3_write_lc:
; offset within page
lda #0
sta FRAME_OFFSET
lc_frame_decode_loop:
jsr pt3_make_frame
jsr pt3_write_frame
inc FRAME_OFFSET
lda SOUND_WHILE_DECODE
beq no_play_music
lda FRAME_OFFSET
and #$7
bne no_play_music
jsr play_frame_compressed
no_play_music:
lda FRAME_OFFSET
cmp #63*4 ; FIXME: make this depend on song
; hardcoding for 63 for our song
bne lc_frame_decode_loop
inc FRAME_PAGE
rts
;========================
;
pt3_set_pages:
lda FRAME_PAGE
asl
asl
asl
asl
tay
lda music_addr_table+0,Y
sta r0_wrsmc+2
lda music_addr_table+1,Y
sta r1_wrsmc+2
lda music_addr_table+2,Y
sta r2_wrsmc+2
lda music_addr_table+3,Y
sta r4_wrsmc+2
lda music_addr_table+4,Y ;5+13=D4
sta r13_wrsmc+2
lda music_addr_table+5,Y
sta r6_wrsmc+2
lda music_addr_table+6,Y
sta r7_wrsmc+2
lda music_addr_table+7,Y
sta r8_wrsmc+2
lda music_addr_table+8,Y
sta r9_wrsmc+2
lda music_addr_table+9,Y
sta r11_wrsmc+2
lda music_addr_table+10,Y
sta r12_wrsmc+2
rts
.align $100
music_table_begin:
music_addr_table:
.byte $91,$92,$93,$94,$95,$96,$97,$98,$99,$9a,$9b,$BB,$CC,$DD,$EE,$FF ;0
.byte $86,$87,$88,$89,$8a,$8b,$8c,$8d,$8e,$8f,$90,$BB,$CC,$DD,$EE,$FF ;1
.byte $7b,$7c,$7d,$7e,$7f,$80,$81,$82,$83,$84,$85,$BB,$CC,$DD,$EE,$FF ;2
.byte $70,$71,$72,$73,$74,$75,$76,$77,$78,$79,$7a,$BB,$CC,$DD,$EE,$FF ;3
.byte $bd,$be,$bf,$10,$11,$12,$13,$14,$15,$16,$17,$BB,$CC,$DD,$EE,$FF ;4
.byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9,$ba,$bb,$bc,$BB,$CC,$DD,$EE,$FF ;5
.byte $a7,$a8,$a9,$aa,$ab,$ac,$ad,$ae,$af,$b0,$b1,$BB,$CC,$DD,$EE,$FF ;6
.byte $9c,$9d,$9e,$9f,$a0,$A1,$a2,$a3,$a4,$a5,$a6,$BB,$CC,$DD,$EE,$FF ;7
;.byte $40,$41,$42,$43,$44,$45,$46,$47,$48,$49,$4A,$BB,$CC,$DD,$EE,$FF ;8
;.byte $35,$36,$37,$38,$39,$3A,$3B,$3C,$3D,$3E,$3F,$BB,$CC,$DD,$EE,$FF ;9
;.byte $d0,$d1,$d2,$d3,$d4,$d5,$d6,$d7,$d8,$d9,$da,$BB,$CC,$DD,$EE,$FF
music_table_end:
.assert >music_table_begin = >music_table_end, error, "music_table crosses page"

View File

@ -18,6 +18,51 @@ BASH = $29
SEEDL = $4E
SEEDH = $4F
FRAME_PLAY_OFFSET=$56
FRAME_PLAY_PAGE = $57
AY_REGISTERS = $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
PT3_MIXER_VAL = $77
A_VOLUME = $78
B_VOLUME = $79
C_VOLUME = $7A
ENVELOPE_FINE = $7B
ENVELOPE_COARSE = $7C
ENVELOPE_SHAPE = $7D
PATTERN_L = $7E
PATTERN_H = $7F
ORNAMENT_L = $80
ORNAMENT_H = $81
SAMPLE_L = $82
SAMPLE_H = $83
LOOP = $84
MB_VALUE = $85
MB_ADDRL = $86
MB_ADDRH = $87
DONE_PLAYING = $88
DONE_SONG = $89
PT3_TEMP = $8A
ENV_SHAPE_TEMP = $8B
C_COARSE_TEMP = $8C
A_VOL_TEMP = $8D
WASTE_CYCLES = $C6
FOREVER_OFFSET = $C7
FRAME_OFFSET = $C8
FRAME_PAGE = $C9
AY_WRITE_TEMP = $CA
AY_WRITE_TEMP2 = $CB
HGR_COLOR = $E4
DRAW_PAGE = $EE
SNOWX = $F0
@ -28,6 +73,8 @@ WHICH_Y = $F4
FRAME = $F5
TEMPY = $F6
TEMP = $F7
SOUND_WHILE_DECODE = $F8
HGR = $F3E2
@ -52,6 +99,34 @@ TREESIZE = 12
bit LORES
bit PAGE0
;=========================
; set up sound
;=========================
lda #0
sta DONE_PLAYING
sta FRAME_PLAY_OFFSET
sta FRAME_PLAY_PAGE
sta FRAME_OFFSET
sta FRAME_PAGE
sta SOUND_WHILE_DECODE
jsr update_pt3_play
jsr pt3_set_pages
jsr mockingboard_init
jsr reset_ay_both
jsr clear_ay_both
jsr pt3_init_song
lda #1
sta LOOP
;====================================
; generate 4 patterns worth of music
; at address $7000-$9C00
jsr pt3_write_lc_4
;==================================
; init snow
;==================================
@ -480,6 +555,36 @@ ll_smc4:
music_snow:
; play music
jsr play_frame_compressed ; 6+1237
; lda #107
; jsr delay_a
lda FRAME_PLAY_PAGE ; 3
cmp #8 ; 2
beq wrap_play ; 3
;===========
; 8
; -1
lda #98 ; 2
jsr delay_a ; 123
jmp no_problem ; 3
;=============
; 127
wrap_play:
lda #0 ; 2
sta FRAME_PLAY_OFFSET ; 3
lda #3 ; 2
sta FRAME_PLAY_PAGE ; 3
jsr update_pt3_play ; 6+111
;=======
; 127
no_problem:
; 0 4 8 c 10 14 18 1c
; 0 1 2 3 4 5 6 7
@ -688,15 +793,15 @@ draw_loop:
;-1161 move
; -971 draw
; -3 jump at end
;-1243 music
; -135 wrap
;======
; 1545
; 167
; Try X=153 Y=2 cycles=1543R2
; Try X=32 Y=1 cycles=167
nop
ldy #2 ; 2
dloop1: ldx #153 ; 2
ldy #1 ; 2
dloop1: ldx #32 ; 2
dloop2: dex ; 2
bne dloop2 ; 2nt/3
dey ; 2
@ -805,5 +910,16 @@ pixel_lookup:
; include music
; Music player
.include "pt3_lib_core.s"
.include "pt3_lib_init.s"
.include "pt3_lib_mockingboard.s"
.include "pt3_lib_play_frame.s"
.include "pt3_lib_write_frame.s"
.include "pt3_lib_write_lc.s"
.align $100
.incbin "./music/jingle.pt3"
PT3_LOC = song
song:
.incbin "./music/jingle_fast.pt3"