Closed xen0bit closed 3 years ago
While the "time" import still doesn't seem to be working, you can reference my example code here to make a basic timer:
https://github.com/xen0bit/gbablog/commit/276e29cd699b97a75e4de65bd232d5fba2d3493c
In the example I hook machine.IRQ_VBLANK which fires the interrupt handler roughly 59.71540070833901659232620059483728860926694 times a second. Working backward from that, you can make your own timer.
I may submit a PR to hook the actual IRQ_TIMER0 in a way that "time" will work, but for now this is a valid workaround and I'm closing this. Thanks to all who worked on the interrupts API.
tinygo build -target gameboy-advance -o .\timetest.gba timetest.go
Expected result: There is some sort of delay before drawing the red square Actual result: The red square is drawn immediately
Tested behavior in m-gba, visualboy advance, iodine, gbajs, and even on a legitimate Gameboy Advance SP using a flash cart.
It seems like I must be missing something obvious because this should be extremely straightforward to perform. Is time just not working for this target?