Created
January 17, 2017 18:50
-
-
Save jacobly0/6715972f3e057538c8474336d4802086 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| define time | |
| namespace time | |
| macro init | |
| ld de, 48000000/100 | |
| ld hl, ti.mpTmr1Counter | |
| ld (hl), de | |
| ld l, ti.tmr1Counter + 3 | |
| ld (hl), e | |
| inc l; ti.tmr1Load | |
| ld (hl), de | |
| ld l, ti.tmr1Load + 3 | |
| ld bc, 5 | |
| call ti.MemClear | |
| ld l, ti.tmrCtrl | |
| ld (hl), bc | |
| dec bc | |
| ld l, ti.tmrIntStatus | |
| ld (hl), bc | |
| ld l, ti.tmrCtrl | |
| ld (hl), ti.tmr1Enable or ti.tmr1IntOverflow | |
| end macro | |
| tick: ld hl, ti.mpTmrIntStatus | |
| ld (hl), ti.tmr1IntOverflow | |
| ld l, ti.tmr1Match1 | |
| inc (hl) | |
| ret nz | |
| inc hl | |
| ld de, (hl) | |
| inc de | |
| ld (hl), de | |
| .smc: ret | |
| end namespace |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment