-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWave_Convert8BitSample.s
More file actions
74 lines (67 loc) · 902 Bytes
/
Wave_Convert8BitSample.s
File metadata and controls
74 lines (67 loc) · 902 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
;Convert 8 Bit signed samples to lhl
;1000 Source Sample(Maximum 16K)
;5000 Converted Sample(8K max)
;7000 Code
.zero
*=$00
source .dsb 2
end .dsb 2
destination .dsb 2
.text
*=$8000
ConvertSample
lda #<$5000
sta destination
lda #>$5000
sta destination+1
ldx #128
ldy #00
.(
loop1 txa
eor #128
tax
lda (source),y
cpx #1
bcc StoreLowNibble
StoreHighNibbleAndIncMem
and #%11110000
bne skip4
lda #%00010000
skip4 ora (destination),y
sta (destination),y
inc destination
bne skip1
inc destination+1
jmp skip1
StoreLowNibble
lsr
lsr
lsr
lsr
bne skip5
lda #1
skip5 sta (destination),y
skip1 lda source
clc
adc #2
sta source
bcc skip2
inc source+1
skip2 lda source+1
cmp end+1
bcc loop1
bne skip3
lda source
cmp end
bcc loop1
beq loop1
skip3 ;Stick a zero at end
.)
lda #00
sta (destination),y
inc destination
.(
bne skip1
inc destination+1
skip1 rts
.)