From a15bd15e2adb91922661015b2e7a35b352c64af7 Mon Sep 17 00:00:00 2001 From: yenatch Date: Sun, 22 Dec 2013 06:00:34 -0500 Subject: [PATCH] split gbc-only screen into misc/gbc_only.asm --- main.asm | 151 +--------------------------------------------- misc/gbc_only.asm | 150 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 151 insertions(+), 150 deletions(-) create mode 100644 misc/gbc_only.asm diff --git a/main.asm b/main.asm index db55a4ce9..62283181a 100644 --- a/main.asm +++ b/main.asm @@ -50435,156 +50435,7 @@ CheckBattleScene: ; 4ea44 ; 4ea82 - -GBCOnlyScreen: ; 4ea82 - - ld a, [hCGB] - and a - ret nz - - ld de, MUSIC_NONE - call PlayMusic - - call ClearTileMap - - ld hl, GBCOnlyGFX - ld de, $d000 - ld a, [rSVBK] - push af - ld a, 0 - ld [rSVBK], a - call Decompress - pop af - ld [rSVBK], a - - ld de, $d000 - ld hl, VTiles2 - lb bc, BANK(GBCOnlyGFX), $54 - call Get2bpp - - ld de, Font - ld hl, VTiles1 - lb bc, BANK(Font), $80 - call Get1bpp - - call DrawGBCOnlyScreen - - call WaitBGMap - -; better luck next time -.loop - call DelayFrame - jr .loop -; 4eac5 - - -DrawGBCOnlyScreen: ; 4eac5 - - call DrawGBCOnlyBorder - - ; Pokemon - hlcoord 3, 2 - ld b, 14 - ld c, 4 - ld a, $8 - call DrawGBCOnlyGraphic - - ; Crystal - hlcoord 5, 6 - ld b, 10 - ld c, 2 - ld a, $40 - call DrawGBCOnlyGraphic - - ld de, GBCOnlyString - hlcoord 1, 10 - call PlaceString - - ret -; 4eaea - - -DrawGBCOnlyBorder: ; 4eaea - - hlcoord 0, 0 - ld [hl], 0 ; top-left - - inc hl - ld a, 1 ; top - call .FillRow - - ld [hl], 2 ; top-right - - hlcoord 0, 1 - ld a, 3 ; left - call .FillColumn - - hlcoord 19, 1 - ld a, 4 ; right - call .FillColumn - - hlcoord 0, 17 - ld [hl], 5 ; bottom-left - - inc hl - ld a, 6 ; bottom - call .FillRow - - ld [hl], 7 ; bottom-right - ret -; 4eb15 - -.FillRow ; 4eb15 - ld c, SCREEN_WIDTH - 2 -.next_column - ld [hli], a - dec c - jr nz, .next_column - ret -; 4eb1c - -.FillColumn ; 4eb1c - ld de, SCREEN_WIDTH - ld c, SCREEN_HEIGHT - 2 -.next_row - ld [hl], a - add hl, de - dec c - jr nz, .next_row - ret -; 4eb27 - - -DrawGBCOnlyGraphic: ; 4eb27 - ld de, SCREEN_WIDTH -.y - push bc - push hl -.x - ld [hli], a - inc a - dec b - jr nz, .x - pop hl - add hl, de - pop bc - dec c - jr nz, .y - ret -; 4eb38 - - -GBCOnlyString: ; 4eb38 - db "This Game Pak is", $4e - db "designed only for", $4e - db "use on the", $4e - db "Game Boy Color.@" -; 4eb76 - - -GBCOnlyGFX: ; 4eb76 -INCBIN "gfx/misc/gbc_only.lz" -; 4f0bc +INCLUDE "misc/gbc_only.asm" Function4f0bc: ; 4f0bc diff --git a/misc/gbc_only.asm b/misc/gbc_only.asm new file mode 100644 index 000000000..dfe9e2fb6 --- /dev/null +++ b/misc/gbc_only.asm @@ -0,0 +1,150 @@ +GBCOnlyScreen: ; 4ea82 + + ld a, [hCGB] + and a + ret nz + + ld de, MUSIC_NONE + call PlayMusic + + call ClearTileMap + + ld hl, GBCOnlyGFX + ld de, $d000 + ld a, [rSVBK] + push af + ld a, 0 + ld [rSVBK], a + call Decompress + pop af + ld [rSVBK], a + + ld de, $d000 + ld hl, VTiles2 + lb bc, BANK(GBCOnlyGFX), $54 + call Get2bpp + + ld de, Font + ld hl, VTiles1 + lb bc, BANK(Font), $80 + call Get1bpp + + call DrawGBCOnlyScreen + + call WaitBGMap + +; better luck next time +.loop + call DelayFrame + jr .loop +; 4eac5 + + +DrawGBCOnlyScreen: ; 4eac5 + + call DrawGBCOnlyBorder + + ; Pokemon + hlcoord 3, 2 + ld b, 14 + ld c, 4 + ld a, $8 + call DrawGBCOnlyGraphic + + ; Crystal + hlcoord 5, 6 + ld b, 10 + ld c, 2 + ld a, $40 + call DrawGBCOnlyGraphic + + ld de, GBCOnlyString + hlcoord 1, 10 + call PlaceString + + ret +; 4eaea + + +DrawGBCOnlyBorder: ; 4eaea + + hlcoord 0, 0 + ld [hl], 0 ; top-left + + inc hl + ld a, 1 ; top + call .FillRow + + ld [hl], 2 ; top-right + + hlcoord 0, 1 + ld a, 3 ; left + call .FillColumn + + hlcoord 19, 1 + ld a, 4 ; right + call .FillColumn + + hlcoord 0, 17 + ld [hl], 5 ; bottom-left + + inc hl + ld a, 6 ; bottom + call .FillRow + + ld [hl], 7 ; bottom-right + ret +; 4eb15 + +.FillRow ; 4eb15 + ld c, SCREEN_WIDTH - 2 +.next_column + ld [hli], a + dec c + jr nz, .next_column + ret +; 4eb1c + +.FillColumn ; 4eb1c + ld de, SCREEN_WIDTH + ld c, SCREEN_HEIGHT - 2 +.next_row + ld [hl], a + add hl, de + dec c + jr nz, .next_row + ret +; 4eb27 + + +DrawGBCOnlyGraphic: ; 4eb27 + ld de, SCREEN_WIDTH +.y + push bc + push hl +.x + ld [hli], a + inc a + dec b + jr nz, .x + pop hl + add hl, de + pop bc + dec c + jr nz, .y + ret +; 4eb38 + + +GBCOnlyString: ; 4eb38 + db "This Game Pak is", $4e + db "designed only for", $4e + db "use on the", $4e + db "Game Boy Color.@" +; 4eb76 + + +GBCOnlyGFX: ; 4eb76 +INCBIN "gfx/misc/gbc_only.lz" +; 4f0bc +