Update bootrom code with the latest hardware.inc

This commit is contained in:
Rangi42
2024-06-20 01:30:54 -04:00
parent 3116f63e37
commit 9588cf44aa
11 changed files with 704 additions and 492 deletions

View File

@@ -1,2 +1,2 @@
DEF AGB = 1 DEF AGB = 1
include "cgb_boot.asm" include "cgb_boot.asm"

View File

@@ -1,2 +1,2 @@
DEF CGB0 = 1 DEF CGB0 = 1
include "cgb_boot.asm" include "cgb_boot.asm"

File diff suppressed because it is too large Load Diff

View File

@@ -1,2 +1,2 @@
DEF FAST = 1 DEF FAST = 1
include "cgb_boot.asm" include "cgb_boot.asm"

View File

@@ -1,14 +1,14 @@
; SameBoy DMG bootstrap ROM ; SameBoy DMG bootstrap ROM
INCLUDE "hardware.inc" include "sameboot.inc"
SECTION "BootCode", ROM0[$0] SECTION "BootCode", ROM0[$0000]
Start: Start:
; Init stack pointer ; Init stack pointer
ld sp, $fffe ld sp, $FFFE
; Clear memory VRAM ; Clear memory VRAM
ld hl, $8000 ld hl, _VRAM
xor a xor a
.clearVRAMLoop .clearVRAMLoop
@@ -17,24 +17,25 @@ Start:
jr z, .clearVRAMLoop jr z, .clearVRAMLoop
; Init Audio ; Init Audio
ld a, $80 ld a, AUDENA_ON
ldh [rNR52], a ldh [rNR52], a
assert AUDENA_ON == AUDLEN_DUTY_50
ldh [rNR11], a ldh [rNR11], a
ld a, $f3 ld a, $F3
ldh [rNR12], a ldh [rNR12], a ; Envelope $F, decreasing, sweep $3
ldh [rNR51], a ldh [rNR51], a ; Channels 1+2+3+4 left, channels 1+2 right
ld a, $77 ld a, $77
ldh [rNR50], a ldh [rNR50], a ; Volume $7, left and right
; Init BG palette ; Init BG palette
ld a, $54 ld a, %01_01_01_00
ldh [rBGP], a ldh [rBGP], a
; Load logo from ROM. ; Load logo from ROM.
; A nibble represents a 4-pixels line, 2 bytes represent a 4x4 tile, scaled to 8x8. ; A nibble represents a 4-pixels line, 2 bytes represent a 4x4 tile, scaled to 8x8.
; Tiles are ordered left to right, top to bottom. ; Tiles are ordered left to right, top to bottom.
ld de, $104 ; Logo start ld de, NintendoLogo
ld hl, $8010 ; This is where we load the tiles in VRAM ld hl, _VRAM + $10 ; This is where we load the tiles in VRAM
.loadLogoLoop .loadLogoLoop
ld a, [de] ; Read 2 rows ld a, [de] ; Read 2 rows
@@ -43,45 +44,45 @@ Start:
call DoubleBitsAndWriteRow call DoubleBitsAndWriteRow
inc de inc de
ld a, e ld a, e
xor $34 ; End of logo xor LOW(NintendoLogoEnd)
jr nz, .loadLogoLoop jr nz, .loadLogoLoop
; Load trademark symbol ; Load trademark symbol
ld de, TrademarkSymbol ld de, TrademarkSymbol
ld c,$08 ld c, TrademarkSymbolEnd - TrademarkSymbol
.loadTrademarkSymbolLoop: .loadTrademarkSymbolLoop:
ld a,[de] ld a, [de]
inc de inc de
ldi [hl],a ldi [hl], a
inc hl inc hl
dec c dec c
jr nz, .loadTrademarkSymbolLoop jr nz, .loadTrademarkSymbolLoop
; Set up tilemap ; Set up tilemap
ld a,$19 ; Trademark symbol ld a, $19 ; Trademark symbol tile ID
ld [$9910], a ; ... put in the superscript position ld [_SCRN0 + 8 * SCRN_VX_B + 16], a ; ... put in the superscript position
ld hl,$992f ; Bottom right corner of the logo ld hl, _SCRN0 + 9 * SCRN_VX_B + 15 ; Bottom right corner of the logo
ld c,$c ; Tiles in a logo row ld c, 12 ; Tiles in a logo row
.tilemapLoop .tilemapLoop
dec a dec a
jr z, .tilemapDone jr z, .tilemapDone
ldd [hl], a ldd [hl], a
dec c dec c
jr nz, .tilemapLoop jr nz, .tilemapLoop
ld l,$0f ; Jump to top row ld l, $0F ; Jump to top row
jr .tilemapLoop jr .tilemapLoop
.tilemapDone .tilemapDone
ld a, 30 ld a, 30
ldh [rSCY], a ldh [rSCY], a
; Turn on LCD ; Turn on LCD
ld a, $91 ld a, LCDCF_ON | LCDCF_BLK01 | LCDCF_BGON
ldh [rLCDC], a ldh [rLCDC], a
ld d, (-119) & $FF ld d, LOW(-119)
ld c, 15 ld c, 15
.animate .animate
call WaitFrame call WaitFrame
ld a, d ld a, d
@@ -94,41 +95,41 @@ Start:
ld a, c ld a, c
cp 8 cp 8
jr nz, .noPaletteChange jr nz, .noPaletteChange
ld a, $A8 ld a, %10_10_10_00
ldh [rBGP], a ldh [rBGP], a
.noPaletteChange .noPaletteChange
dec c dec c
jr nz, .animate jr nz, .animate
ld a, $fc ld a, %11_11_11_00
ldh [rBGP], a ldh [rBGP], a
; Play first sound ; Play first sound
ld a, $83 ld a, $83
call PlaySound call PlaySound
ld b, 5 ld b, 5
call WaitBFrames call WaitBFrames
; Play second sound ; Play second sound
ld a, $c1 ld a, $C1
call PlaySound call PlaySound
; Wait ~1 second ; Wait ~1 second
ld b, 60 ld b, 60
call WaitBFrames call WaitBFrames
; Set registers to match the original DMG boot ; Set registers to match the original DMG boot
IF DEF(MGB) IF DEF(MGB)
ld hl, $FFB0 ld hl, (BOOTUP_A_MGB << 8) | $B0
ELSE ELSE
ld hl, $01B0 ld hl, (BOOTUP_A_DMG << 8) | $B0
ENDC ENDC
push hl push hl
pop af pop af
ld hl, $014D ld hl, HeaderChecksum
ld bc, $0013 lb bc, 0, LOW(rNR13) ; $0013
ld de, $00D8 lb de, 0, $D8 ; $00D8
; Boot the game ; Boot the game
jp BootGame jp BootGame
@@ -155,7 +156,7 @@ DoubleBitsAndWriteRow:
WaitFrame: WaitFrame:
push hl push hl
ld hl, $FF0F ld hl, rIF
res 0, [hl] res 0, [hl]
.wait .wait
bit 0, [hl] bit 0, [hl]
@@ -171,14 +172,25 @@ WaitBFrames:
PlaySound: PlaySound:
ldh [rNR13], a ldh [rNR13], a
ld a, $87 ld a, AUDHIGH_RESTART | $7
ldh [rNR14], a ldh [rNR14], a
ret ret
TrademarkSymbol: TrademarkSymbol:
db $3c,$42,$b9,$a5,$b9,$a5,$42,$3c pusho
opt b.X
db %..XXXX..
db %.X....X.
db %X.XXX..X
db %X.X..X.X
db %X.XXX..X
db %X.X..X.X
db %.X....X.
db %..XXXX..
popo
TrademarkSymbolEnd:
SECTION "BootGame", ROM0[$fe] SECTION "BootGame", ROM0[$00FE]
BootGame: BootGame:
ldh [rBANK], a ; unmap boot ROM ldh [rBANK], a ; unmap boot ROM

View File

@@ -1,9 +1,16 @@
;* ;*
;* Gameboy Hardware definitions ;* Gameboy Hardware definitions
;* https://github.com/gbdev/hardware.inc
;* ;*
;* Based on Jones' hardware.inc ;* Based on Jones' hardware.inc
;* And based on Carsten Sorensen's ideas. ;* And based on Carsten Sorensen's ideas.
;* ;*
;* To the extent possible under law, the authors of this work have
;* waived all copyright and related or neighboring rights to the work.
;* See https://creativecommons.org/publicdomain/zero/1.0/ for details.
;*
;* SPDX-License-Identifier: CC0-1.0
;*
;* Rev 1.1 - 15-Jul-97 : Added define check ;* Rev 1.1 - 15-Jul-97 : Added define check
;* Rev 1.2 - 18-Jul-97 : Added revision check macro ;* Rev 1.2 - 18-Jul-97 : Added revision check macro
;* Rev 1.3 - 19-Jul-97 : Modified for RGBASM V1.05 ;* Rev 1.3 - 19-Jul-97 : Modified for RGBASM V1.05
@@ -31,6 +38,17 @@
;* Rev 4.3 - 07-Nov-21 : Deprecate VRAM address constants (Eievui) ;* Rev 4.3 - 07-Nov-21 : Deprecate VRAM address constants (Eievui)
;* Rev 4.4 - 11-Jan-22 : Deprecate VRAM CART_SRAM_2KB constant (avivace) ;* Rev 4.4 - 11-Jan-22 : Deprecate VRAM CART_SRAM_2KB constant (avivace)
;* Rev 4.5 - 03-Mar-22 : Added bit number definitions for OCPS, BCPS and LCDC (sukus) ;* Rev 4.5 - 03-Mar-22 : Added bit number definitions for OCPS, BCPS and LCDC (sukus)
;* Rev 4.6 - 15-Jun-22 : Added MBC3 registers and special values
;* Rev 4.7.0 - 27-Jun-22 : Added alternate names for some constants
;* Rev 4.7.1 - 05-Jul-22 : Added RPB_LED_ON constant
;* Rev 4.8.0 - 25-Oct-22 : Changed background addressing constants (zlago)
;* Rev 4.8.1 - 29-Apr-23 : Added rOPRI (rbong)
;* Rev 4.9.0 - 24-Jun-23 : Added definitions for interrupt vectors (sukus)
;* Rev 4.9.1 - 11-Sep-23 : Added repository link and CC0 waiver notice
; NOTE: REVISION NUMBER CHANGES MUST BE REFLECTED
; IN `rev_Check_hardware_inc` BELOW!
IF __RGBDS_MAJOR__ == 0 && __RGBDS_MINOR__ < 5 IF __RGBDS_MAJOR__ == 0 && __RGBDS_MINOR__ < 5
FAIL "This version of 'hardware.inc' requires RGBDS version 0.5.0 or later." FAIL "This version of 'hardware.inc' requires RGBDS version 0.5.0 or later."
@@ -41,14 +59,31 @@ ENDC
IF !DEF(HARDWARE_INC) IF !DEF(HARDWARE_INC)
DEF HARDWARE_INC EQU 1 DEF HARDWARE_INC EQU 1
; Usage: rev_Check_hardware_inc <min_ver>
; Examples: rev_Check_hardware_inc 4.1.2
; rev_Check_hardware_inc 4.1 (equivalent to 4.1.0)
; rev_Check_hardware_inc 4 (equivalent to 4.0.0)
MACRO rev_Check_hardware_inc MACRO rev_Check_hardware_inc
;NOTE: REVISION NUMBER CHANGES MUST BE ADDED DEF CUR_VER equs "4,9,1" ; ** UPDATE THIS LINE WHEN CHANGING THE REVISION NUMBER **
;TO SECOND PARAMETER IN FOLLOWING LINE.
IF \1 > 4.5 ;PUT REVISION NUMBER HERE DEF MIN_VER equs STRRPL("\1", ".", ",")
WARN "Version \1 or later of 'hardware.inc' is required." DEF INTERNAL_CHK equs """MACRO ___internal
IF \\1 != \\4 || \\2 < \\5 || (\\2 == \\5 && \\3 < \\6)
FAIL "Version \\1.\\2.\\3 of 'hardware.inc' is incompatible with requested version \\4.\\5.\\6"
ENDC ENDC
\nENDM"""
INTERNAL_CHK
___internal {CUR_VER}, {MIN_VER},0,0
PURGE CUR_VER, MIN_VER, INTERNAL_CHK, ___internal
ENDM ENDM
;***************************************************************************
;*
;* General memory region constants
;*
;***************************************************************************
DEF _VRAM EQU $8000 ; $8000->$9FFF DEF _VRAM EQU $8000 ; $8000->$9FFF
DEF _SCRN0 EQU $9800 ; $9800->$9BFF DEF _SCRN0 EQU $9800 ; $9800->$9BFF
DEF _SCRN1 EQU $9C00 ; $9C00->$9FFF DEF _SCRN1 EQU $9C00 ; $9C00->$9FFF
@@ -60,17 +95,80 @@ DEF _IO EQU $FF00 ; $FF00->$FF7F,$FFFF
DEF _AUD3WAVERAM EQU $FF30 ; $FF30->$FF3F DEF _AUD3WAVERAM EQU $FF30 ; $FF30->$FF3F
DEF _HRAM EQU $FF80 ; $FF80->$FFFE DEF _HRAM EQU $FF80 ; $FF80->$FFFE
; *** MBC5 Equates ***
DEF rRAMG EQU $0000 ; $0000->$1fff ;***************************************************************************
DEF rROMB0 EQU $2000 ; $2000->$2fff ;*
DEF rROMB1 EQU $3000 ; $3000->$3fff - If more than 256 ROM banks are present. ;* MBC registers
DEF rRAMB EQU $4000 ; $4000->$5fff - Bit 3 enables rumble (if present) ;*
;***************************************************************************
; *** Common ***
; --
; -- RAMG ($0000-$1FFF)
; -- Controls whether access to SRAM (and the MBC3 RTC registers) is allowed (W)
; --
DEF rRAMG EQU $0000
DEF CART_SRAM_ENABLE EQU $0A
DEF CART_SRAM_DISABLE EQU $00
; --
; -- ROMB0 ($2000-$3FFF)
; -- Selects which ROM bank is mapped to the ROMX space ($4000-$7FFF) (W)
; --
; -- The range of accepted values, as well as the behavior of writing $00,
; -- varies depending on the MBC.
; --
DEF rROMB0 EQU $2000
; --
; -- RAMB ($4000-$5FFF)
; -- Selects which SRAM bank is mapped to the SRAM space ($A000-$BFFF) (W)
; --
; -- The range of accepted values varies depending on the cartridge configuration.
; --
DEF rRAMB EQU $4000
; *** MBC3-specific registers ***
; Write one of these to rRAMG to map the corresponding RTC register to all SRAM space
DEF RTC_S EQU $08 ; Seconds (0-59)
DEF RTC_M EQU $09 ; Minutes (0-59)
DEF RTC_H EQU $0A ; Hours (0-23)
DEF RTC_DL EQU $0B ; Lower 8 bits of Day Counter ($00-$FF)
DEF RTC_DH EQU $0C ; Bit 7 - Day Counter Carry Bit (1=Counter Overflow)
; Bit 6 - Halt (0=Active, 1=Stop Timer)
; Bit 0 - Most significant bit of Day Counter (Bit 8)
; --
; -- RTCLATCH ($6000-$7FFF)
; -- Write $00 then $01 to latch the current time into the RTC registers (W)
; --
DEF rRTCLATCH EQU $6000
; *** MBC5-specific register ***
; --
; -- ROMB1 ($3000-$3FFF)
; -- A 9th bit that "extends" ROMB0 if more than 256 banks are present (W)
; --
; -- Also note that rROMB0 thus only spans $2000-$2FFF.
; --
DEF rROMB1 EQU $3000
; Bit 3 of RAMB enables the rumble motor (if any)
DEF CART_RUMBLE_ON EQU 1 << 3
;*************************************************************************** ;***************************************************************************
;* ;*
;* Custom registers ;* Memory-mapped registers
;* ;*
;*************************************************************************** ;***************************************************************************
@@ -105,9 +203,9 @@ DEF rSB EQU $FF01
; -- ; --
DEF rSC EQU $FF02 DEF rSC EQU $FF02
DEF SCF_START EQU %10000000 ;Transfer Start Flag (1=Transfer in progress, or requested) DEF SCF_START EQU %10000000 ; Transfer Start Flag (1=Transfer in progress, or requested)
DEF SCF_SPEED EQU %00000010 ;Clock Speed (0=Normal, 1=Fast) ** CGB Mode Only ** DEF SCF_SPEED EQU %00000010 ; Clock Speed (0=Normal, 1=Fast) ** CGB Mode Only **
DEF SCF_SOURCE EQU %00000001 ;Shift Clock (0=External Clock, 1=Internal Clock) DEF SCF_SOURCE EQU %00000001 ; Shift Clock (0=External Clock, 1=Internal Clock)
DEF SCB_START EQU 7 DEF SCB_START EQU 7
DEF SCB_SPEED EQU 1 DEF SCB_SPEED EQU 1
@@ -444,8 +542,8 @@ DEF LCDCF_WIN9800 EQU %00000000 ; Window Tile Map Display Select
DEF LCDCF_WIN9C00 EQU %01000000 ; Window Tile Map Display Select DEF LCDCF_WIN9C00 EQU %01000000 ; Window Tile Map Display Select
DEF LCDCF_WINOFF EQU %00000000 ; Window Display DEF LCDCF_WINOFF EQU %00000000 ; Window Display
DEF LCDCF_WINON EQU %00100000 ; Window Display DEF LCDCF_WINON EQU %00100000 ; Window Display
DEF LCDCF_BG8800 EQU %00000000 ; BG & Window Tile Data Select DEF LCDCF_BLK21 EQU %00000000 ; BG & Window Tile Data Select
DEF LCDCF_BG8000 EQU %00010000 ; BG & Window Tile Data Select DEF LCDCF_BLK01 EQU %00010000 ; BG & Window Tile Data Select
DEF LCDCF_BG9800 EQU %00000000 ; BG Tile Map Display Select DEF LCDCF_BG9800 EQU %00000000 ; BG Tile Map Display Select
DEF LCDCF_BG9C00 EQU %00001000 ; BG Tile Map Display Select DEF LCDCF_BG9C00 EQU %00001000 ; BG Tile Map Display Select
DEF LCDCF_OBJ8 EQU %00000000 ; OBJ Construction DEF LCDCF_OBJ8 EQU %00000000 ; OBJ Construction
@@ -458,7 +556,7 @@ DEF LCDCF_BGON EQU %00000001 ; BG Display
DEF LCDCB_ON EQU 7 ; LCD Control Operation DEF LCDCB_ON EQU 7 ; LCD Control Operation
DEF LCDCB_WIN9C00 EQU 6 ; Window Tile Map Display Select DEF LCDCB_WIN9C00 EQU 6 ; Window Tile Map Display Select
DEF LCDCB_WINON EQU 5 ; Window Display DEF LCDCB_WINON EQU 5 ; Window Display
DEF LCDCB_BG8000 EQU 4 ; BG & Window Tile Data Select DEF LCDCB_BLKS EQU 4 ; BG & Window Tile Data Select
DEF LCDCB_BG9C00 EQU 3 ; BG Tile Map Display Select DEF LCDCB_BG9C00 EQU 3 ; BG Tile Map Display Select
DEF LCDCB_OBJ16 EQU 2 ; OBJ Construction DEF LCDCB_OBJ16 EQU 2 ; OBJ Construction
DEF LCDCB_OBJON EQU 1 ; OBJ Display DEF LCDCB_OBJON EQU 1 ; OBJ Display
@@ -661,39 +759,65 @@ DEF RPF_DATAIN EQU %00000010 ; 0=Receiving IR Signal, 1=Normal
DEF RPF_WRITE_HI EQU %00000001 DEF RPF_WRITE_HI EQU %00000001
DEF RPF_WRITE_LO EQU %00000000 DEF RPF_WRITE_LO EQU %00000000
DEF RPB_LED_ON EQU 0
DEF RPB_DATAIN EQU 1
; -- ; --
; -- BCPS ($FF68) ; -- BCPS/BGPI ($FF68)
; -- Background Color Palette Specification (R/W) ; -- Background Color Palette Specification (aka Background Palette Index) (R/W)
; -- ; --
DEF rBCPS EQU $FF68 DEF rBCPS EQU $FF68
DEF rBGPI EQU rBCPS
DEF BCPSF_AUTOINC EQU %10000000 ; Auto Increment (0=Disabled, 1=Increment after Writing) DEF BCPSF_AUTOINC EQU %10000000 ; Auto Increment (0=Disabled, 1=Increment after Writing)
DEF BCPSB_AUTOINC EQU 7 DEF BCPSB_AUTOINC EQU 7
DEF BGPIF_AUTOINC EQU BCPSF_AUTOINC
DEF BGPIB_AUTOINC EQU BCPSB_AUTOINC
; -- ; --
; -- BCPD ($FF69) ; -- BCPD/BGPD ($FF69)
; -- Background Color Palette Data (R/W) ; -- Background Color Palette Data (aka Background Palette Data) (R/W)
; -- ; --
DEF rBCPD EQU $FF69 DEF rBCPD EQU $FF69
DEF rBGPD EQU rBCPD
; -- ; --
; -- OCPS ($FF6A) ; -- OCPS/OBPI ($FF6A)
; -- Object Color Palette Specification (R/W) ; -- Object Color Palette Specification (aka Object Background Palette Index) (R/W)
; -- ; --
DEF rOCPS EQU $FF6A DEF rOCPS EQU $FF6A
DEF rOBPI EQU rOCPS
DEF OCPSF_AUTOINC EQU %10000000 ; Auto Increment (0=Disabled, 1=Increment after Writing) DEF OCPSF_AUTOINC EQU %10000000 ; Auto Increment (0=Disabled, 1=Increment after Writing)
DEF OCPSB_AUTOINC EQU 7 DEF OCPSB_AUTOINC EQU 7
DEF OBPIF_AUTOINC EQU OCPSF_AUTOINC
DEF OBPIB_AUTOINC EQU OCPSB_AUTOINC
; -- ; --
; -- OCPD ($FF6B) ; -- OCPD/OBPD ($FF6B)
; -- Object Color Palette Data (R/W) ; -- Object Color Palette Data (aka Object Background Palette Data) (R/W)
; -- ; --
DEF rOCPD EQU $FF6B DEF rOCPD EQU $FF6B
DEF rOBPD EQU rOCPD
; --
; -- OPRI ($FF6C)
; -- Object Priority Mode (R/W)
; -- CGB Only
; --
; -- Priority can be changed only from the boot ROM
; --
DEF rOPRI EQU $FF6C
DEF OPRI_OAM EQU 0 ; Prioritize objects by location in OAM (CGB Mode default)
DEF OPRI_COORD EQU 1 ; Prioritize objects by x-coordinate (Non-CGB Mode default)
; -- ; --
@@ -726,17 +850,6 @@ DEF rPCM12 EQU $FF76
DEF rPCM34 EQU $FF77 DEF rPCM34 EQU $FF77
; SameBoy additions
DEF rKEY0 EQU $FF4C
DEF rBANK EQU $FF50
DEF rOPRI EQU $FF6C
DEF rJOYP EQU rP1
DEF rBGPI EQU rBCPS
DEF rBGPD EQU rBCPD
DEF rOBPI EQU rOCPS
DEF rOBPD EQU rOCPD
; -- ; --
; -- IE ($FFFF) ; -- IE ($FFFF)
; -- Interrupt Enable (R/W) ; -- Interrupt Enable (R/W)
@@ -790,7 +903,6 @@ DEF AUDENV_DOWN EQU %00000000
; -- Can be used with AUD1HIGH, AUD2HIGH, AUD3HIGH ; -- Can be used with AUD1HIGH, AUD2HIGH, AUD3HIGH
; -- See AUD1HIGH for more info ; -- See AUD1HIGH for more info
; -- ; --
DEF AUDHIGH_RESTART EQU %10000000 DEF AUDHIGH_RESTART EQU %10000000
DEF AUDHIGH_LENGTH_ON EQU %01000000 DEF AUDHIGH_LENGTH_ON EQU %01000000
DEF AUDHIGH_LENGTH_OFF EQU %00000000 DEF AUDHIGH_LENGTH_OFF EQU %00000000
@@ -814,10 +926,33 @@ DEF BOOTUP_B_AGB EQU %00000001 ; GBA, GBA SP, Game Boy Player, or New GBA S
;*************************************************************************** ;***************************************************************************
;* ;*
;* Cart related ;* Interrupt vector addresses
;* ;*
;*************************************************************************** ;***************************************************************************
DEF INT_HANDLER_VBLANK EQU $0040
DEF INT_HANDLER_STAT EQU $0048
DEF INT_HANDLER_TIMER EQU $0050
DEF INT_HANDLER_SERIAL EQU $0058
DEF INT_HANDLER_JOYPAD EQU $0060
;***************************************************************************
;*
;* Header
;*
;***************************************************************************
;*
;* Nintendo scrolling logo
;* (Code won't work on a real GameBoy)
;* (if next lines are altered.)
MACRO NINTENDO_LOGO
DB $CE,$ED,$66,$66,$CC,$0D,$00,$0B,$03,$73,$00,$83,$00,$0C,$00,$0D
DB $00,$08,$11,$1F,$88,$89,$00,$0E,$DC,$CC,$6E,$E6,$DD,$DD,$D9,$99
DB $BB,$BB,$67,$63,$6E,$0E,$EC,$CC,$DD,$DC,$99,$9F,$BB,$B9,$33,$3E
ENDM
; $0143 Color GameBoy compatibility code ; $0143 Color GameBoy compatibility code
DEF CART_COMPATIBLE_DMG EQU $00 DEF CART_COMPATIBLE_DMG EQU $00
DEF CART_COMPATIBLE_DMG_GBC EQU $80 DEF CART_COMPATIBLE_DMG_GBC EQU $80
@@ -878,9 +1013,6 @@ DEF CART_SRAM_8KB EQU 2 ; 1 bank
DEF CART_SRAM_32KB EQU 3 ; 4 banks DEF CART_SRAM_32KB EQU 3 ; 4 banks
DEF CART_SRAM_128KB EQU 4 ; 16 banks DEF CART_SRAM_128KB EQU 4 ; 16 banks
DEF CART_SRAM_ENABLE EQU $0A
DEF CART_SRAM_DISABLE EQU $00
; $014A Destination code ; $014A Destination code
DEF CART_DEST_JAPANESE EQU $00 DEF CART_DEST_JAPANESE EQU $00
DEF CART_DEST_NON_JAPANESE EQU $01 DEF CART_DEST_NON_JAPANESE EQU $01
@@ -918,7 +1050,7 @@ DEF PADB_A EQU $0
;*************************************************************************** ;***************************************************************************
DEF SCRN_X EQU 160 ; Width of screen in pixels DEF SCRN_X EQU 160 ; Width of screen in pixels
DEF SCRN_Y EQU 144 ; Height of screen in pixels DEF SCRN_Y EQU 144 ; Height of screen in pixels. Also corresponds to the value in LY at the beginning of VBlank.
DEF SCRN_X_B EQU 20 ; Width of screen in bytes DEF SCRN_X_B EQU 20 ; Width of screen in bytes
DEF SCRN_Y_B EQU 18 ; Height of screen in bytes DEF SCRN_Y_B EQU 18 ; Height of screen in bytes
@@ -966,16 +1098,6 @@ DEF OAMB_PAL1 EQU 4 ; Palette number; 0,1 (DMG)
DEF OAMB_BANK1 EQU 3 ; Bank number; 0,1 (GBC) DEF OAMB_BANK1 EQU 3 ; Bank number; 0,1 (GBC)
;*
;* Nintendo scrolling logo
;* (Code won't work on a real GameBoy)
;* (if next lines are altered.)
MACRO NINTENDO_LOGO
DB $CE,$ED,$66,$66,$CC,$0D,$00,$0B,$03,$73,$00,$83,$00,$0C,$00,$0D
DB $00,$08,$11,$1F,$88,$89,$00,$0E,$DC,$CC,$6E,$E6,$DD,$DD,$D9,$99
DB $BB,$BB,$67,$63,$6E,$0E,$EC,$CC,$DD,$DC,$99,$9F,$BB,$B9,$33,$3E
ENDM
; Deprecated constants. Please avoid using. ; Deprecated constants. Please avoid using.
DEF IEF_LCDC EQU %00000010 ; LCDC (see STAT) DEF IEF_LCDC EQU %00000010 ; LCDC (see STAT)
@@ -983,6 +1105,9 @@ DEF _VRAM8000 EQU _VRAM
DEF _VRAM8800 EQU _VRAM+$800 DEF _VRAM8800 EQU _VRAM+$800
DEF _VRAM9000 EQU _VRAM+$1000 DEF _VRAM9000 EQU _VRAM+$1000
DEF CART_SRAM_2KB EQU 1 ; 1 incomplete bank DEF CART_SRAM_2KB EQU 1 ; 1 incomplete bank
DEF LCDCF_BG8800 EQU %00000000 ; BG & Window Tile Data Select
DEF LCDCF_BG8000 EQU %00010000 ; BG & Window Tile Data Select
DEF LCDCB_BG8000 EQU 4 ; BG & Window Tile Data Select
ENDC ;HARDWARE_INC ENDC ;HARDWARE_INC

View File

@@ -1,2 +1,2 @@
DEF MGB = 1 DEF MGB = 1
include "dmg_boot.asm" include "dmg_boot.asm"

40
BootROMs/sameboot.inc Normal file
View File

@@ -0,0 +1,40 @@
IF !DEF(SAMEBOY_INC)
DEF SAMEBOY_INC EQU 1
include "hardware.inc"
DEF rKEY0 EQU $FF4C
DEF rBANK EQU $FF50
DEF rJOYP EQU rP1
MACRO lb ; r16, high, low
ld \1, LOW(\2) << 8 | LOW(\3)
ENDM
MACRO header_section ; name, address
PUSHS
SECTION "\1", ROM0[\2]
\1:
POPS
ENDM
header_section EntryPoint, $0100
header_section NintendoLogo, $0104
header_section NintendoLogoEnd, $0134
header_section Title, $0134
header_section ManufacturerCode, $013F
header_section CgbFlag, $0143
header_section NewLicenseeCode, $0144
header_section SgbFlag, $0146
header_section CartridgeType, $0147
header_section RomSize, $0148
header_section RamSize, $0149
header_section DestinationCode, $014A
header_section OldLicenseeCode, $014B
header_section MaskRomVersion, $014C
header_section HeaderChecksum, $014D
header_section GlobalChecksum, $014E
ENDC

View File

@@ -1,2 +1,2 @@
DEF SGB2 = 1 DEF SGB2 = 1
include "sgb_boot.asm" include "sgb_boot.asm"

View File

@@ -1,14 +1,14 @@
; SameBoy SGB bootstrap ROM ; SameBoy SGB bootstrap ROM
INCLUDE "hardware.inc" include "sameboot.inc"
SECTION "BootCode", ROM0[$0] SECTION "BootCode", ROM0[$0000]
Start: Start:
; Init stack pointer ; Init stack pointer
ld sp, $fffe ld sp, $FFFE
; Clear memory VRAM ; Clear memory VRAM
ld hl, $8000 ld hl, _VRAM
xor a xor a
.clearVRAMLoop .clearVRAMLoop
@@ -17,24 +17,25 @@ Start:
jr z, .clearVRAMLoop jr z, .clearVRAMLoop
; Init Audio ; Init Audio
ld a, $80 ld a, AUDENA_ON
ldh [rNR52], a ldh [rNR52], a
assert AUDENA_ON == AUDLEN_DUTY_50
ldh [rNR11], a ldh [rNR11], a
ld a, $f3 ld a, $F3
ldh [rNR12], a ldh [rNR12], a ; Envelope $F, decreasing, sweep $3
ldh [rNR51], a ldh [rNR51], a ; Channels 1+2+3+4 left, channels 1+2 right
ld a, $77 ld a, $77
ldh [rNR50], a ldh [rNR50], a ; Volume $7, left and right
; Init BG palette to white ; Init BG palette to white
ld a, $0 ld a, %00_00_00_00
ldh [rBGP], a ldh [rBGP], a
; Load logo from ROM. ; Load logo from ROM.
; A nibble represents a 4-pixels line, 2 bytes represent a 4x4 tile, scaled to 8x8. ; A nibble represents a 4-pixels line, 2 bytes represent a 4x4 tile, scaled to 8x8.
; Tiles are ordered left to right, top to bottom. ; Tiles are ordered left to right, top to bottom.
ld de, $104 ; Logo start ld de, NintendoLogo
ld hl, $8010 ; This is where we load the tiles in VRAM ld hl, _VRAM + $10 ; This is where we load the tiles in VRAM
.loadLogoLoop .loadLogoLoop
ld a, [de] ; Read 2 rows ld a, [de] ; Read 2 rows
@@ -43,43 +44,43 @@ Start:
call DoubleBitsAndWriteRow call DoubleBitsAndWriteRow
inc de inc de
ld a, e ld a, e
xor $34 ; End of logo xor LOW(NintendoLogoEnd)
jr nz, .loadLogoLoop jr nz, .loadLogoLoop
; Load trademark symbol ; Load trademark symbol
ld de, TrademarkSymbol ld de, TrademarkSymbol
ld c,$08 ld c, TrademarkSymbolEnd - TrademarkSymbol
.loadTrademarkSymbolLoop: .loadTrademarkSymbolLoop:
ld a,[de] ld a, [de]
inc de inc de
ldi [hl],a ldi [hl], a
inc hl inc hl
dec c dec c
jr nz, .loadTrademarkSymbolLoop jr nz, .loadTrademarkSymbolLoop
; Set up tilemap ; Set up tilemap
ld a,$19 ; Trademark symbol ld a, $19 ; Trademark symbol tile ID
ld [$9910], a ; ... put in the superscript position ld [_SCRN0 + 8 * SCRN_VX_B + 16], a ; ... put in the superscript position
ld hl,$992f ; Bottom right corner of the logo ld hl, _SCRN0 + 9 * SCRN_VX_B + 15 ; Bottom right corner of the logo
ld c,$c ; Tiles in a logo row ld c, 12 ; Tiles in a logo row
.tilemapLoop .tilemapLoop
dec a dec a
jr z, .tilemapDone jr z, .tilemapDone
ldd [hl], a ldd [hl], a
dec c dec c
jr nz, .tilemapLoop jr nz, .tilemapLoop
ld l,$0f ; Jump to top row ld l, $0F ; Jump to top row
jr .tilemapLoop jr .tilemapLoop
.tilemapDone .tilemapDone
; Turn on LCD ; Turn on LCD
ld a, $91 ld a, LCDCF_ON | LCDCF_BLK01 | LCDCF_BGON
ldh [rLCDC], a ldh [rLCDC], a
ld a, $f1 ; Packet magic, increases by 2 for every packet ld a, $F1 ; Packet magic, increases by 2 for every packet
ldh [_HRAM], a ldh [hCommand], a
ld hl, $104 ; Header start ld hl, NintendoLogo ; Header start
xor a xor a
ld c, a ; JOYP ld c, a ; JOYP
@@ -88,37 +89,37 @@ Start:
ld [c], a ld [c], a
ld a, $30 ld a, $30
ld [c], a ld [c], a
ldh a, [_HRAM] ldh a, [hCommand]
call SendByte call SendByte
push hl push hl
ld b, $e
ld b, 14
ld d, 0 ld d, 0
.checksumLoop .checksumLoop
call ReadHeaderByte call ReadHeaderByte
add d add d
ld d, a ld d, a
dec b dec b
jr nz, .checksumLoop jr nz, .checksumLoop
; Send checksum ; Send checksum
call SendByte call SendByte
pop hl pop hl
ld b, $e ld b, 14
.sendLoop .sendLoop
call ReadHeaderByte call ReadHeaderByte
call SendByte call SendByte
dec b dec b
jr nz, .sendLoop jr nz, .sendLoop
; Done bit ; Done bit
ld a, $20 ld a, $20
ld [c], a ld [c], a
ld a, $30 ld a, $30
ld [c], a ld [c], a
; Wait 4 frames ; Wait 4 frames
ld e, 4 ld e, 4
ld a, 1 ld a, 1
@@ -126,41 +127,41 @@ Start:
xor a xor a
.waitLoop .waitLoop
ldh [rIF], a ldh [rIF], a
db $76 ; halt, compatible with rgbds 0.5-0.8 halt
nop nop
dec e dec e
jr nz, .waitLoop jr nz, .waitLoop
ldh [rIE], a ldh [rIE], a
; Update command ; Update command
ldh a, [_HRAM] ldh a, [hCommand]
add 2 add 2
ldh [_HRAM], a ldh [hCommand], a
ld a, $58 ld a, $58
cp l cp l
jr nz, .sendCommand jr nz, .sendCommand
; Write to sound registers for DMG compatibility ; Write to sound registers for DMG compatibility
ld c, $13 ld c, LOW(rNR13)
ld a, $c1 ld a, $C1
ld [c], a ld [c], a
inc c inc c
ld a, 7 ld a, $7
ld [c], a ld [c], a
; Init BG palette ; Init BG palette
ld a, $fc ld a, %11_11_11_00
ldh [rBGP], a ldh [rBGP], a
; Set registers to match the original SGB boot ; Set registers to match the original SGB boot
IF DEF(SGB2) IF DEF(SGB2)
ld a, $FF ld a, BOOTUP_A_MGB
ELSE ELSE
ld a, 1 ld a, BOOTUP_A_DMG
ENDC ENDC
ld hl, $c060 ld hl, $C060
; Boot the game ; Boot the game
jp BootGame jp BootGame
@@ -212,8 +213,23 @@ DoubleBitsAndWriteRow:
ret ret
TrademarkSymbol: TrademarkSymbol:
db $3c,$42,$b9,$a5,$b9,$a5,$42,$3c pusho
opt b.X
db %..XXXX..
db %.X....X.
db %X.XXX..X
db %X.X..X.X
db %X.XXX..X
db %X.X..X.X
db %.X....X.
db %..XXXX..
popo
TrademarkSymbolEnd:
SECTION "BootGame", ROM0[$fe] SECTION "BootGame", ROM0[$00FE]
BootGame: BootGame:
ldh [rBANK], a ldh [rBANK], a
SECTION "HRAM", HRAM[_HRAM]
hCommand:
ds 1

View File

@@ -387,7 +387,7 @@ endif
$(OBJ)/SDL/%.dep: SDL/% $(OBJ)/SDL/%.dep: SDL/%
-@$(MKDIR) -p $(dir $@) -@$(MKDIR) -p $(dir $@)
$(CC) $(CFLAGS) $(SDL_CFLAGS) $(GL_CFLAGS) -MT $(OBJ)/$^.o -M $^ -c -o $@ $(CC) $(CFLAGS) $(SDL_CFLAGS) $(GL_CFLAGS) -MT $(OBJ)/$^.o -M $^ -c -o $@
$(OBJ)/OpenDialog/%.dep: OpenDialog/% $(OBJ)/OpenDialog/%.dep: OpenDialog/%
-@$(MKDIR) -p $(dir $@) -@$(MKDIR) -p $(dir $@)
$(CC) $(CFLAGS) $(SDL_CFLAGS) $(GL_CFLAGS) -MT $(OBJ)/$^.o -M $^ -c -o $@ $(CC) $(CFLAGS) $(SDL_CFLAGS) $(GL_CFLAGS) -MT $(OBJ)/$^.o -M $^ -c -o $@
@@ -414,16 +414,16 @@ $(OBJ)/OpenDialog/%.c.o: OpenDialog/%.c
$(OBJ)/%.c.o: %.c $(OBJ)/%.c.o: %.c
-@$(MKDIR) -p $(dir $@) -@$(MKDIR) -p $(dir $@)
$(CC) $(CFLAGS) $(FRONTEND_CFLAGS) $(FAT_FLAGS) -c $< -o $@ $(CC) $(CFLAGS) $(FRONTEND_CFLAGS) $(FAT_FLAGS) -c $< -o $@
# HexFiend requires more flags # HexFiend requires more flags
$(OBJ)/HexFiend/%.m.o: HexFiend/%.m $(OBJ)/HexFiend/%.m.o: HexFiend/%.m
-@$(MKDIR) -p $(dir $@) -@$(MKDIR) -p $(dir $@)
$(CC) $(CFLAGS) $(FRONTEND_CFLAGS) $(FAT_FLAGS) $(OCFLAGS) -c $< -o $@ -fno-objc-arc -include HexFiend/HexFiend_2_Framework_Prefix.pch $(CC) $(CFLAGS) $(FRONTEND_CFLAGS) $(FAT_FLAGS) $(OCFLAGS) -c $< -o $@ -fno-objc-arc -include HexFiend/HexFiend_2_Framework_Prefix.pch
$(OBJ)/%.m.o: %.m $(OBJ)/%.m.o: %.m
-@$(MKDIR) -p $(dir $@) -@$(MKDIR) -p $(dir $@)
$(CC) $(CFLAGS) $(FRONTEND_CFLAGS) $(FAT_FLAGS) $(OCFLAGS) -c $< -o $@ $(CC) $(CFLAGS) $(FRONTEND_CFLAGS) $(FAT_FLAGS) $(OCFLAGS) -c $< -o $@
# iOS Port # iOS Port
$(BIN)/SameBoy-iOS.app: $(BIN)/SameBoy-iOS.app/SameBoy \ $(BIN)/SameBoy-iOS.app: $(BIN)/SameBoy-iOS.app/SameBoy \
@@ -495,7 +495,7 @@ endif
$(BIN)/SameBoy.app/Contents/Resources/%.nib: Cocoa/%.xib $(BIN)/SameBoy.app/Contents/Resources/%.nib: Cocoa/%.xib
ibtool --target-device mac --minimum-deployment-target 10.9 --compile $@ $^ 2>&1 | cat - ibtool --target-device mac --minimum-deployment-target 10.9 --compile $@ $^ 2>&1 | cat -
$(BIN)/SameBoy-iOS.app/%.storyboardc: iOS/%.storyboard $(BIN)/SameBoy-iOS.app/%.storyboardc: iOS/%.storyboard
ibtool --target-device iphone --target-device ipad --minimum-deployment-target $(IOS_MIN) --compile $@ $^ 2>&1 | cat - ibtool --target-device iphone --target-device ipad --minimum-deployment-target $(IOS_MIN) --compile $@ $^ 2>&1 | cat -
@@ -526,7 +526,7 @@ endif
$(BIN)/SameBoy.qlgenerator/Contents/Resources/cgb_boot_fast.bin: $(BIN)/BootROMs/cgb_boot_fast.bin $(BIN)/SameBoy.qlgenerator/Contents/Resources/cgb_boot_fast.bin: $(BIN)/BootROMs/cgb_boot_fast.bin
-@$(MKDIR) -p $(dir $@) -@$(MKDIR) -p $(dir $@)
cp -f $^ $@ cp -f $^ $@
# SDL Port # SDL Port
# Unix versions build only one binary # Unix versions build only one binary
@@ -611,7 +611,7 @@ $(BIN)/SDL/background.bmp: SDL/background.bmp
$(BIN)/SDL/Shaders: Shaders $(BIN)/SDL/Shaders: Shaders
-@$(MKDIR) -p $@ -@$(MKDIR) -p $@
cp -rf Shaders/*.fsh $@ cp -rf Shaders/*.fsh $@
$(BIN)/SDL/Palettes: Misc/Palettes $(BIN)/SDL/Palettes: Misc/Palettes
-@$(MKDIR) -p $@ -@$(MKDIR) -p $@
cp -rf Misc/Palettes/*.sbp $@ cp -rf Misc/Palettes/*.sbp $@
@@ -620,12 +620,12 @@ $(BIN)/SDL/Palettes: Misc/Palettes
$(OBJ)/%.2bpp: %.png $(OBJ)/%.2bpp: %.png
-@$(MKDIR) -p $(dir $@) -@$(MKDIR) -p $(dir $@)
$(RGBGFX) $(if $(filter $(shell echo 'print __RGBDS_MAJOR__ || (!__RGBDS_MAJOR__ && __RGBDS_MINOR__ > 5)' | $(RGBASM) -), $$0), -h -u, -Z -u -c embedded) -o $@ $< $(RGBGFX) $(if $(filter $(shell echo 'println __RGBDS_MAJOR__ || (!__RGBDS_MAJOR__ && __RGBDS_MINOR__ > 5)' | $(RGBASM) -), $$0), -h -u, -Z -u -c embedded) -o $@ $<
$(OBJ)/BootROMs/SameBoyLogo.pb12: $(OBJ)/BootROMs/SameBoyLogo.2bpp $(PB12_COMPRESS) $(OBJ)/BootROMs/SameBoyLogo.pb12: $(OBJ)/BootROMs/SameBoyLogo.2bpp $(PB12_COMPRESS)
-@$(MKDIR) -p $(dir $@) -@$(MKDIR) -p $(dir $@)
"$(realpath $(PB12_COMPRESS))" < $< > $@ "$(realpath $(PB12_COMPRESS))" < $< > $@
$(PB12_COMPRESS): BootROMs/pb12.c $(PB12_COMPRESS): BootROMs/pb12.c
-@$(MKDIR) -p $(dir $@) -@$(MKDIR) -p $(dir $@)
$(NATIVE_CC) -std=c99 -Wall -Werror $< -o $@ $(NATIVE_CC) -std=c99 -Wall -Werror $< -o $@
@@ -633,11 +633,11 @@ $(PB12_COMPRESS): BootROMs/pb12.c
$(BIN)/BootROMs/cgb0_boot.bin: BootROMs/cgb_boot.asm $(BIN)/BootROMs/cgb0_boot.bin: BootROMs/cgb_boot.asm
$(BIN)/BootROMs/agb_boot.bin: BootROMs/cgb_boot.asm $(BIN)/BootROMs/agb_boot.bin: BootROMs/cgb_boot.asm
$(BIN)/BootROMs/cgb_boot_fast.bin: BootROMs/cgb_boot.asm $(BIN)/BootROMs/cgb_boot_fast.bin: BootROMs/cgb_boot.asm
$(BIN)/BootROMs/sgb2_boot: BootROMs/sgb_boot.asm $(BIN)/BootROMs/sgb2_boot.bin: BootROMs/sgb_boot.asm
$(BIN)/BootROMs/%.bin: BootROMs/%.asm $(OBJ)/BootROMs/SameBoyLogo.pb12 $(BIN)/BootROMs/%.bin: BootROMs/%.asm $(OBJ)/BootROMs/SameBoyLogo.pb12
-@$(MKDIR) -p $(dir $@) -@$(MKDIR) -p $(dir $@)
$(RGBASM) -i $(OBJ)/BootROMs/ -i BootROMs/ -o $@.tmp $< $(RGBASM) $(if $(filter $(shell echo 'println __RGBDS_MAJOR__ || (!__RGBDS_MAJOR__ && __RGBDS_MINOR__ > 6)' | $(RGBASM) -), $$0), -h,) --include $(OBJ)/BootROMs/ --include BootROMs/ -o $@.tmp $<
$(RGBLINK) -x -o $@ $@.tmp $(RGBLINK) -x -o $@ $@.tmp
@rm $@.tmp @rm $@.tmp
@@ -690,7 +690,7 @@ endif
ios: ios:
@$(MAKE) _ios @$(MAKE) _ios
$(BIN)/SameBoy-iOS.ipa: ios iOS/sideload.entitlements $(BIN)/SameBoy-iOS.ipa: ios iOS/sideload.entitlements
$(MKDIR) -p $(OBJ)/Payload $(MKDIR) -p $(OBJ)/Payload
cp -rf $(BIN)/SameBoy-iOS.app $(OBJ)/Payload/SameBoy-iOS.app cp -rf $(BIN)/SameBoy-iOS.app $(OBJ)/Payload/SameBoy-iOS.app
@@ -698,11 +698,11 @@ $(BIN)/SameBoy-iOS.ipa: ios iOS/sideload.entitlements
(cd $(OBJ) && zip -q $(abspath $@) -r Payload) (cd $(OBJ) && zip -q $(abspath $@) -r Payload)
rm -rf $(OBJ)/Payload rm -rf $(OBJ)/Payload
$(BIN)/SameBoy-iOS.deb: $(OBJ)/debian-binary $(OBJ)/control.tar.gz $(OBJ)/data.tar.gz $(BIN)/SameBoy-iOS.deb: $(OBJ)/debian-binary $(OBJ)/control.tar.gz $(OBJ)/data.tar.gz
-@$(MKDIR) -p $(dir $@) -@$(MKDIR) -p $(dir $@)
(cd $(OBJ) && ar cr $(abspath $@) $(notdir $^)) (cd $(OBJ) && ar cr $(abspath $@) $(notdir $^))
$(OBJ)/data.tar.gz: ios iOS/jailbreak.entitlements iOS/installer.entitlements $(OBJ)/data.tar.gz: ios iOS/jailbreak.entitlements iOS/installer.entitlements
$(MKDIR) -p $(OBJ)/private/var/containers/ $(MKDIR) -p $(OBJ)/private/var/containers/
cp -rf $(BIN)/SameBoy-iOS.app $(OBJ)/private/var/containers/SameBoy-iOS.app cp -rf $(BIN)/SameBoy-iOS.app $(OBJ)/private/var/containers/SameBoy-iOS.app
@@ -711,7 +711,7 @@ $(OBJ)/data.tar.gz: ios iOS/jailbreak.entitlements iOS/installer.entitlements
codesign -fs - --entitlements iOS/jailbreak.entitlements $(OBJ)/private/var/containers/SameBoy-iOS.app codesign -fs - --entitlements iOS/jailbreak.entitlements $(OBJ)/private/var/containers/SameBoy-iOS.app
(cd $(OBJ) && tar -czf $(abspath $@) --format ustar --uid 501 --gid 501 --numeric-owner ./private) (cd $(OBJ) && tar -czf $(abspath $@) --format ustar --uid 501 --gid 501 --numeric-owner ./private)
rm -rf $(OBJ)/private/ rm -rf $(OBJ)/private/
$(OBJ)/control.tar.gz: iOS/deb-postinst iOS/deb-prerm iOS/deb-control $(OBJ)/control.tar.gz: iOS/deb-postinst iOS/deb-prerm iOS/deb-control
-@$(MKDIR) -p $(dir $@) -@$(MKDIR) -p $(dir $@)
sed "s/@VERSION/$(VERSION)/" < iOS/deb-control > $(OBJ)/control sed "s/@VERSION/$(VERSION)/" < iOS/deb-control > $(OBJ)/control
@@ -719,11 +719,11 @@ $(OBJ)/control.tar.gz: iOS/deb-postinst iOS/deb-prerm iOS/deb-control
ln iOS/deb-prerm $(OBJ)/prerm ln iOS/deb-prerm $(OBJ)/prerm
(cd $(OBJ) && tar -czf $(abspath $@) --format ustar --uid 501 --gid 501 --numeric-owner ./control ./postinst ./prerm) (cd $(OBJ) && tar -czf $(abspath $@) --format ustar --uid 501 --gid 501 --numeric-owner ./control ./postinst ./prerm)
rm $(OBJ)/control $(OBJ)/postinst $(OBJ)/prerm rm $(OBJ)/control $(OBJ)/postinst $(OBJ)/prerm
$(OBJ)/debian-binary: $(OBJ)/debian-binary:
-@$(MKDIR) -p $(dir $@) -@$(MKDIR) -p $(dir $@)
echo 2.0 > $@ echo 2.0 > $@
$(LIBDIR)/libsameboy.o: $(CORE_OBJECTS) $(LIBDIR)/libsameboy.o: $(CORE_OBJECTS)
-@$(MKDIR) -p $(dir $@) -@$(MKDIR) -p $(dir $@)
@# This is a somewhat simple hack to force Clang and GCC to build a native object file out of one or many LTO objects @# This is a somewhat simple hack to force Clang and GCC to build a native object file out of one or many LTO objects
@@ -731,12 +731,12 @@ $(LIBDIR)/libsameboy.o: $(CORE_OBJECTS)
@# And this is a somewhat complicated hack to invoke the correct LTO-enabled LD command in a mostly cross-platform nature @# And this is a somewhat complicated hack to invoke the correct LTO-enabled LD command in a mostly cross-platform nature
$(CC) $(FAT_FLAGS) $(CFLAGS) $(LIBFLAGS) $^ $(OBJ)/lto_hack.o -o $@ $(CC) $(FAT_FLAGS) $(CFLAGS) $(LIBFLAGS) $^ $(OBJ)/lto_hack.o -o $@
-@rm $(OBJ)/lto_hack.o -@rm $(OBJ)/lto_hack.o
$(LIBDIR)/libsameboy.a: $(LIBDIR)/libsameboy.o $(LIBDIR)/libsameboy.a: $(LIBDIR)/libsameboy.o
-@$(MKDIR) -p $(dir $@) -@$(MKDIR) -p $(dir $@)
-@rm -f $@ -@rm -f $@
ar -crs $@ $^ ar -crs $@ $^
$(INC)/%.h: Core/%.h $(INC)/%.h: Core/%.h
-@$(MKDIR) -p $(dir $@) -@$(MKDIR) -p $(dir $@)
-@# CPPP doesn't like multibyte characters, so we replace the single quote character before processing so it doesn't complain -@# CPPP doesn't like multibyte characters, so we replace the single quote character before processing so it doesn't complain
@@ -745,7 +745,7 @@ $(INC)/%.h: Core/%.h
lib-unsupported: lib-unsupported:
@echo Due to limitations of lld-link, compiling SameBoy as a library on Windows is not supported. @echo Due to limitations of lld-link, compiling SameBoy as a library on Windows is not supported.
@false @false
# Clean # Clean
clean: clean:
rm -rf build rm -rf build