shithub: pokecrystal

Download patch

ref: 651e0a4245d8749e7926fce01110a12bb7453246
parent: 64bb7d2253b0b964fcd052562c96bc39e0b01012
author: yenatch <[email protected]>
date: Tue Aug 27 16:56:28 EDT 2013

LYOverrides in main.asm

--- a/main.asm
+++ b/main.asm
@@ -249,11 +249,12 @@
 	cp rSCX & $ff
 	ret nz
 	ld c, a
-	ld a, [$d100]
+	ld a, [LYOverrides]
 	ld [$ff00+c], a
 	ret
 ; 552
 
+
 LCD: ; 552
 	push af
 	ld a, [hLCDStatCustom]
@@ -264,7 +265,7 @@
 	push bc
 	ld a, [rLY]
 	ld c, a
-	ld b, $d100 >> 8
+	ld b, LYOverrides >> 8
 	ld a, [bc]
 	ld b, a
 	ld a, [hLCDStatCustom]
@@ -279,7 +280,6 @@
 ; 568
 
 
-
 DisableLCD: ; 568
 ; Turn the LCD off
 
@@ -71398,7 +71398,7 @@
 	call DrawGraphic
 	
 ; Draw copyright text
-	ld hl, $9c03 ; BG Map 1 (3,0)
+	ld hl, $9c03 ; BGMap1(3,0)
 	ld bc, $010d ; 13x1
 	ld d, $c
 	ld e, $10
@@ -71436,11 +71436,9 @@
 	
 ; LY/SCX trickery starts here
 	
-; Save WRAM bank
 	ld a, [rSVBK]
 	push af
-; WRAM bank 5
-	ld a, 5
+	ld a, 5 ; BANK(LYOverrides)
 	ld [rSVBK], a
 	
 ; Make alternating lines come in from opposite sides
@@ -71448,21 +71446,21 @@
 ; ( This part is actually totally pointless, you can't
 ;   see anything until these values are overwritten!  )
 
-	ld b, 40 ; alternate for 80 lines
-	ld hl, $d100 ; LY buffer
+	ld b, 80 / 2 ; alternate for 80 lines
+	ld hl, LYOverrides
 .loop
 ; $00 is the middle position
-	ld [hl], $70 ; coming from the left
+	ld [hl], +112 ; coming from the left
 	inc hl
-	ld [hl], $90 ; coming from the right
+	ld [hl], -112 ; coming from the right
 	inc hl
 	dec b
 	jr nz, .loop
 	
 ; Make sure the rest of the buffer is empty
-	ld hl, $d150
+	ld hl, LYOverrides + 80
 	xor a
-	ld bc, $0040
+	ld bc, LYOverridesEnd - (LYOverrides + 80)
 	call ByteFill
 	
 ; Let LCD Stat know we're messing around with SCX
@@ -71469,7 +71467,6 @@
 	ld a, rSCX - rJOYP
 	ld [hLCDStatCustom], a
 	
-; Restore WRAM bank
 	pop af
 	ld [rSVBK], a
 	
@@ -71483,14 +71480,13 @@
 	set 2, a
 	ld [rLCDC], a
 	
-;
-	ld a, $70
+	ld a, +112
 	ld [hSCX], a
-	ld a, $8
+	ld a, 8
 	ld [hSCY], a
-	ld a, $7
+	ld a, 7
 	ld [hWX], a
-	ld a, $90
+	ld a, -112
 	ld [hWY], a
 	
 	ld a, $1