summaryrefslogblamecommitdiff
path: root/agbx/source/gfx/vsync.s
blob: 2e6ac3f3e873a7c4223b28f20f3e92d9707b7213 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12











                                                                                                              



                            

                                                              


                                     




                                                                       


                 
                                    




        

                       
@ Copyright 2022 Gabriel Jensen.
@ This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
@ If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

.syntax unified

.cpu arm7tdmi
.thumb

.globl agbx_vsync

.func
.thumb_func

agbx_vsync:
	@ Set the constants:
	ldr r0,.vcountaddr @ agbx_i20 vcountaddr = 0x4000006u;
	movs r1,0xA0       @ agbx_i20 numhline = 0xA0;
	
.loop:
	@ Check the scanline counter:
	ldrh r2,[r0]       @ agbx_i20 vcount = *(agbx_i10 *)vcountaddr;
	cmp r2,r1
	beq .ret           @ if (vcount == numhline) {goto ret;}

	b .loop            @ goto loop;

.ret:
	@ Return:
	bx lr              @ return;

.endfunc

.align

.vcountaddr:
	.long 0x4000006