fix spacing in main.asm

This commit is contained in:
Bryan Bishop
2012-05-31 01:02:19 -05:00
parent b21600f1ed
commit 232a3001a8

274
main.asm
View File

@@ -35,17 +35,17 @@ DelayFrames: ; 0x468
INCBIN "baserom.gbc",$46f,$52f - $46f INCBIN "baserom.gbc",$46f,$52f - $46f
IncGradGBPalTable_01: ; 0x52f IncGradGBPalTable_01: ; 0x52f
db %11111111 ;BG Pal db %11111111 ;BG Pal
db %11111111 ;OBJ Pal 1 db %11111111 ;OBJ Pal 1
db %11111111 ;OBJ Pal 2 db %11111111 ;OBJ Pal 2
;and so on... ;and so on...
db %11111110 db %11111110
db %11111110 db %11111110
db %11111000 db %11111000
db %11111001 db %11111001
db %11100100 db %11100100
db %11100100 db %11100100
INCBIN "baserom.gbc",$538,$56d - $538 INCBIN "baserom.gbc",$538,$56d - $538
@@ -85,51 +85,51 @@ TextBoxBorder: ; ff1
; height b ; height b
; width c ; width c
; first row ; first row
push hl push hl
ld a, "┌" ld a, "┌"
ld [hli], a ld [hli], a
inc a ; horizontal border ─ inc a ; horizontal border ─
call NPlaceChar call NPlaceChar
inc a ; upper-right border ┐ inc a ; upper-right border ┐
ld [hl], a ld [hl], a
; middle rows ; middle rows
pop hl pop hl
ld de, 20 ld de, 20
add hl, de ; skip the top row add hl, de ; skip the top row
.PlaceRow\@ .PlaceRow\@
push hl push hl
ld a, "│" ld a, "│"
ld [hli], a ld [hli], a
ld a, " " ld a, " "
call NPlaceChar call NPlaceChar
ld [hl], "│" ld [hl], "│"
pop hl pop hl
ld de, 20 ld de, 20
add hl, de ; move to next row add hl, de ; move to next row
dec b dec b
jr nz, .PlaceRow\@ jr nz, .PlaceRow\@
; bottom row ; bottom row
ld a, "└" ld a, "└"
ld [hli], a ld [hli], a
ld a, "─" ld a, "─"
call NPlaceChar call NPlaceChar
ld [hl], "┘" ld [hl], "┘"
ret ret
; 0x101e ; 0x101e
NPlaceChar: ; 0x101e NPlaceChar: ; 0x101e
; place a row of width c of identical characters ; place a row of width c of identical characters
ld d,c ld d,c
.loop\@ .loop\@
ld [hli],a ld [hli],a
dec d dec d
jr nz,.loop\@ jr nz,.loop\@
ret ret
; 0x1024 ; 0x1024
INCBIN "baserom.gbc",$1024,$1273 - $1024 INCBIN "baserom.gbc",$1024,$1273 - $1024
@@ -152,9 +152,9 @@ INCBIN "baserom.gbc",$129c,$1356 - $129c
Char5F: ; 0x1356 Char5F: ; 0x1356
; ends a Pokédex entry ; ends a Pokédex entry
ld [hl],"." ld [hl],"."
pop hl pop hl
ret ret
INCBIN "baserom.gbc",$135a,$26ef - $135a INCBIN "baserom.gbc",$135a,$26ef - $135a
@@ -264,23 +264,23 @@ IsInArray: ; 30e1
; searches an array at hl for the value in a. ; searches an array at hl for the value in a.
; skips (de - 1) bytes between reads, so to check every byte, de should be 1. ; skips (de - 1) bytes between reads, so to check every byte, de should be 1.
; if found, returns count in b and sets carry. ; if found, returns count in b and sets carry.
ld b,0 ld b,0
ld c,a ld c,a
.loop\@ .loop\@
ld a,[hl] ld a,[hl]
cp a,$FF cp a,$FF
jr z,.NotInArray\@ jr z,.NotInArray\@
cp c cp c
jr z,.InArray\@ jr z,.InArray\@
inc b inc b
add hl,de add hl,de
jr .loop\@ jr .loop\@
.NotInArray\@ .NotInArray\@
and a and a
ret ret
.InArray\@ .InArray\@
scf scf
ret ret
; 0x30f4 ; 0x30f4
INCBIN "baserom.gbc",$30f4,$30f7 - $30f4 INCBIN "baserom.gbc",$30f4,$30f7 - $30f4
@@ -318,16 +318,16 @@ CopyDataUntil: ; 318c
; Copies [hl, bc) to [de, bc - hl). ; Copies [hl, bc) to [de, bc - hl).
; In other words, the source data is from hl up to but not including bc, ; In other words, the source data is from hl up to but not including bc,
; and the destination is de. ; and the destination is de.
ld a, [hli] ld a, [hli]
ld [de], a ld [de], a
inc de inc de
ld a, h ld a, h
cp b cp b
jr nz, CopyDataUntil jr nz, CopyDataUntil
ld a, l ld a, l
cp c cp c
jr nz, CopyDataUntil jr nz, CopyDataUntil
ret ret
; 0x3198 ; 0x3198
INCBIN "baserom.gbc",$3198,$31db - $3198 INCBIN "baserom.gbc",$3198,$31db - $3198
@@ -389,71 +389,71 @@ PrintBCDNumber: ; 38bb
; bits 0-4: length of BCD number in bytes ; bits 0-4: length of BCD number in bytes
; Note that bits 5 and 7 are modified during execution. The above reflects ; Note that bits 5 and 7 are modified during execution. The above reflects
; their meaning at the beginning of the functions's execution. ; their meaning at the beginning of the functions's execution.
ld b, c ; save flags in b ld b, c ; save flags in b
res 7, c res 7, c
res 6, c res 6, c
res 5, c ; c now holds the length res 5, c ; c now holds the length
bit 5, b bit 5, b
jr z, .loop\@ jr z, .loop\@
bit 7, b bit 7, b
jr nz, .loop\@ jr nz, .loop\@
ld [hl], "¥" ld [hl], "¥"
inc hl inc hl
.loop\@ .loop\@
ld a, [de] ld a, [de]
swap a swap a
call PrintBCDDigit ; print upper digit call PrintBCDDigit ; print upper digit
ld a, [de] ld a, [de]
call PrintBCDDigit ; print lower digit call PrintBCDDigit ; print lower digit
inc de inc de
dec c dec c
jr nz, .loop\@ jr nz, .loop\@
bit 7, b ; were any non-zero digits printed? bit 7, b ; were any non-zero digits printed?
jr z, .done\@ ; if so, we are done jr z, .done\@ ; if so, we are done
.numberEqualsZero\@ ; if every digit of the BCD number is zero .numberEqualsZero\@ ; if every digit of the BCD number is zero
bit 6, b ; left or right alignment? bit 6, b ; left or right alignment?
jr nz, .skipRightAlignmentAdjustment\@ jr nz, .skipRightAlignmentAdjustment\@
dec hl ; if the string is right-aligned, it needs to be moved back one space dec hl ; if the string is right-aligned, it needs to be moved back one space
.skipRightAlignmentAdjustment\@ .skipRightAlignmentAdjustment\@
bit 5, b bit 5, b
jr z, .skipCurrencySymbol\@ jr z, .skipCurrencySymbol\@
ld [hl], "¥" ; currency symbol ld [hl], "¥" ; currency symbol
inc hl inc hl
.skipCurrencySymbol\@ .skipCurrencySymbol\@
ld [hl], "0" ld [hl], "0"
call PrintLetterDelay call PrintLetterDelay
inc hl inc hl
.done\@ .done\@
ret ret
; 0x38f2 ; 0x38f2
PrintBCDDigit: ; 38f2 PrintBCDDigit: ; 38f2
and a, %00001111 and a, %00001111
and a and a
jr z, .zeroDigit\@ jr z, .zeroDigit\@
.nonzeroDigit\@ .nonzeroDigit\@
bit 7, b ; have any non-space characters been printed? bit 7, b ; have any non-space characters been printed?
jr z, .outputDigit\@ jr z, .outputDigit\@
; if bit 7 is set, then no numbers have been printed yet ; if bit 7 is set, then no numbers have been printed yet
bit 5, b ; print the currency symbol? bit 5, b ; print the currency symbol?
jr z, .skipCurrencySymbol\@ jr z, .skipCurrencySymbol\@
ld [hl], "¥" ld [hl], "¥"
inc hl inc hl
res 5, b res 5, b
.skipCurrencySymbol\@ .skipCurrencySymbol\@
res 7, b ; unset 7 to indicate that a nonzero digit has been reached res 7, b ; unset 7 to indicate that a nonzero digit has been reached
.outputDigit\@ .outputDigit\@
add a, "0" add a, "0"
ld [hli], a ld [hli], a
jp PrintLetterDelay jp PrintLetterDelay
.zeroDigit\@ .zeroDigit\@
bit 7, b ; either printing leading zeroes or already reached a nonzero digit? bit 7, b ; either printing leading zeroes or already reached a nonzero digit?
jr z, .outputDigit\@ ; if so, print a zero digit jr z, .outputDigit\@ ; if so, print a zero digit
bit 6, b ; left or right alignment? bit 6, b ; left or right alignment?
ret nz ret nz
ld a, " " ld a, " "
ld [hli], a ; if right-aligned, "print" a space by advancing the pointer ld [hli], a ; if right-aligned, "print" a space by advancing the pointer
ret ret
; 0x3917 ; 0x3917
INCBIN "baserom.gbc",$3917,$4000 - $3917 INCBIN "baserom.gbc",$3917,$4000 - $3917
@@ -463,12 +463,12 @@ SECTION "bank1",DATA,BANK[$1]
INCBIN "baserom.gbc",$4000,$617c - $4000 INCBIN "baserom.gbc",$4000,$617c - $4000
IntroFadePalettes: ; 0x617c IntroFadePalettes: ; 0x617c
db %01010100 db %01010100
db %10101000 db %10101000
db %11111100 db %11111100
db %11111000 db %11111000
db %11110100 db %11110100
db %11100100 db %11100100
INCBIN "baserom.gbc",$6182,$8000 - $6182 INCBIN "baserom.gbc",$6182,$8000 - $6182
@@ -695,19 +695,15 @@ SpecialsPointers: ; 0xc029
INCBIN "baserom.gbc",$c224,$c644 - $c224 INCBIN "baserom.gbc",$c224,$c644 - $c224
; prints a leading zero unless they are turned off in the flags
PrintNumber_PrintLeadingZero: ; c644 PrintNumber_PrintLeadingZero: ; c644
bit 7,d ; print leading zeroes? ; prints a leading zero unless they are turned off in the flags
ret z bit 7, d ; print leading zeroes?
ld [hl],"0" ret z
ret ld [hl], "0"
ret
INCBIN "baserom.gbc",$c64a,$ffff - $c64a INCBIN "baserom.gbc",$c64a,$ffff - $c64a
;UnknownText_0xffff: ; 0xffff
; db $0, $21, "ふまひ?へKぷへ", $57
;; 0x1000a
SECTION "bank4",DATA,BANK[$4] SECTION "bank4",DATA,BANK[$4]
INCBIN "baserom.gbc",$10000,$14000 - $10000 INCBIN "baserom.gbc",$10000,$14000 - $10000