]>
git.gir.st - Chiptunes-pms150c.git/blob - bsv.c
5bcf31f4fe4d348af400c22ae519f39afed2cef6
3 typedef unsigned char u8
;
12 0x84, 0x9d, 0xb0, 0x69, 0x9d, 0x84, 0x69, 0x58,
13 0x75, 0x8c, 0xb0, 0x69, 0x8c, 0x75, 0x69, 0x58
16 u8 mod3hi
, mod3lo
; //MEM
17 //todo: can mod3hi be aliased to tmp_1?
20 ADD (mod3lo
,acc
) // mod3lo = hi+lo
22 ADDC0 (acc
) // mod3hi, 1bit
28 AND (acc
, 0xf) // (mod3lo>>4)
29 XCH (mod3lo
) // acc=mod3lo, mod3lo=mod3lo>>4
30 AND (acc
, 0xF) // acc=mod3lo&0xf, mod3lo=mod3lo>>4
31 ADD (acc
, mod3lo
) // (mod3lo & 0xF)
35 AND (acc
, 0x3) // acc = (mod3lo & 0x3)
37 SR (mod3lo
) // (mod3lo >> 2)
41 AND (acc
, 0x3) // acc = (mod3lo & 0x3)
43 SR (mod3lo
) // (mod3lo >> 2)
46 if (acc
> 2) { // TODO: acc in [0,1,2,3,4]
52 u8 notes_ix
= acc
& 0x7;
55 u8 result
= ((i1
<<8|i0
)*notes
[notes_ix
])>>8; // keep hi byte
63 MOV (acc
, i2
)// "mov mem,mem"
64 MOV (n
, acc
)// does not exist
84 MOV (tmp_1
, acc
) // fresh tmp_1:
89 OR (acc
, tmp_1
) // tmp_1 done.
117 MOV (tmp_1
, acc
) // acc saved in tmp_1; fresh acc
119 // shift-divide by six
120 // note: i2 is max 0x78; so acc will <= 20. (breaks vor values >=128)
133 AND (acc
, tmp_1
) // acc restored from tmp_1
138 mod3lo
= i2
<<6|i1
>>2;
145 MOV (tmp_1
, acc
) // acc saved in tmp_1; fresh acc
147 // shift-divide by ten
148 // note: i2 is max 0x78; so acc will <= 12.
161 AND (acc
, tmp_1
) // acc restored from tmp_1
170 i1
+= !i0
; // ADDC i1
171 i2
+= !i1
&& !i0
; // ADDC i2
173 if(i2
== 0x78) break;