shithub: pokecrystal

Download patch

ref: 7ead7d8a64f42c25869409131f2664a0233a3f57
parent: a51b73cc04de18505e81f0f033eb8013213ba7d9
author: Bryan Bishop <[email protected]>
date: Wed May 30 18:53:34 EDT 2012

copy in TextBoxBorder from pokered

--- a/main.asm
+++ b/main.asm
@@ -69,7 +69,50 @@
 	ret
 ; 0x591
 
-INCBIN "baserom.gbc",$591,$101e - $591
+INCBIN "baserom.gbc",$591,$ff1 - $591
+
+TextBoxBorder: ; ff1
+; draw a text box
+; upper-left corner at coordinates hl
+; height b
+; width c
+
+    ; first row
+    push hl
+    ld a, "┌"
+    ld [hli], a
+    inc a    ; horizontal border ─
+    call NPlaceChar
+    inc a    ; upper-right border ┐
+    ld [hl], a
+
+    ; middle rows
+    pop hl
+    ld de, 20
+    add hl, de ; skip the top row
+
+.PlaceRow\@
+    push hl
+    ld a, "│"
+    ld [hli], a
+    ld a, " "
+    call NPlaceChar
+    ld [hl], "│"
+
+    pop hl
+    ld de, 20
+    add hl, de ; move to next row
+    dec b
+    jr nz, .PlaceRow\@
+
+    ; bottom row
+    ld a, "└"
+    ld [hli], a
+    ld a, "─"
+    call NPlaceChar
+    ld [hl], "┘"
+    ret
+; 0x101e
 
 NPlaceChar: ; 0x101e
 ; place a row of width c of identical characters