From e44d7e492b1e553bdb79df7b1bcfcf4729343853 Mon Sep 17 00:00:00 2001 From: shoofle Date: Sun, 30 Mar 2025 10:53:51 -0400 Subject: [PATCH] actually thsi adds the interrupt update loop --- Async.inc | 4 ++-- main.asm | 17 ++++++++++++++--- source.zip | Bin 419344 -> 419454 bytes 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/Async.inc b/Async.inc index 951c2bb..6a2ab67 100644 --- a/Async.inc +++ b/Async.inc @@ -118,7 +118,7 @@ Async_Spawn: ld [INTERRUPT_LCD + 1], a; set interrupt handler to "ENTER THREAD" ld a, SAFE_ASYNC_START ; CHANGE ME TO ADJUST SAFE TRANSFER TIMING ld [rLYC], a ; set LYC - ld hl, rIE + ld hl, rIE set 1, [hl] ; enable vblank ld hl, rSTAT set 6, [hl] ; set the stat interrupt to LYC mode @@ -272,7 +272,7 @@ Async_EarlyReturn: ; unset next call ld hl, rIE - res 1, [hl] ; disable vblank + res 1, [hl] ; disable stat interrupt ld hl, rIF res 1, [hl] ; clear the interrupt diff --git a/main.asm b/main.asm index d08ad60..be80b5b 100644 --- a/main.asm +++ b/main.asm @@ -56,10 +56,15 @@ def VARIABLE_TILES_START equ 26 INCLUDE "hardware.inc" SECTION "Interrupts", ROM0[$0] - ds $48 - @, 0 + ds INT_HANDLER_VBLANK - @, 0 + reti + + ds INT_HANDLER_STAT - @, 0 call INTERRUPT_LCD - 1 ret + + SECTION "Header", ROM0[$100] jp EntryPoint @@ -270,9 +275,14 @@ Loop: call SoundUpdate println "scene update is ", SCENE_UPDATE - 1 call SCENE_UPDATE - 1 ; hope this takes not too many scanlines! - ld b, 144 - call AwaitLine + di + ld a, [rIE] + or a, IEF_VBLANK + ld [rIE], a + ei + + halt println "scene draw is ", SCENE_DRAW - 1 call SCENE_DRAW - 1 ; hope this takes fewer than 9 scanlines! @@ -286,6 +296,7 @@ println "scene draw is ", SCENE_DRAW - 1 jp Loop SoundUpdate: + ret ChangeScene: ; hl should be a pointer to, in sequence, setup update draw teardown ;call SCENE_TEARDOWN - 1 diff --git a/source.zip b/source.zip index 338c939c3a61ed8eba0a94c921e6859fc009bc24..d586910a64bcb47ef7bd7f8bc6a7273b7fb0434b 100644 GIT binary patch delta 998 zcmY+DYe*DP7=~wNXO0)#%9L_T*At~_uGa)LE$_CjCX$O#wwKwRfmYYs?5@(y9}yA- zwib58%833*kRX|p1>x_~$RNl+fgu`(P#_vYOY_aFk;Bfu&-vU{11y`_VA|^M$1bbeT27aW0nnoARpu1PRrxlg2WznHZ6(ss`I)L#Ztv>>gIYUdC z08iHFFUbH`^vql;fF++PQ7bo_n4c%0a(RFej{+>dWF8y@=$mJX)ykXS%Qws+yjvGm5oIJIZNz2gW74l zd10vAOi|r(M2K}o6xB9Z9p>_es`~1)j^>K`@`gH`iOWnlCmLf(^m`Oheu5AGA8fLg zTZxzB(in{8yBxQ?w+ccK_6nFc;TEa3+NQWp30!S;O}MufP)ALeht6VnhKsz{FApVf zgEXg3ET*^bncUzO@&N9nqwB{2;;iUilmcYThF}ZG zHybJjO|~Q0Hqv6({IFdc|71r+P}e&&H9NH2jj+x*Pzj8O9H;=az==+Q_Bs)4ADMP) z{WhH1b9ua$@8Y%kb6)HFokyjRPj_ivaG{gnpSn;5=!#2wF2#*Xc5XT8a3gp(GU7&w z^aPRJ$e0X=!q{&VmN<%nJ61jY+kXjU-HmVtgi_}}k3UjQ4%|CK8A~ix+1Yi;>hX%c z`vQtDg#5qrp`4M(?S86m{$Z(h-qVrA``R1pXeOT8{^ZDQL0Q=V857W9Sm+$sEwU=0 wLtynHN@U{NNrs3p_%q=5ZIU(-!DmMX6;J;n)%(7n~ z5fz5PBP%OHFoPg8my)FaqR_xVNC-(d35q}>`UP4$yJsM@@b>$ec{B6gzBju(Y44r1 zC)ZT*#KPd?Z+)Dc-_H44N6OkiyHRro<||OwepL7Cs-5<*%liz7vUhS29Jg4j3nA|X z8_h$w_l14uMCh_|Q&|X=UarLOT&(35ccJIxRZhu9n190EOhf3N=86r^_)qR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