actually thsi adds the interrupt update loop
This commit is contained in:
		
							parent
							
								
									a68812698b
								
							
						
					
					
						commit
						e44d7e492b
					
				@ -118,7 +118,7 @@ Async_Spawn:
 | 
				
			|||||||
  ld [INTERRUPT_LCD + 1], a; set interrupt handler to "ENTER THREAD"
 | 
					  ld [INTERRUPT_LCD + 1], a; set interrupt handler to "ENTER THREAD"
 | 
				
			||||||
  ld a, SAFE_ASYNC_START ; CHANGE ME TO ADJUST SAFE TRANSFER TIMING
 | 
					  ld a, SAFE_ASYNC_START ; CHANGE ME TO ADJUST SAFE TRANSFER TIMING
 | 
				
			||||||
  ld [rLYC], a ; set LYC
 | 
					  ld [rLYC], a ; set LYC
 | 
				
			||||||
  ld hl, rIE  
 | 
					  ld hl, rIE 
 | 
				
			||||||
  set 1, [hl] ; enable vblank
 | 
					  set 1, [hl] ; enable vblank
 | 
				
			||||||
  ld hl, rSTAT
 | 
					  ld hl, rSTAT
 | 
				
			||||||
  set 6, [hl] ; set the stat interrupt to LYC mode
 | 
					  set 6, [hl] ; set the stat interrupt to LYC mode
 | 
				
			||||||
@ -272,7 +272,7 @@ Async_EarlyReturn:
 | 
				
			|||||||
  
 | 
					  
 | 
				
			||||||
  ; unset next call
 | 
					  ; unset next call
 | 
				
			||||||
  ld hl, rIE  
 | 
					  ld hl, rIE  
 | 
				
			||||||
  res 1, [hl] ; disable vblank
 | 
					  res 1, [hl] ; disable stat interrupt
 | 
				
			||||||
  ld hl, rIF 
 | 
					  ld hl, rIF 
 | 
				
			||||||
  res 1, [hl] ; clear the interrupt 
 | 
					  res 1, [hl] ; clear the interrupt 
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										17
									
								
								main.asm
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								main.asm
									
									
									
									
									
								
							@ -56,10 +56,15 @@ def VARIABLE_TILES_START equ 26
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
INCLUDE "hardware.inc"
 | 
					INCLUDE "hardware.inc"
 | 
				
			||||||
SECTION "Interrupts", ROM0[$0]
 | 
					SECTION "Interrupts", ROM0[$0]
 | 
				
			||||||
  ds $48 - @, 0
 | 
					  ds INT_HANDLER_VBLANK - @, 0
 | 
				
			||||||
 | 
					  reti
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  ds INT_HANDLER_STAT - @, 0
 | 
				
			||||||
  call INTERRUPT_LCD - 1
 | 
					  call INTERRUPT_LCD - 1
 | 
				
			||||||
  ret
 | 
					  ret
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SECTION "Header", ROM0[$100]
 | 
					SECTION "Header", ROM0[$100]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  jp EntryPoint
 | 
					  jp EntryPoint
 | 
				
			||||||
@ -270,9 +275,14 @@ Loop:
 | 
				
			|||||||
  call SoundUpdate
 | 
					  call SoundUpdate
 | 
				
			||||||
println "scene update is ", SCENE_UPDATE - 1
 | 
					println "scene update is ", SCENE_UPDATE - 1
 | 
				
			||||||
  call SCENE_UPDATE - 1 ; hope this takes not too many scanlines!
 | 
					  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
 | 
					println "scene draw is ", SCENE_DRAW - 1
 | 
				
			||||||
  call SCENE_DRAW - 1 ; hope this takes fewer than 9 scanlines! 
 | 
					  call SCENE_DRAW - 1 ; hope this takes fewer than 9 scanlines! 
 | 
				
			||||||
@ -286,6 +296,7 @@ println "scene draw is ", SCENE_DRAW - 1
 | 
				
			|||||||
  jp Loop
 | 
					  jp Loop
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
SoundUpdate:
 | 
					SoundUpdate:
 | 
				
			||||||
 | 
					  ret
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ChangeScene: ; hl should be a pointer to, in sequence, setup update draw teardown
 | 
					ChangeScene: ; hl should be a pointer to, in sequence, setup update draw teardown
 | 
				
			||||||
  ;call SCENE_TEARDOWN - 1
 | 
					  ;call SCENE_TEARDOWN - 1
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										
											BIN
										
									
								
								source.zip
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								source.zip
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
		Loading…
	
		Reference in New Issue
	
	Block a user