@@ -1887,12 +1887,12 @@
videoIRQHandler
push bc
push de
push hl
+ jp nz,display
cyc2val ld a,05h
cyc2off ld (sidSynth.l23+1),a
-dispon jp nz,displayonly
- call c,display
+ push af
siddata ld hl,0000h
inc hl
; ld (siddata+1),hl
ld a,l
@@ -1962,43 +1962,40 @@
ld d,high (freqmulttable + 256)
ld a,(de)
scf
adc a,(hl)
- ld e,a
inc h
- ld a,00h
- adc a,(hl)
- ld l,e
+ ld h, (hl)
+ jr nc, .l1
+ inc h
+.l1: srl h
rra
- ld h,a
- rr l
+ ld l, a
pop bc ;b pulse waveform, c b7 ring mod, b6-b5 waveforms, b4-b0 volume (00h triangle, 20 sawtooth, 40h pulse, 60h noise)
ld a,c
and 1fh
ld (v1vol+1),a
- ld d,b
-; and 80h
-; ld e,a
- ld b,high volumeConvTable
- ld a,(bc)
- inc b
+ ld e, c
+ inc d ; D = high volumeConvTable
+ ld a,(de)
+ inc d ; D = high ringmodtable
rra
jr c,pulse1
ld (otherw+2),a ;triangle sawtooth noise
- ld a,(bc) ;xor a/and d
+ ld a,(de) ;xor a/and d
di
ld (sidSynth.l1+1),hl
ld hl,otherw
jp wavtab1
pulse1 rrca ; * 8-bit d/a: add a, a (87h)
ld (pulsevl+1),a ;volume value
- ld a,d
+ ld a,b
ld (pulsew+1),a ;pwm
- ld a,(bc) ;xor a/and d
+ ld a,(de) ;xor a/and d
di
ld (sidSynth.l1+1),hl
ld hl,pulsew
-wavtab1 ;ld a,e ;ring mod
+wavtab1 ;ld a,(de) ;ring mod
ld (sidSynth.l2),a
ld de,sidSynth.l3
ldi
ldi
@@ -2040,43 +2037,40 @@
ld d,high (freqmulttable + 256)
ld a,(de)
scf
adc a,(hl)
- ld e,a
inc h
- ld a,00h
- adc a,(hl)
- ld l,e
+ ld h, (hl)
+ jr nc, .l1
+ inc h
+.l1: srl h
rra
- ld h,a
- rr l
+ ld l, a
pop bc ;b pulse waveform, c b7 ring mod, b6-b5 waveforms, b4-b0 volume (00h triangle, 20 sawtooth, 40h pulse, 60h noise)
ld a,c
and 1fh
ld (v2vol+1),a
- ld d,b
-; and 80h
-; ld e,a
- ld b,high volumeConvTable
- ld a,(bc)
- inc b
+ ld e, c
+ inc d ; D = high volumeConvTable
+ ld a,(de)
+ inc d ; D = high ringmodtable
rra
jr c,pulse2
ld (otherw+2),a ;triangle sawtooth noise
- ld a,(bc) ;xor a/and d
+ ld a,(de) ;xor a/and d
di
ld (sidSynth.l5+1),hl
ld hl,otherw
jp wavtab2
pulse2 rrca ; * 8-bit d/a: add a, a (87h)
ld (pulsevl+1),a ;volume value
- ld a,d
+ ld a,b
ld (pulsew+1),a ;pwm
- ld a,(bc) ;xor a/and d
+ ld a,(de) ;xor a/and d
di
ld (sidSynth.l5+1),hl
ld hl,pulsew
-wavtab2 ;ld a,e ;ring mod
+wavtab2 ;ld a,(de) ;ring mod
ld (sidSynth.l6),a
ld de,sidSynth.l7
ldi
ldi
@@ -2117,43 +2111,40 @@
ld d,high (freqmulttable + 256)
ld a,(de)
scf
adc a,(hl)
- ld e,a
inc h
- ld a,00h
- adc a,(hl)
- ld l,e
+ ld h, (hl)
+ jr nc, .l1
+ inc h
+.l1: srl h
rra
- ld h,a
- rr l
+ ld l, a
pop bc ;b pulse waveform, c b7 ring mod, b6-b5 waveforms, b4-b0 volume (00h triangle, 20 sawtooth, 40h pulse, 60h noise)
ld a,c
and 1fh
ld (v3vol+1),a
- ld d,b
-; and 80h
-; ld e,a
- ld b,high volumeConvTable
- ld a,(bc)
- inc b
+ ld e, c
+ inc d ; D = high volumeConvTable
+ ld a,(de)
+ inc d ; D = high ringmodtable
rra
jr c,pulse3
ld (otherw+2),a ;triangle sawtooth noise
- ld a,(bc) ;xor a/and d
+ ld a,(de) ;xor a/and d
di
ld (sidSynth.l9+1),hl
ld hl,otherw
jp wavtab3
pulse3 rrca ; * 8-bit d/a: add a, a (87h)
ld (pulsevl+1),a ;volume value
- ld a,d
+ ld a,b
ld (pulsew+1),a ;pwm
- ld a,(bc) ;xor a/and d
+ ld a,(de) ;xor a/and d
di
ld (sidSynth.l9+1),hl
ld hl,pulsew
-wavtab3 ;ld a,e ;ring mod
+wavtab3 ;ld a,(de) ;ring mod
ld (sidSynth.l10),a
ld de,sidSynth.l11
ldi
ldi
@@ -2190,8 +2181,88 @@
; ldi
; ei
+ pop af
+ jp nc, nokey
+
+display:
+vidp1 ld a,0ffh
+ out (0b3h),a
+
+; ld hl,intcnt
+; dec (hl)
+; jr nz,novolbardisp
+;intcntx ld (hl),00h
+
+volbhi ;ld de,0e01fh
+ ld d,0e0h
+v1vol ld a,00h
+; and e
+ add a,d
+ ld (lptaddr+4000h+(60-18h)*10h+75*10h+53*10h+05h),a ;volume bar 1
+v2vol ld a,00h
+; and e
+ add a,d
+ ld (lptaddr+4000h+(60-18h)*10h+75*10h+55*10h+05h),a ;volume bar 2
+v3vol ld a,00h
+; and e
+ add a,d
+ ld (lptaddr+4000h+(60-18h)*10h+75*10h+57*10h+05h),a ;volume bar 3
+novolbardisp
+calrast jr dataseg
+restadd ld hl,lptaddr+028h+4000h ;c1b0 cbb0
+
+counter ld a,098h
+ dec a
+ ld (counter+1),a
+ jr nz,noend
+ ld a,098h
+ ld (counter+1),a
+updwn ld a,0aah
+ rrca
+ ld (updwn+1),a
+ ld bc,0010h
+ jr c,godown
+ ld bc,0fff0h
+godown ld (rastadd+1),bc
+noend
+rastadd ld bc,0010h
+ add hl,bc
+ ld (restadd+1),hl
+ ld bc,0010h
+ set 2,l
+ ld a,(hl)
+ res 2,l
+ ld (hl),a
+ add hl,bc
+ ld (hl),80h+20h
+ncol2 add hl,bc
+ ld (hl),10h+20h
+ncol3 add hl,bc
+ ld (hl),90h+20h
+ncol4 add hl,bc
+ ld (hl),02h+20h
+ncol5 add hl,bc
+ ld (hl),082h+20h
+ncol6 add hl,bc
+ ld (hl),082h+20h
+ncol7 add hl,bc
+ ld (hl),02h+20h
+ncol8 add hl,bc
+ ld (hl),90h+20h
+ncol9 add hl,bc
+ ld (hl),10h+20h
+ncol10 add hl,bc
+ ld (hl),80h+20h
+ add hl,bc
+ set 2,l
+ ld a,(hl)
+ res 2,l
+ ld (hl),a
+dataseg ld a,0ffh
+ out (0b3h),a
+
nosndc in a,(0b5h)
inc a
jr nz,keyprs
nokey pop hl
@@ -2331,103 +2402,11 @@
; nop
; scf
; ret
-displayonly:
- ld hl,nosndc
- push hl
-display:
- push de
-vidp1 ld a,0ffh
- out (0b3h),a
-
-; ld hl,intcnt
-; dec (hl)
-; jr nz,novolbardisp
-;intcntx ld (hl),00h
-
-volbhi ;ld de,0e01fh
- ld d,0e0h
-v1vol ld a,00h
-; and e
- add a,d
- ld (lptaddr+4000h+(60-18h)*10h+75*10h+53*10h+05h),a ;volume bar 1
-v2vol ld a,00h
-; and e
- add a,d
- ld (lptaddr+4000h+(60-18h)*10h+75*10h+55*10h+05h),a ;volume bar 2
-v3vol ld a,00h
-; and e
- add a,d
- ld (lptaddr+4000h+(60-18h)*10h+75*10h+57*10h+05h),a ;volume bar 3
-novolbardisp
-calrast jr dataseg
-restadd ld hl,lptaddr+028h+4000h ;c1b0 cbb0
-
-counter ld a,098h
- dec a
- ld (counter+1),a
- jr nz,noend
- ld a,098h
- ld (counter+1),a
-updwn ld a,0aah
- rrca
- ld (updwn+1),a
- ld bc,0010h
- jr c,godown
- ld bc,0fff0h
-godown ld (rastadd+1),bc
-noend
-rastadd ld bc,0010h
- add hl,bc
- ld (restadd+1),hl
- ld bc,0010h
- set 2,l
- ld a,(hl)
- res 2,l
- ld (hl),a
- add hl,bc
- ld (hl),80h+20h
-ncol2 add hl,bc
- ld (hl),10h+20h
-ncol3 add hl,bc
- ld (hl),90h+20h
-ncol4 add hl,bc
- ld (hl),02h+20h
-ncol5 add hl,bc
- ld (hl),082h+20h
-ncol6 add hl,bc
- ld (hl),082h+20h
-ncol7 add hl,bc
- ld (hl),02h+20h
-ncol8 add hl,bc
- ld (hl),90h+20h
-ncol9 add hl,bc
- ld (hl),10h+20h
-ncol10 add hl,bc
- ld (hl),80h+20h
- add hl,bc
- set 2,l
- ld a,(hl)
- res 2,l
- ld (hl),a
-dataseg ld a,0ffh
- out (0b3h),a
- pop de
-ncol11 ret
-
-fillsquare
- xor a
- ld b,20h
-.l1 inc a
- ld (hl),a
- inc l
- dec a
- add a,e
- djnz .l1
- ret
-
defs low -$
+freqmulttable
+ defs 0200h
volumeConvTable
; db 01h ,high triangletable+00,high triangletable+01,high triangletable+02,high triangletable+03,high triangletable+04,high triangletable+05,high triangletable+06
; db high triangletable+07,high triangletable+08,high triangletable+09,high triangletable+10,high triangletable+11,high triangletable+12,high triangletable+13,high triangletable+14
; db 01h ,high sawtoothtable+00,high sawtoothtable+01,high sawtoothtable+02,high sawtoothtable+03,high sawtoothtable+04,high sawtoothtable+05,high sawtoothtable+06
@@ -2439,10 +2418,8 @@
defs 0100h
ringmodtable defs 80h,0afh
defs 80h,0a2h
;b pulse waveform, c b7 ring mod, b6-b5 waveforms, b4-b0 volume (00h triangle, 20 sawtooth, 40h pulse, 60h noise)
-freqmulttable
- defs 0200h
dephase
savexos defs syntlen
@@ -2533,23 +2510,23 @@
xor a
ld (raston+4000h+1),a
ld a,18h ;jr xxxx
setrast ld (calrast+4000h),a
- ld a,b
- dec a
- ld a,3ah
- ld (cyc2off+4000h),a
- ld a,021h ;ld hl,xxxx
- ld hl,intend1
- jr z,cyc2v00
+; ld a,b
+; dec a
+; ld a,3ah
+; ld (cyc2off+4000h),a
+; ld a,021h ;ld hl,xxxx
+; ld hl,intend1
+; jr z,cyc2v00
ld a,32h
ld (cyc2off+4000h),a
ld a,b
ld (intendx+1),a
ld (cyc2val+1+4000h),a
ld hl,intendx
- ld a,0c2h ;jp z,xxxx
-cyc2v00 ld (dispon+4000h),a
+; ld a,0c2h ;jp nz,xxxx
+;cyc2v00 ld (dispon+4000h),a
push bc
push bc
ld de,intcopy ;sidSynth.l23
ld bc,000ch