Skip to content

Commit a7978f4

Browse files
committed
guardrails around cycle sensitive code
1 parent 6010dc8 commit a7978f4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/util/check_region.asm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
checkRegion:
2+
.assert >@vwait1 = >@endVWait, error, "Region detection code crosses page boundary"
3+
24
; region detection via http://forums.nesdev.com/viewtopic.php?p=163258#p163258
35
;;; use the power-on wait to detect video system-
46
ldx #0
@@ -14,6 +16,7 @@ checkRegion:
1416
@noincy:
1517
bit $2002
1618
bpl @vwait2 ; at this point, about 57165 cycles have passed
19+
@endVWait:
1720

1821
;;; BUT because of a hardware oversight, we might have missed a vblank flag.
1922
;;; so we need to both check for 1Vbl and 2Vbl

0 commit comments

Comments
 (0)