]>
git.gir.st - Chiptunes.git/blob - foo.c
87655bf37d9a6fc0638c039ab9c8360c371bd4ee
3 typedef unsigned char u8
;
6 0x84, 0x9d, 0xb0, 0x69, 0x9d, 0x84, 0x69, 0x58,
7 0x75, 0x8c, 0xb0, 0x69, 0x8c, 0x75, 0x69, 0x58
19 u8 t
;/*==Ml*/ //r26 (Xlo)
20 u8 x
;/*==Mh*/ //r27 (Xhi)
23 /*fakestack_l*/ //r30 (Zlo)
24 /*fakestack_h*/ //r31 (Zhi)
25 #define Mh x //mod3 vars
27 //http://homepage.divms.uiowa.edu/~jones/bcd/mod.shtml
33 ADC (Mh
, zero
, carry
) //Mh only holds the carry bit
58 void mul(void) { //don't need overhead of function (inline it)
63 // start MUL -- 92 cycles :( (unrolled and skipping second bit: 76)
67 //sorted by ocurrence, then longest cycle count first
68 CPI (t
, 0x69) // most common
82 mul_58
: // 0101 1000 (24cy)
107 mul_69
: // 0110 1001 (26cy)
134 mul_75
: // 0111 0101 (28cy)
163 mul_84
: // 1000 0100 (22cy)
186 mul_8c
: // 1000 1100 (24cy)
211 mul_9d
: // 1001 1101 (28cy)
240 mul_b0
: // 1011 0000 (22cy)
274 // tempvars: `x` and `_`
285 /*MOV X_hi==x, data_hi
290 RCALL
mul(); //stores used value in in x
292 RET
//TODO: replace CALL/RET with IJMP?
446 putchar(acc
<<4); //TODO
449 ADC (i2
, zero
, !i0
&&!i1
)
450 ADC (i3
, zero
, !i0
&&!i1
&&!i2
)