!to"ksnd.prg",cbm
TEDSND1 = $FF0E ; $FF0E: TED Sound Voice #1 L
TEDSND2 = $FF0F ; $FF0F: TED Sound Voice #2 L
TEDSND2H = $FF10 ; $FF10: TED Sound Voice #2 H
TEDSND = $FF11 ; $FF11: TED Sound Volume,on/off,Wave,D/A
TEDREG = $FF12 ; $FF12: TED Register (Voice #1 H)
TEDBACK = $FF15 ; $FF15: Background-Color
TEDBORDER = $FF19 ; $FF19: TED FRAME
;------------------------------------------------------
;
; Commdore C16 Kikstart Game-Sound
;
; Original-Player: $2aa0
;
; Reassembly and rework: 6.3.2017, M. Sachse
;
; http://www.cbmhardware.de
;
;-------------------------------------------------------
*= $1001
!byte $09,$10,$0a,$00,$9e,$34,$31,$30,$39,$00,$00,$00
*=$100d
sei
lda #$ee
sta TEDBORDER
lda #$1b
sta $ff06
lda #$93
jsr $ffd2
ldx #$21
- lda txt,x
sta $0c00,x
dex
bpl -
lda #$00
sta $34
sta $35
lda #loop
sta $0315
cli
rts
exit: sei
lda #$00
sta TEDSND ; volume: 0
sta $02FE
sta $02FF
lda #$b3 ; system irq
sta $0314
lda #$fc
sta $0315
jsr $FF84 ; Initialize I/O devices
jsr $FF87 ; RAM Test
jsr $FF8A ; Restore vectors to initial values
jsr $FF81 ; Initialize screen editor
jmp $8000 ; cold start
loop: jsr player
ldx #$00 ; waste time
-- ldy #$00
- dey
bne -
inx
cpx #$10
bne --
key: lda #$7f
sta $fd30
sta $ff08
lda $ff08
cmp #$ef
beq exit
bne loop
player: inc $34
lda $34
cmp #$06 ; 6 cycles
bne +
lda #$00
sta $34
inc $35
lda $35
cmp #$c0 ; 192 cycles
bne +
lda #$00
sta $35
+ ldx $35
lda offset,x ; get offset
and #$F0 ; mask to msb
lsr ; shift ..
lsr ; .. down ..
lsr ; .. to ..
lsr ; .. lsb
tay
lda voice1l,y ; get data for voice 1 L
sta TEDSND1
and #%01110000
ora #%11001110
sta TEDBORDER ; some border luma flashing
lda voice1h,y ; get data for voice 1 H
and #$03
ora TEDREG
sta TEDREG ; set voice 1 H
lda offset,x
and #$0F ; mask to lsb
tay
lda voice2l,y ; get data for voice 2 L
sta TEDSND2
lda voice2h,y
sta TEDSND2H ; get data for voice 2 H
lda #$38
sta TEDSND ; volume: 0
rts
txt:
!scr "kikstart 1 sound - space to quit !"
; --- table offsets
offset:
!by $91,$91,$91,$94,$94,$94,$72,$72,$72,$74,$74,$74,$41,$41,$41,$44,$44,$44,$72,
$72,$92,$d4,$d4,$94,$c4,$c4,$c4,$b8,$b8,$b8,$a6,$a6,$86,$88,$88,$88,$64,$64,$64,$68
!by $68,$68,$66,$66,$66,$68,$68,$68,$84,$84,$84,$88,$88,$88,$66,$66,$66,$68,$68,$68,
$44,$44,$44,$48,$48,$48,$66,$66,$86,$d8,$d8,$e8,$d3,$d3,$d3,$c7,$c7,$c7,$a5,$a5
!by $95,$97,$97,$97,$c4,$c4,$c4,$a8,$a8,$a8,$96,$96,$86,$88,$88,$88,$91,$91,$91,$94,
$94,$94,$72,$72,$72,$74,$74,$74,$41,$41,$41,$44,$44,$44,$72,$72,$92,$d4,$d4,$94
!by $c4,$c4,$c4,$b8,$b8,$b8,$a6,$a6,$86,$88,$88,$88,$64,$64,$64,$68,$68,$68,$66,$66,$66,
$68,$68,$68,$c4,$c4,$c4,$b8,$b8,$b8,$a6,$a6,$86,$88,$88,$88,$64,$64,$64,$68
!by $68,$68,$46,$46,$46,$48,$48,$48,$71,$71,$71,$74,$74,$74,$72,$72,$72,$74,$74,$74,
$71,$71,$71,$74,$74,$74,$72,$72,$72,$74,$74,$74
;--- sound frequency table
voice1l:
!by $00,$00,$00,$00,$04,$20,$38,$43,$58,$6a,$73,$7b,$82,$90,$9c,$00
voice1h:
!by $00,$00,$00,$00,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$00
voice2l:
!by $00,$0d,$a9,$ca,$08,$3f,$70,$87,$b0,$00,$00,$00,$00,$00,$00,$00
voice2h:
!by $00,$01,$01,$01,$02,$02,$02,$02,$02,$00,$00,$00,$00,$00,$00,$00
Letzte Änderung: 2019-01-03 11:17:05