mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-02-07 05:30:55 +00:00
Revert "still more"
This reverts commit 9491bce9f420c77085d9366f15e75c540b381e02.
This commit is contained in:
parent
df10cec9f7
commit
2694e6efca
@ -4,6 +4,7 @@ clear_screens:
|
|||||||
;===================================
|
;===================================
|
||||||
|
|
||||||
lda #$0
|
lda #$0
|
||||||
|
sta DRAW_PAGE
|
||||||
jsr clear_top
|
jsr clear_top
|
||||||
jsr clear_bottom
|
jsr clear_bottom
|
||||||
|
|
||||||
@ -12,6 +13,7 @@ clear_screens:
|
|||||||
;===================================
|
;===================================
|
||||||
|
|
||||||
lda #$4
|
lda #$4
|
||||||
|
sta DRAW_PAGE
|
||||||
jsr clear_top
|
jsr clear_top
|
||||||
jmp clear_bottom
|
jmp clear_bottom
|
||||||
|
|
||||||
@ -27,12 +29,11 @@ clear_screens:
|
|||||||
; (pageX,40rows): 50*120+4+6 = 6010 = 6.0ms 166Hz
|
; (pageX,40rows): 50*120+4+6 = 6010 = 6.0ms 166Hz
|
||||||
; 50*120+4+6+37 = 6055 = 6.0ms 166Hz
|
; 50*120+4+6+37 = 6055 = 6.0ms 166Hz
|
||||||
clear_top:
|
clear_top:
|
||||||
ldy #0 ; 2
|
lda #0 ; 2
|
||||||
|
clear_top_a:
|
||||||
clear_top_y:
|
sta COLOR ; 3
|
||||||
sty COLOR ; 3
|
|
||||||
sta DRAW_PAGE ; 3
|
|
||||||
clc ; 2
|
clc ; 2
|
||||||
|
lda DRAW_PAGE ; 3
|
||||||
|
|
||||||
adc #4 ; 2
|
adc #4 ; 2
|
||||||
sta __ctf+2 ; 3
|
sta __ctf+2 ; 3
|
||||||
@ -79,6 +80,7 @@ clear_bottoms:
|
|||||||
;===================================
|
;===================================
|
||||||
|
|
||||||
lda #$0
|
lda #$0
|
||||||
|
sta DRAW_PAGE
|
||||||
jsr clear_bottom
|
jsr clear_bottom
|
||||||
|
|
||||||
;===================================
|
;===================================
|
||||||
@ -86,6 +88,7 @@ clear_bottoms:
|
|||||||
;===================================
|
;===================================
|
||||||
|
|
||||||
lda #$4
|
lda #$4
|
||||||
|
sta DRAW_PAGE
|
||||||
; fall through
|
; fall through
|
||||||
|
|
||||||
;=========================================================
|
;=========================================================
|
||||||
@ -94,8 +97,8 @@ clear_bottoms:
|
|||||||
; clear bottom of draw page
|
; clear bottom of draw page
|
||||||
|
|
||||||
clear_bottom:
|
clear_bottom:
|
||||||
sta DRAW_PAGE ; 3
|
|
||||||
clc ; 2
|
clc ; 2
|
||||||
|
lda DRAW_PAGE ; 3
|
||||||
|
|
||||||
adc #6 ; 2
|
adc #6 ; 2
|
||||||
sta __cbf2+2 ; 3
|
sta __cbf2+2 ; 3
|
||||||
@ -127,6 +130,7 @@ clear_screens_notext:
|
|||||||
;===================================
|
;===================================
|
||||||
|
|
||||||
lda #$0
|
lda #$0
|
||||||
|
sta DRAW_PAGE
|
||||||
jsr clear_all
|
jsr clear_all
|
||||||
|
|
||||||
;===================================
|
;===================================
|
||||||
@ -134,6 +138,7 @@ clear_screens_notext:
|
|||||||
;===================================
|
;===================================
|
||||||
|
|
||||||
lda #$4
|
lda #$4
|
||||||
|
sta DRAW_PAGE
|
||||||
; fall through
|
; fall through
|
||||||
|
|
||||||
|
|
||||||
@ -144,8 +149,8 @@ clear_screens_notext:
|
|||||||
; clear color: clear_all_color+1
|
; clear color: clear_all_color+1
|
||||||
|
|
||||||
clear_all:
|
clear_all:
|
||||||
sta DRAW_PAGE ; 3
|
|
||||||
clc ; 2
|
clc ; 2
|
||||||
|
lda DRAW_PAGE ; 3
|
||||||
|
|
||||||
adc #4 ; 2
|
adc #4 ; 2
|
||||||
sta __caf+2 ; 3
|
sta __caf+2 ; 3
|
||||||
|
@ -56,7 +56,7 @@ pt3_play_music:
|
|||||||
|
|
||||||
move_to_next:
|
move_to_next:
|
||||||
; same as "press right"
|
; same as "press right"
|
||||||
ldx #$20
|
lda #$20
|
||||||
jmp quiet_exit
|
jmp quiet_exit
|
||||||
|
|
||||||
;======================================
|
;======================================
|
||||||
@ -200,7 +200,7 @@ yes_bar:
|
|||||||
lowbar:
|
lowbar:
|
||||||
jsr fire_setline
|
jsr fire_setline
|
||||||
|
|
||||||
ldx DONE_PLAYING
|
lda DONE_PLAYING
|
||||||
|
|
||||||
bcs quiet_exit ; branch always
|
bcs quiet_exit ; branch always
|
||||||
|
|
||||||
@ -209,23 +209,26 @@ lowbar:
|
|||||||
|
|
||||||
key_M:
|
key_M:
|
||||||
cmp #'M'
|
cmp #'M'
|
||||||
bne key_L ; set carry if true
|
bne key_L
|
||||||
|
|
||||||
ldx #'0'+$80
|
|
||||||
lda convert_177
|
lda convert_177
|
||||||
eor #$1
|
eor #$1
|
||||||
sta convert_177
|
sta convert_177
|
||||||
beq at_MHz
|
beq at_1MHz
|
||||||
|
|
||||||
; update text on screen
|
; update text on screen
|
||||||
|
|
||||||
ldx #'7'+$80
|
lda #'7'+$80
|
||||||
|
sta $7F4
|
||||||
|
sta $BF4
|
||||||
|
bne done_key ; branch always
|
||||||
|
|
||||||
at_MHz:
|
at_1MHz:
|
||||||
stx $7F4
|
lda #'0'+$80
|
||||||
stx $BF4
|
sta $7F4
|
||||||
|
sta $BF4
|
||||||
|
|
||||||
bcs done_key ; branch always
|
bne done_key ; branch always
|
||||||
|
|
||||||
|
|
||||||
;===========================
|
;===========================
|
||||||
@ -233,9 +236,8 @@ at_MHz:
|
|||||||
|
|
||||||
key_L:
|
key_L:
|
||||||
cmp #'L'
|
cmp #'L'
|
||||||
bne key_left ; set carry if true
|
bne key_left
|
||||||
|
|
||||||
ldx #'/'+$80
|
|
||||||
lda LOOP
|
lda LOOP
|
||||||
eor #$1
|
eor #$1
|
||||||
sta LOOP
|
sta LOOP
|
||||||
@ -243,42 +245,49 @@ key_L:
|
|||||||
|
|
||||||
; update text on screen
|
; update text on screen
|
||||||
|
|
||||||
ldx #'L'+$80
|
lda #'L'+$80
|
||||||
|
sta $7D0+18
|
||||||
|
sta $BD0+18
|
||||||
|
bne done_key ; branch always
|
||||||
|
|
||||||
music_looping:
|
music_looping:
|
||||||
|
lda #'/'+$80
|
||||||
sta $7D0+18
|
sta $7D0+18
|
||||||
sta $BD0+18
|
sta $BD0+18
|
||||||
|
|
||||||
bcs done_key ; branch always
|
bne done_key ; branch always
|
||||||
|
|
||||||
|
|
||||||
;======================
|
;======================
|
||||||
; left key, to prev song
|
; left key, to prev song
|
||||||
|
|
||||||
key_left:
|
key_left:
|
||||||
ldx #$40
|
|
||||||
cmp #'A'
|
cmp #'A'
|
||||||
beq quiet_exit
|
bne key_right
|
||||||
|
|
||||||
|
lda #$40
|
||||||
|
bne quiet_exit
|
||||||
|
|
||||||
;========================
|
;========================
|
||||||
; right key, to next song
|
; right key, to next song
|
||||||
|
|
||||||
key_right:
|
key_right:
|
||||||
ldx #$20
|
|
||||||
cmp #'D'
|
cmp #'D'
|
||||||
bne done_key
|
bne done_key
|
||||||
|
|
||||||
|
lda #$20
|
||||||
|
|
||||||
;========================
|
;========================
|
||||||
; stop playing for now
|
; stop playing for now
|
||||||
; quiet down the Mockingboard
|
; quiet down the Mockingboard
|
||||||
; (otherwise will be stuck on last note)
|
; (otherwise will be stuck on last note)
|
||||||
|
|
||||||
quiet_exit:
|
quiet_exit:
|
||||||
stx DONE_PLAYING
|
sta DONE_PLAYING
|
||||||
jsr clear_ay_both
|
jsr clear_ay_both
|
||||||
|
|
||||||
;ldx #$ff ; also mute the channel
|
lda #$ff ; also mute the channel
|
||||||
stx AY_REGISTERS+7 ; just in case
|
sta AY_REGISTERS+7 ; just in case
|
||||||
|
|
||||||
done_key:
|
done_key:
|
||||||
exit_interrupt:
|
exit_interrupt:
|
||||||
|
@ -52,8 +52,8 @@ NOTE_SAMPLE_POSITION =26
|
|||||||
NOTE_ENVELOPE_SLIDING =27
|
NOTE_ENVELOPE_SLIDING =27
|
||||||
NOTE_NOISE_SLIDING =28
|
NOTE_NOISE_SLIDING =28
|
||||||
NOTE_AMPLITUDE_SLIDING =29
|
NOTE_AMPLITUDE_SLIDING =29
|
||||||
NOTE_ONOFF_DELAY =30 ;ordering of DELAYs is hard-coded now
|
NOTE_ONOFF_DELAY =30
|
||||||
NOTE_OFFON_DELAY =31 ;ordering of DELAYs is hard-coded now
|
NOTE_OFFON_DELAY =31
|
||||||
NOTE_TONE_SLIDE_STEP_L =32
|
NOTE_TONE_SLIDE_STEP_L =32
|
||||||
NOTE_TONE_SLIDE_STEP_H =33
|
NOTE_TONE_SLIDE_STEP_H =33
|
||||||
NOTE_TONE_SLIDE_DELAY =34
|
NOTE_TONE_SLIDE_DELAY =34
|
||||||
@ -278,14 +278,16 @@ load_ornament:
|
|||||||
; (pt3->data[0xaa+(i*2)]<<8)|pt3->data[0xa9+(i*2)];
|
; (pt3->data[0xaa+(i*2)]<<8)|pt3->data[0xa9+(i*2)];
|
||||||
|
|
||||||
asl ; A*2 ; 2
|
asl ; A*2 ; 2
|
||||||
|
adc #PT3_ORNAMENT_LOC_L ; 2
|
||||||
tay ; 2
|
tay ; 2
|
||||||
|
|
||||||
; a->ornament_pointer=pt3->ornament_patterns[a->ornament];
|
; a->ornament_pointer=pt3->ornament_patterns[a->ornament];
|
||||||
|
|
||||||
lda PT3_LOC+PT3_ORNAMENT_LOC_L,Y ; 4+
|
lda PT3_LOC,Y ; 4+
|
||||||
sta ORNAMENT_L ; 3
|
sta ORNAMENT_L ; 3
|
||||||
|
|
||||||
lda PT3_LOC+PT3_ORNAMENT_LOC_L+1,Y ; 4+
|
iny ; 2
|
||||||
|
lda PT3_LOC,Y ; 4+
|
||||||
|
|
||||||
; we're assuming PT3 is loaded to a page boundary
|
; we're assuming PT3 is loaded to a page boundary
|
||||||
|
|
||||||
@ -322,7 +324,7 @@ load_ornament:
|
|||||||
rts ; 6
|
rts ; 6
|
||||||
|
|
||||||
;============
|
;============
|
||||||
; 83
|
; 87
|
||||||
|
|
||||||
;===========================
|
;===========================
|
||||||
; Load Sample
|
; Load Sample
|
||||||
@ -349,15 +351,17 @@ load_sample:
|
|||||||
; (pt3->data[0x6a+(i*2)]<<8)|pt3->data[0x69+(i*2)];
|
; (pt3->data[0x6a+(i*2)]<<8)|pt3->data[0x69+(i*2)];
|
||||||
|
|
||||||
asl ; A*2 ; 2
|
asl ; A*2 ; 2
|
||||||
|
adc #PT3_SAMPLE_LOC_L ; 2
|
||||||
tay ; 2
|
tay ; 2
|
||||||
|
|
||||||
; Set the initial sample pointer
|
; Set the initial sample pointer
|
||||||
; a->sample_pointer=pt3->sample_patterns[a->sample];
|
; a->sample_pointer=pt3->sample_patterns[a->sample];
|
||||||
|
|
||||||
lda PT3_LOC+PT3_SAMPLE_LOC_L,Y ; 4+
|
lda PT3_LOC,Y ; 4+
|
||||||
sta SAMPLE_L ; 3
|
sta SAMPLE_L ; 3
|
||||||
|
|
||||||
lda PT3_LOC+PT3_SAMPLE_LOC_L+1,Y ; 4+
|
iny ; 2
|
||||||
|
lda PT3_LOC,Y ; 4+
|
||||||
|
|
||||||
; assume pt3 file is at page boundary
|
; assume pt3 file is at page boundary
|
||||||
adc #>PT3_LOC ; 2
|
adc #>PT3_LOC ; 2
|
||||||
@ -390,7 +394,7 @@ load_sample:
|
|||||||
|
|
||||||
rts ; 6
|
rts ; 6
|
||||||
;============
|
;============
|
||||||
; 76
|
; 80
|
||||||
|
|
||||||
;====================================
|
;====================================
|
||||||
; pt3_init_song
|
; pt3_init_song
|
||||||
@ -484,116 +488,9 @@ not_ascii_number:
|
|||||||
; carry clear = 3.3/3.4 table
|
; carry clear = 3.3/3.4 table
|
||||||
; carry set = 3.5 table
|
; carry set = 3.5 table
|
||||||
|
|
||||||
;==========================
|
jsr VolTableCreator ; 6+??
|
||||||
; 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_h
|
|
||||||
sta z80_d
|
|
||||||
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 ; l=16 or 17
|
|
||||||
sta z80_e ; 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:
|
|
||||||
lda z80_h
|
|
||||||
pha ; save H
|
|
||||||
|
|
||||||
clc ; add HL,DE
|
|
||||||
lda z80_l
|
|
||||||
adc z80_e
|
|
||||||
sta z80_e
|
|
||||||
lda z80_h
|
|
||||||
adc z80_d
|
|
||||||
sta z80_d ; carry is important
|
|
||||||
|
|
||||||
; sbc hl,hl
|
|
||||||
lda #$ff
|
|
||||||
bcs vol_ffs
|
|
||||||
vol_zeros:
|
|
||||||
lda #0
|
|
||||||
|
|
||||||
vol_ffs:
|
|
||||||
vol_write:
|
|
||||||
sta z80_h
|
|
||||||
pha
|
|
||||||
|
|
||||||
vol_inner:
|
|
||||||
pla
|
|
||||||
pha
|
|
||||||
|
|
||||||
vol_smc:
|
|
||||||
nop ; nop or ROL depending
|
|
||||||
|
|
||||||
lda z80_h
|
|
||||||
|
|
||||||
adc #$0 ; a=a+carry;
|
|
||||||
|
|
||||||
sta VolumeTable,Y
|
|
||||||
iny
|
|
||||||
|
|
||||||
pla ; add HL,DE
|
|
||||||
adc z80_e
|
|
||||||
pha
|
|
||||||
lda z80_h
|
|
||||||
adc z80_d
|
|
||||||
sta z80_h
|
|
||||||
|
|
||||||
inx ; inc C
|
|
||||||
txa ; a=c
|
|
||||||
and #$f
|
|
||||||
bne vol_inner
|
|
||||||
|
|
||||||
|
|
||||||
pla
|
|
||||||
pla
|
|
||||||
sta z80_h ; restore H
|
|
||||||
|
|
||||||
lda z80_e ; a=e
|
|
||||||
cmp #$77
|
|
||||||
bne vol_m3
|
|
||||||
|
|
||||||
inc z80_e
|
|
||||||
|
|
||||||
vol_m3:
|
|
||||||
txa ; a=c
|
|
||||||
bne vol_outer
|
|
||||||
|
|
||||||
vol_done:
|
|
||||||
rts
|
|
||||||
|
|
||||||
|
rts ; 6
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -647,6 +544,7 @@ note_enabled:
|
|||||||
; a->tone+=(pt3->data[a->sample_pointer + a->sample_position*4+3])<<8;
|
; a->tone+=(pt3->data[a->sample_pointer + a->sample_position*4+3])<<8;
|
||||||
; a->tone += a->tone_accumulator;
|
; a->tone += a->tone_accumulator;
|
||||||
iny ; 2
|
iny ; 2
|
||||||
|
clc ; 2
|
||||||
lda (SAMPLE_L),Y ; 5+
|
lda (SAMPLE_L),Y ; 5+
|
||||||
adc note_a+NOTE_TONE_ACCUMULATOR_L,X ; 4+
|
adc note_a+NOTE_TONE_ACCUMULATOR_L,X ; 4+
|
||||||
sta note_a+NOTE_TONE_L,X ; 4
|
sta note_a+NOTE_TONE_L,X ; 4
|
||||||
@ -896,9 +794,8 @@ check_envelope_enable:
|
|||||||
|
|
||||||
; if (((b0 & 0x1) == 0) && ( a->envelope_enabled)) {
|
; if (((b0 & 0x1) == 0) && ( a->envelope_enabled)) {
|
||||||
lda sample_b0
|
lda sample_b0
|
||||||
lsr
|
and #$1
|
||||||
tay
|
bne envelope_slide
|
||||||
bcs envelope_slide
|
|
||||||
|
|
||||||
lda note_a+NOTE_ENVELOPE_ENABLED,X
|
lda note_a+NOTE_ENVELOPE_ENABLED,X
|
||||||
beq envelope_slide
|
beq envelope_slide
|
||||||
@ -913,6 +810,9 @@ check_envelope_enable:
|
|||||||
|
|
||||||
|
|
||||||
envelope_slide:
|
envelope_slide:
|
||||||
|
lda sample_b0
|
||||||
|
lsr
|
||||||
|
tay
|
||||||
|
|
||||||
; Envelope slide
|
; Envelope slide
|
||||||
; If b1 top bits are 10 or 11
|
; If b1 top bits are 10 or 11
|
||||||
@ -1043,8 +943,8 @@ handle_onoff:
|
|||||||
|
|
||||||
bne do_offon
|
bne do_offon
|
||||||
do_onoff:
|
do_onoff:
|
||||||
dex ; select ONOFF
|
lda note_a+NOTE_ONOFF_DELAY,X ; if (a->enabled) a->onoff=a->onoff_delay;
|
||||||
;lda note_a+NOTE_ONOFF_DELAY,X ; if (a->enabled) a->onoff=a->onoff_delay;
|
jmp put_offon
|
||||||
do_offon:
|
do_offon:
|
||||||
lda note_a+NOTE_OFFON_DELAY,X ; else a->onoff=a->offon_delay;
|
lda note_a+NOTE_OFFON_DELAY,X ; else a->onoff=a->offon_delay;
|
||||||
put_offon:
|
put_offon:
|
||||||
@ -1077,45 +977,22 @@ spec_command: .byte $0
|
|||||||
; 5X: 14+5+5+ 102
|
; 5X: 14+5+5+ 102
|
||||||
;
|
;
|
||||||
|
|
||||||
stop_decoding:
|
|
||||||
|
|
||||||
; we are still running, decrement and early return
|
|
||||||
dec note_a+NOTE_LEN_COUNT,X ; 7
|
|
||||||
rts ; 6
|
|
||||||
|
|
||||||
;=====================================
|
|
||||||
; Decode Line
|
|
||||||
;=====================================
|
|
||||||
|
|
||||||
pt3_decode_line:
|
|
||||||
; decode_note(&pt3->a,&(pt3->a_addr),pt3);
|
|
||||||
ldx #(NOTE_STRUCT_SIZE*0)
|
|
||||||
jsr decode_note
|
|
||||||
|
|
||||||
; decode_note(&pt3->b,&(pt3->b_addr),pt3);
|
|
||||||
ldx #(NOTE_STRUCT_SIZE*1)
|
|
||||||
jsr decode_note
|
|
||||||
|
|
||||||
; decode_note(&pt3->c,&(pt3->c_addr),pt3);
|
|
||||||
ldx #(NOTE_STRUCT_SIZE*2)
|
|
||||||
;;jsr decode_note ; fall through
|
|
||||||
|
|
||||||
; if (pt3->a.all_done && pt3->b.all_done && pt3->c.all_done) {
|
|
||||||
; return 1;
|
|
||||||
; }
|
|
||||||
|
|
||||||
decode_note:
|
decode_note:
|
||||||
|
|
||||||
; Init vars
|
; Init vars
|
||||||
|
|
||||||
ldy #0 ; 2
|
lda #0 ; 2
|
||||||
sty spec_command ; 4
|
sta spec_command ; 4
|
||||||
sty decode_done ; 4
|
sta decode_done ; 4
|
||||||
|
|
||||||
; Skip decode if note still running
|
; Skip decode if note still running
|
||||||
lda note_a+NOTE_LEN_COUNT,X ; 4+
|
lda note_a+NOTE_LEN_COUNT,X ; 4+
|
||||||
cmp #2 ; 2
|
cmp #2 ; 2
|
||||||
bcs stop_decoding ; blt, assume not negative ; 2/3
|
bcc keep_decoding ; blt, assume not negative ; 2/3
|
||||||
|
|
||||||
|
; we are still running, decrement and early return
|
||||||
|
dec note_a+NOTE_LEN_COUNT,X ; 7
|
||||||
|
rts ; 6
|
||||||
|
|
||||||
keep_decoding:
|
keep_decoding:
|
||||||
|
|
||||||
@ -1128,8 +1005,9 @@ keep_decoding:
|
|||||||
sta prev_sliding_l ; 4
|
sta prev_sliding_l ; 4
|
||||||
|
|
||||||
|
|
||||||
|
ldy #0 ; 2
|
||||||
;============
|
;============
|
||||||
; 24
|
; 26
|
||||||
|
|
||||||
note_decode_loop:
|
note_decode_loop:
|
||||||
lda note_a+NOTE_LEN,X ; re-up length count ; 4+
|
lda note_a+NOTE_LEN,X ; re-up length count ; 4+
|
||||||
@ -1179,7 +1057,8 @@ decode_case_0X:
|
|||||||
; -1
|
; -1
|
||||||
sta note_a+NOTE_LEN_COUNT,X ; len_count=0; ; 5
|
sta note_a+NOTE_LEN_COUNT,X ; len_count=0; ; 5
|
||||||
|
|
||||||
inc decode_done ; 6
|
lda #1 ; 2
|
||||||
|
sta decode_done ; 4+
|
||||||
|
|
||||||
dec pt3_pattern_done ; 6
|
dec pt3_pattern_done ; 6
|
||||||
|
|
||||||
@ -1234,12 +1113,13 @@ decode_case_3X:
|
|||||||
bcs decode_case_4X ; branch greater/equal ; 3
|
bcs decode_case_4X ; branch greater/equal ; 3
|
||||||
; -1
|
; -1
|
||||||
lda note_command ; 3
|
lda note_command ; 3
|
||||||
adc #$e0 ; 2
|
sec ; 2
|
||||||
|
sbc #$20 ; 2
|
||||||
sta pt3_noise_period ; 3
|
sta pt3_noise_period ; 3
|
||||||
|
|
||||||
jmp done_decode ; 3
|
jmp done_decode ; 3
|
||||||
;===========
|
;===========
|
||||||
; 15
|
; 17
|
||||||
|
|
||||||
decode_case_4X:
|
decode_case_4X:
|
||||||
;==============================
|
;==============================
|
||||||
@ -1265,7 +1145,8 @@ decode_case_5X:
|
|||||||
|
|
||||||
; -1
|
; -1
|
||||||
lda note_command ; 4
|
lda note_command ; 4
|
||||||
adc #$b0 ; 2
|
sec ; 2
|
||||||
|
sbc #$50 ; 2
|
||||||
sta note_a+NOTE_NOTE,X ; note=(current_val-0x50); ; 5
|
sta note_a+NOTE_NOTE,X ; note=(current_val-0x50); ; 5
|
||||||
|
|
||||||
jsr reset_note ; 6+69
|
jsr reset_note ; 6+69
|
||||||
@ -1274,7 +1155,7 @@ decode_case_5X:
|
|||||||
sta note_a+NOTE_ENABLED,X ; enabled=1 ; 5
|
sta note_a+NOTE_ENABLED,X ; enabled=1 ; 5
|
||||||
|
|
||||||
|
|
||||||
bne done_decode ; 2
|
jmp done_decode ; 3
|
||||||
|
|
||||||
decode_case_bX:
|
decode_case_bX:
|
||||||
;============================================
|
;============================================
|
||||||
@ -1286,7 +1167,7 @@ decode_case_bX:
|
|||||||
lda note_command
|
lda note_command
|
||||||
and #$f
|
and #$f
|
||||||
beq decode_case_b0
|
beq decode_case_b0
|
||||||
sbc #1 ; envelope_type=(current_val&0xf)-1;
|
cmp #1
|
||||||
bne decode_case_bx_higher
|
bne decode_case_bx_higher
|
||||||
|
|
||||||
decode_case_b1:
|
decode_case_b1:
|
||||||
@ -1298,20 +1179,23 @@ decode_case_b1:
|
|||||||
|
|
||||||
sta note_a+NOTE_LEN,X
|
sta note_a+NOTE_LEN,X
|
||||||
sta note_a+NOTE_LEN_COUNT,X
|
sta note_a+NOTE_LEN_COUNT,X
|
||||||
bcs done_decode ; branch always
|
jmp done_decode
|
||||||
|
|
||||||
decode_case_b0:
|
decode_case_b0:
|
||||||
; Disable envelope
|
; Disable envelope
|
||||||
sta note_a+NOTE_ENVELOPE_ENABLED,X
|
sta note_a+NOTE_ENVELOPE_ENABLED,X
|
||||||
sta note_a+NOTE_ORNAMENT_POSITION,X
|
sta note_a+NOTE_ORNAMENT_POSITION,X
|
||||||
beq done_decode
|
jmp done_decode
|
||||||
|
|
||||||
|
|
||||||
decode_case_bx_higher:
|
decode_case_bx_higher:
|
||||||
|
|
||||||
|
sec
|
||||||
|
sbc #1 ; envelope_type=(current_val&0xf)-1;
|
||||||
|
|
||||||
jsr set_envelope ; 6+64
|
jsr set_envelope ; 6+64
|
||||||
|
|
||||||
bcs done_decode ; branch always
|
jmp done_decode
|
||||||
|
|
||||||
decode_case_cX:
|
decode_case_cX:
|
||||||
;==============================
|
;==============================
|
||||||
@ -1331,11 +1215,11 @@ decode_case_c0:
|
|||||||
|
|
||||||
jsr reset_note ; 6+69
|
jsr reset_note ; 6+69
|
||||||
|
|
||||||
bne done_decode ; branch always
|
jmp done_decode
|
||||||
|
|
||||||
decode_case_cx_not_c0:
|
decode_case_cx_not_c0:
|
||||||
sta note_a+NOTE_VOLUME,X ; volume=current_val&0xf;
|
sta note_a+NOTE_VOLUME,X ; volume=current_val&0xf;
|
||||||
bne done_decode ; branch always
|
jmp done_decode
|
||||||
|
|
||||||
decode_case_dX:
|
decode_case_dX:
|
||||||
;==============================
|
;==============================
|
||||||
@ -1353,9 +1237,10 @@ decode_case_dX:
|
|||||||
;========================
|
;========================
|
||||||
; d0 case means end note
|
; d0 case means end note
|
||||||
|
|
||||||
rol decode_done
|
lda #1
|
||||||
|
sta decode_done
|
||||||
|
|
||||||
bne done_decode
|
jmp done_decode
|
||||||
decode_case_eX:
|
decode_case_eX:
|
||||||
;==============================
|
;==============================
|
||||||
; $EX -- change sample
|
; $EX -- change sample
|
||||||
@ -1372,7 +1257,7 @@ decode_case_dx_not_d0:
|
|||||||
|
|
||||||
jsr load_sample ; load sample in bottom nybble
|
jsr load_sample ; load sample in bottom nybble
|
||||||
|
|
||||||
bcc done_decode ; branch always
|
jmp done_decode
|
||||||
decode_case_fX:
|
decode_case_fX:
|
||||||
;==============================
|
;==============================
|
||||||
; $FX - change ornament/sample
|
; $FX - change ornament/sample
|
||||||
@ -1567,7 +1452,7 @@ effect_3:
|
|||||||
iny
|
iny
|
||||||
sta note_a+NOTE_SAMPLE_POSITION,X
|
sta note_a+NOTE_SAMPLE_POSITION,X
|
||||||
|
|
||||||
bne no_effect ; branch always
|
jmp no_effect
|
||||||
|
|
||||||
;==============================
|
;==============================
|
||||||
; Effect #4 -- Ornament Position
|
; Effect #4 -- Ornament Position
|
||||||
@ -1580,7 +1465,7 @@ effect_4:
|
|||||||
iny
|
iny
|
||||||
sta note_a+NOTE_ORNAMENT_POSITION,X
|
sta note_a+NOTE_ORNAMENT_POSITION,X
|
||||||
|
|
||||||
bne no_effect ; branch always
|
jmp no_effect
|
||||||
|
|
||||||
;==============================
|
;==============================
|
||||||
; Effect #5 -- Vibrato
|
; Effect #5 -- Vibrato
|
||||||
@ -1603,7 +1488,7 @@ effect_5:
|
|||||||
sta note_a+NOTE_TONE_SLIDING_L,X
|
sta note_a+NOTE_TONE_SLIDING_L,X
|
||||||
sta note_a+NOTE_TONE_SLIDING_H,X
|
sta note_a+NOTE_TONE_SLIDING_H,X
|
||||||
|
|
||||||
beq no_effect ; branch always
|
jmp no_effect
|
||||||
|
|
||||||
;==============================
|
;==============================
|
||||||
; Effect #8 -- Envelope Down
|
; Effect #8 -- Envelope Down
|
||||||
@ -1628,7 +1513,7 @@ effect_8:
|
|||||||
iny
|
iny
|
||||||
sta pt3_envelope_slide_add_h
|
sta pt3_envelope_slide_add_h
|
||||||
|
|
||||||
bne no_effect ; branch always
|
jmp no_effect
|
||||||
|
|
||||||
;==============================
|
;==============================
|
||||||
; Effect #9 -- Set Speed
|
; Effect #9 -- Set Speed
|
||||||
@ -1716,7 +1601,8 @@ reset_note:
|
|||||||
sta note_a+NOTE_TONE_ACCUMULATOR_H,X ; 5
|
sta note_a+NOTE_TONE_ACCUMULATOR_H,X ; 5
|
||||||
sta note_a+NOTE_ONOFF,X ; onoff=0; ; 5
|
sta note_a+NOTE_ONOFF,X ; onoff=0; ; 5
|
||||||
|
|
||||||
rol decode_done ; decode_done=1 ; 6
|
lda #1 ; 2
|
||||||
|
sta decode_done ; decode_done=1 ; 4
|
||||||
|
|
||||||
rts ; 6
|
rts ; 6
|
||||||
;============
|
;============
|
||||||
@ -1725,6 +1611,30 @@ reset_note:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;=====================================
|
||||||
|
; Decode Line
|
||||||
|
;=====================================
|
||||||
|
|
||||||
|
pt3_decode_line:
|
||||||
|
; decode_note(&pt3->a,&(pt3->a_addr),pt3);
|
||||||
|
ldx #(NOTE_STRUCT_SIZE*0)
|
||||||
|
jsr decode_note
|
||||||
|
|
||||||
|
; decode_note(&pt3->b,&(pt3->b_addr),pt3);
|
||||||
|
ldx #(NOTE_STRUCT_SIZE*1)
|
||||||
|
jsr decode_note
|
||||||
|
|
||||||
|
; decode_note(&pt3->c,&(pt3->c_addr),pt3);
|
||||||
|
ldx #(NOTE_STRUCT_SIZE*2)
|
||||||
|
jsr decode_note
|
||||||
|
|
||||||
|
; if (pt3->a.all_done && pt3->b.all_done && pt3->c.all_done) {
|
||||||
|
; return 1;
|
||||||
|
; }
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
current_subframe: .byte $0
|
current_subframe: .byte $0
|
||||||
current_line: .byte $0
|
current_line: .byte $0
|
||||||
current_pattern: .byte $0
|
current_pattern: .byte $0
|
||||||
@ -1735,11 +1645,6 @@ current_pattern: .byte $0
|
|||||||
; FIXME: inline this? we do call it from outside
|
; FIXME: inline this? we do call it from outside
|
||||||
; in the player note length code
|
; in the player note length code
|
||||||
|
|
||||||
is_done:
|
|
||||||
; done with song, set it to non-zero
|
|
||||||
sta DONE_SONG ; 3
|
|
||||||
rts ; 6
|
|
||||||
|
|
||||||
pt3_set_pattern:
|
pt3_set_pattern:
|
||||||
|
|
||||||
; Lookup current pattern in pattern table
|
; Lookup current pattern in pattern table
|
||||||
@ -1748,10 +1653,13 @@ pt3_set_pattern:
|
|||||||
|
|
||||||
; if value is $FF we are at the end of the song
|
; if value is $FF we are at the end of the song
|
||||||
cmp #$ff ; 2
|
cmp #$ff ; 2
|
||||||
beq is_done ; 2/3
|
bne not_done ; 2/3
|
||||||
|
|
||||||
|
; done with song, set it to non-zero
|
||||||
|
sta DONE_SONG ; 3
|
||||||
|
rts ; 6
|
||||||
;============
|
;============
|
||||||
; 22 if end
|
; 21 if end
|
||||||
|
|
||||||
not_done:
|
not_done:
|
||||||
|
|
||||||
@ -1773,6 +1681,7 @@ not_done:
|
|||||||
lda (PATTERN_L),Y ; 5+
|
lda (PATTERN_L),Y ; 5+
|
||||||
sta note_a+NOTE_ADDR_L ; 4
|
sta note_a+NOTE_ADDR_L ; 4
|
||||||
iny ; 2
|
iny ; 2
|
||||||
|
clc ; needed? ; 2
|
||||||
lda (PATTERN_L),Y ; 5+
|
lda (PATTERN_L),Y ; 5+
|
||||||
adc #>PT3_LOC ; assume page boundary ; 2
|
adc #>PT3_LOC ; assume page boundary ; 2
|
||||||
sta note_a+NOTE_ADDR_H ; 4
|
sta note_a+NOTE_ADDR_H ; 4
|
||||||
@ -1893,7 +1802,6 @@ do_frame:
|
|||||||
; R13 = Envelope Shape, 0xff means don't write
|
; R13 = Envelope Shape, 0xff means don't write
|
||||||
; R14/R15 = I/O (ignored)
|
; R14/R15 = I/O (ignored)
|
||||||
|
|
||||||
lda #0 ; 2
|
|
||||||
sta pt3_mixer_value ; 4
|
sta pt3_mixer_value ; 4
|
||||||
sta pt3_envelope_add ; 4
|
sta pt3_envelope_add ; 4
|
||||||
|
|
||||||
@ -2036,12 +1944,13 @@ no_scale_c:
|
|||||||
and #$1f ; 2
|
and #$1f ; 2
|
||||||
sta AY_REGISTERS+6 ; 3
|
sta AY_REGISTERS+6 ; 3
|
||||||
|
|
||||||
ldx convert_177 ; 3
|
lda convert_177 ; 3
|
||||||
beq no_scale_n ; 2/3
|
beq no_scale_n ; 2/3
|
||||||
|
|
||||||
; Convert from 1.77MHz to 1MHz by multiplying by 9/16
|
; Convert from 1.77MHz to 1MHz by multiplying by 9/16
|
||||||
|
|
||||||
; first multiply by 8
|
; first multiply by 8
|
||||||
|
lda AY_REGISTERS+6 ; 3
|
||||||
asl ; 2
|
asl ; 2
|
||||||
asl ; 2
|
asl ; 2
|
||||||
asl ; 2
|
asl ; 2
|
||||||
@ -2056,9 +1965,9 @@ no_scale_c:
|
|||||||
ror ; 2
|
ror ; 2
|
||||||
ror ; 2
|
ror ; 2
|
||||||
and #$1f ; 2
|
and #$1f ; 2
|
||||||
|
sta AY_REGISTERS+6 ; 3
|
||||||
|
|
||||||
no_scale_n:
|
no_scale_n:
|
||||||
sta AY_REGISTERS+6 ; 3
|
|
||||||
|
|
||||||
;=======================
|
;=======================
|
||||||
; Mixer
|
; Mixer
|
||||||
@ -2308,11 +2217,131 @@ PT3NoteTable_ASM_34_35_low:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;==========================
|
||||||
|
; 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
|
||||||
|
|
||||||
|
|
||||||
z80_h: .byte $0
|
z80_h: .byte $0
|
||||||
z80_l: .byte $0
|
z80_l: .byte $0
|
||||||
z80_d: .byte $0
|
z80_d: .byte $0
|
||||||
z80_e: .byte $0
|
z80_e: .byte $0
|
||||||
|
|
||||||
|
VolTableCreator:
|
||||||
|
|
||||||
|
; Init initial variables
|
||||||
|
lda #$0
|
||||||
|
sta z80_h
|
||||||
|
sta z80_d
|
||||||
|
sta z80_e
|
||||||
|
lda #$11
|
||||||
|
sta z80_l
|
||||||
|
|
||||||
|
; Set up self modify
|
||||||
|
|
||||||
|
lda #$2A ; ROL for self-modify
|
||||||
|
bcs vol_type_35
|
||||||
|
|
||||||
|
vol_type_33:
|
||||||
|
|
||||||
|
; For older table, we set initial conditions a bit
|
||||||
|
; different
|
||||||
|
|
||||||
|
lda #$10
|
||||||
|
sta z80_l ; l=16
|
||||||
|
sta z80_e ; e=16
|
||||||
|
|
||||||
|
lda #$ea ; NOP for self modify
|
||||||
|
|
||||||
|
vol_type_35:
|
||||||
|
sta vol_smc ; set the self-modify code
|
||||||
|
|
||||||
|
ldy #16 ; skip first row, all zeros
|
||||||
|
ldx #16 ; c=16
|
||||||
|
vol_outer:
|
||||||
|
lda z80_h
|
||||||
|
pha
|
||||||
|
lda z80_l
|
||||||
|
pha ; save HL
|
||||||
|
|
||||||
|
clc ; add HL,DE
|
||||||
|
adc z80_e
|
||||||
|
sta z80_e
|
||||||
|
lda z80_h
|
||||||
|
adc z80_d
|
||||||
|
sta z80_d ; carry is important
|
||||||
|
|
||||||
|
; sbc hl,hl
|
||||||
|
lda #$ff
|
||||||
|
bcs vol_ffs
|
||||||
|
vol_zeros:
|
||||||
|
lda #0
|
||||||
|
|
||||||
|
vol_ffs:
|
||||||
|
vol_write:
|
||||||
|
sta z80_h
|
||||||
|
sta z80_l
|
||||||
|
|
||||||
|
vol_inner:
|
||||||
|
lda z80_l
|
||||||
|
|
||||||
|
vol_smc:
|
||||||
|
nop ; nop or ROL depending
|
||||||
|
|
||||||
|
lda z80_h
|
||||||
|
|
||||||
|
adc #$0 ; a=a+carry;
|
||||||
|
|
||||||
|
sta VolumeTable,Y
|
||||||
|
iny
|
||||||
|
|
||||||
|
clc ; add HL,DE
|
||||||
|
lda z80_l
|
||||||
|
adc z80_e
|
||||||
|
sta z80_l
|
||||||
|
lda z80_h
|
||||||
|
adc z80_d
|
||||||
|
sta z80_h
|
||||||
|
|
||||||
|
inx ; inc C
|
||||||
|
txa ; a=c
|
||||||
|
and #$f
|
||||||
|
bne vol_inner
|
||||||
|
|
||||||
|
|
||||||
|
pla
|
||||||
|
sta z80_l
|
||||||
|
pla
|
||||||
|
sta z80_h ; restore HL
|
||||||
|
|
||||||
|
lda z80_e ; a=e
|
||||||
|
cmp #$77
|
||||||
|
bne vol_m3
|
||||||
|
|
||||||
|
inc z80_e
|
||||||
|
bne vol_blah
|
||||||
|
inc z80_d
|
||||||
|
vol_blah:
|
||||||
|
|
||||||
|
vol_m3:
|
||||||
|
txa ; a=c
|
||||||
|
;bne vol_outer
|
||||||
|
beq vol_done
|
||||||
|
jmp vol_outer
|
||||||
|
|
||||||
|
vol_done:
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
VolumeTable:
|
VolumeTable:
|
||||||
.res 256,0
|
.res 256,0
|
||||||
|
|
||||||
|
@ -171,11 +171,11 @@ main_loop:
|
|||||||
jsr page_flip
|
jsr page_flip
|
||||||
|
|
||||||
check_done:
|
check_done:
|
||||||
lda DONE_PLAYING
|
lda #$ff
|
||||||
asl ; bit 7 to carry, bit 6 to bit 7
|
bit DONE_PLAYING
|
||||||
beq main_loop ; if was all zeros, loop
|
beq main_loop ; if was all zeros, loop
|
||||||
bcs main_loop ; if high bit set, paused
|
bmi main_loop ; if high bit set, paused
|
||||||
bmi minus_song ; if bit 6 set, then left pressed
|
bvs minus_song ; if bit 6 set, then left pressed
|
||||||
|
|
||||||
; else, either song finished or
|
; else, either song finished or
|
||||||
; right pressed
|
; right pressed
|
||||||
@ -266,8 +266,8 @@ new_song:
|
|||||||
|
|
||||||
lda #8 ; print filename to screen
|
lda #8 ; print filename to screen
|
||||||
sta CH
|
sta CH
|
||||||
;lda #21
|
lda #21
|
||||||
;sta CV
|
sta CV
|
||||||
|
|
||||||
lda INL
|
lda INL
|
||||||
sta OUTL
|
sta OUTL
|
||||||
@ -326,6 +326,8 @@ upcase:
|
|||||||
beq no_uppercase
|
beq no_uppercase
|
||||||
|
|
||||||
ldy #$1e
|
ldy #$1e
|
||||||
|
;;lda #>(PT3_LOC+$1E) ; point to header title
|
||||||
|
sta OUTH
|
||||||
upcase_loop:
|
upcase_loop:
|
||||||
lda PT3_LOC,Y
|
lda PT3_LOC,Y
|
||||||
|
|
||||||
@ -341,8 +343,6 @@ not_lowercase:
|
|||||||
no_uppercase:
|
no_uppercase:
|
||||||
; print title
|
; print title
|
||||||
|
|
||||||
lda #>(PT3_LOC+$1E) ; point to header title
|
|
||||||
sta OUTH
|
|
||||||
lda #<(PT3_LOC+$1E)
|
lda #<(PT3_LOC+$1E)
|
||||||
sta OUTL
|
sta OUTL
|
||||||
|
|
||||||
@ -421,15 +421,17 @@ no_uppercase:
|
|||||||
|
|
||||||
; update the MHz indicator with current state
|
; update the MHz indicator with current state
|
||||||
|
|
||||||
ldx #'0'+$80
|
|
||||||
lda convert_177
|
lda convert_177
|
||||||
beq done_MHz
|
beq set_1MHz
|
||||||
|
|
||||||
ldx #'7'+$80
|
lda #'7'+$80
|
||||||
|
bne done_MHz ; branch always
|
||||||
|
|
||||||
|
set_1MHz:
|
||||||
|
lda #'0'+$80
|
||||||
done_MHz:
|
done_MHz:
|
||||||
stx $7F4
|
sta $7F4
|
||||||
stx $BF4
|
sta $BF4
|
||||||
|
|
||||||
; Print Left Arrow (INVERSE)
|
; Print Left Arrow (INVERSE)
|
||||||
lda #'<'
|
lda #'<'
|
||||||
@ -499,9 +501,10 @@ fc_pattern_good:
|
|||||||
bne fc_line_good
|
bne fc_line_good
|
||||||
|
|
||||||
inc current_pattern ; increment pattern
|
inc current_pattern ; increment pattern
|
||||||
|
lda #0
|
||||||
sta current_line
|
sta current_line
|
||||||
sta current_subframe
|
sta current_subframe
|
||||||
bne frame_count_loop ; branch always
|
beq frame_count_loop ; branch always
|
||||||
|
|
||||||
fc_line_good:
|
fc_line_good:
|
||||||
inc current_subframe ; subframe++
|
inc current_subframe ; subframe++
|
||||||
@ -635,8 +638,8 @@ skip_inh_inc:
|
|||||||
increment_file:
|
increment_file:
|
||||||
inc WHICH_FILE
|
inc WHICH_FILE
|
||||||
lda WHICH_FILE
|
lda WHICH_FILE
|
||||||
eor #NUM_FILES
|
cmp #NUM_FILES
|
||||||
bne done_increment
|
eor done_increment
|
||||||
sta WHICH_FILE
|
sta WHICH_FILE
|
||||||
done_increment:
|
done_increment:
|
||||||
rts
|
rts
|
||||||
|
Loading…
x
Reference in New Issue
Block a user