Merge pull request #80 from yenatch/master

rgb macro for palettes
This commit is contained in:
Bryan Bishop 2013-01-12 22:22:00 -08:00
commit fb9fdd038d
3 changed files with 114 additions and 20 deletions

View File

@ -31,6 +31,10 @@ TX_FAR: MACRO
db BANK(\1) db BANK(\1)
ENDM ENDM
RGB: MACRO
dw ((\3 << 10) | (\2 << 5) | (\1))
ENDM
; eventually replace with python macro ; eventually replace with python macro
note: MACRO note: MACRO
db \1 db \1

View File

@ -1283,6 +1283,28 @@ def get_uncompressed_gfx(start, num_tiles, filename):
def hex_to_rgb(word):
red = word & 0b11111
word >>= 5
green = word & 0b11111
word >>= 5
blue = word & 0b11111
return (red, green, blue)
def grab_palettes(address, length = 0x80):
output = ''
for word in range(length/2):
color = ord(rom[address+1])*0x100 + ord(rom[address])
address += 2
color = hex_to_rgb(color)
red = str(color[0]).zfill(2)
green = str(color[1]).zfill(2)
blue = str(color[2]).zfill(2)
output += '\tRGB '+red+', '+green+', '+blue
output += '\n'
return output
if __name__ == "__main__": if __name__ == "__main__":
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('cmd', nargs='?', metavar='cmd', type=str) parser.add_argument('cmd', nargs='?', metavar='cmd', type=str)
@ -1317,7 +1339,11 @@ if __name__ == "__main__":
# python gfx.py un [address] [num_tiles] [filename] # python gfx.py un [address] [num_tiles] [filename]
get_uncompressed_gfx(int(args.arg1,16), int(args.arg2), args.arg3) get_uncompressed_gfx(int(args.arg1,16), int(args.arg2), args.arg3)
else: elif args.cmd == 'pal':
# python gfx.py # python gfx.py pal [address] [length]
decompress_all() print grab_palettes(int(args.arg1,16), int(args.arg2))
if debug: print 'decompressed known gfx to ../gfx/!'
#else:
## python gfx.py
#decompress_all()
#if debug: print 'decompressed known gfx to ../gfx/!'

View File

@ -89646,23 +89646,87 @@ INCBIN "baserom.gbc", $10fed7, $10fede - $10fed7
TitleScreenPalettes: TitleScreenPalettes:
; BG ; BG
dw $0000, $0013, $7D0F, $7D0F RGB 00, 00, 00
dw $0000, $7FFF, $7E0F, $343F RGB 19, 00, 00
dw $0000, $1CE7, $7FFF, $7862 RGB 15, 08, 31
dw $0000, $35AD, $4BFF, $7862 RGB 15, 08, 31
dw $0000, $4E73, $339D, $7862
dw $0000, $6739, $1B3C, $7862 RGB 00, 00, 00
dw $0000, $7FFF, $02BA, $7862 RGB 31, 31, 31
dw $0000, $4D6B, $7FFF, $0000 RGB 15, 16, 31
RGB 31, 01, 13
RGB 00, 00, 00
RGB 07, 07, 07
RGB 31, 31, 31
RGB 02, 03, 30
RGB 00, 00, 00
RGB 13, 13, 13
RGB 31, 31, 18
RGB 02, 03, 30
RGB 00, 00, 00
RGB 19, 19, 19
RGB 29, 28, 12
RGB 02, 03, 30
RGB 00, 00, 00
RGB 25, 25, 25
RGB 28, 25, 06
RGB 02, 03, 30
RGB 00, 00, 00
RGB 31, 31, 31
RGB 26, 21, 00
RGB 02, 03, 30
RGB 00, 00, 00
RGB 11, 11, 19
RGB 31, 31, 31
RGB 00, 00, 00
; OBJ ; OBJ
dw $0000, $3C0A, $58B1, $7D33 RGB 00, 00, 00
dw $7FFF, $0000, $0000, $0000 RGB 10, 00, 15
dw $7FFF, $0000, $0000, $0000 RGB 17, 05, 22
dw $7FFF, $0000, $0000, $0000 RGB 19, 09, 31
dw $7FFF, $0000, $0000, $0000
dw $7FFF, $0000, $0000, $0000 RGB 31, 31, 31
dw $7FFF, $0000, $0000, $0000 RGB 00, 00, 00
dw $7FFF, $0000, $0000, $0000 RGB 00, 00, 00
RGB 00, 00, 00
RGB 31, 31, 31
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 31, 31, 31
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 31, 31, 31
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 31, 31, 31
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 31, 31, 31
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 31, 31, 31
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
INCBIN "baserom.gbc", $10ff5e, $110000 - $10ff5e INCBIN "baserom.gbc", $10ff5e, $110000 - $10ff5e