Improve VBL bypass in spin(...)
This commit is contained in:
parent
bb0ae40761
commit
214c3f27ea
BIN
bin/GWRAM.dbg.po
BIN
bin/GWRAM.dbg.po
Binary file not shown.
BIN
bin/GWRAM.po
BIN
bin/GWRAM.po
Binary file not shown.
12
util.c
12
util.c
|
@ -13,9 +13,10 @@ char read_applekey(void) { return ((*PB0) | (*PB1)) & 0x80; }
|
||||||
#define SPIN_FRAMESPERCHAR 4
|
#define SPIN_FRAMESPERCHAR 4
|
||||||
void spin(uint8_t x, uint8_t y) {
|
void spin(uint8_t x, uint8_t y) {
|
||||||
char i;
|
char i;
|
||||||
|
unsigned int l;
|
||||||
|
|
||||||
// Sync to frame before starting
|
// Sync to frame before starting
|
||||||
while (*VBL >= 0);
|
for (l = 0; *VBL >= 0 && l < 2500; l++);
|
||||||
|
|
||||||
// Wait and animate spinner.
|
// Wait and animate spinner.
|
||||||
// Spin_half
|
// Spin_half
|
||||||
|
@ -40,14 +41,13 @@ void spin(uint8_t x, uint8_t y) {
|
||||||
|
|
||||||
// Wait specificed number of frames
|
// Wait specificed number of frames
|
||||||
for (k = 0; k < SPIN_FRAMESPERCHAR; k++) {
|
for (k = 0; k < SPIN_FRAMESPERCHAR; k++) {
|
||||||
unsigned char l;
|
for (l = 0; *VBL < 0 && l < 2500; l++);
|
||||||
for (l = 0; *VBL < 0 && l < 255; l++);
|
for (l = 0; *VBL >= 0 && l < 2500; l++);
|
||||||
for (l = 0; *VBL >= 0 && l < 255; l++);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait a frame when finished
|
// Wait a frame when finished
|
||||||
while (*VBL < 0);
|
for (l = 0; *VBL < 0 && l < 2500; l++);
|
||||||
while (*VBL >= 0);
|
for (l = 0; *VBL >= 0 && l < 2500; l++);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue