pret / pokered Goto Github PK
View Code? Open in Web Editor NEWDisassembly of Pokémon Red/Blue
Disassembly of Pokémon Red/Blue
I know it's not a technically an issue, and I apologise if it's considered spamming the issues... but considering how many hours he must have spent poring over the code that has been liberated in this repository, I thought it was more suitable to leave my sentiments here then in a Facebook post to an audience of mostly non-gamer friends.
I did not know much about the Iwata-san's programming talents before today. For instance, I didn't know that he led the programming on one of my all time favourite games, 'Earthbound'. Or indeed that he was able to decipher the pokemon battle system within a week, and go on to port it for another game in the franchise.
This quote is probably being overused today, but I love the fact that a CEO of one of the world's biggest videogame companies was able to say it-
"On my business card, I am a corporate president. In my mind, I am a game developer. But in my heart, I am a gamer." - Satoru Iwata in his keynote speech at GDC 2005
RIP
Hey, I realize that to change the general in-game alphabet I just edit font.png, but how can I change which keys map to what when editing text/dialogue so I can ex. write ĉ in the text editor and ĉ appears in the game? (Instead of how it is now where I replace x with ĉ on font.png, then type x in the text editor in order to get ĉ).
Hi, I just tried to re-install pokered after I did a fresh install of my OS. I wrote "cd pokered, make red" immediately after and got this error:
rgbasm -D _RED -h -o audio_red.o audio.asm
make: rgbasm: No such file or directory
make: *** [audio_red.o] Error 1
I searched and the "rgbasm" file's in the "rgbds" folder. What am I doing wrong?
People often forget or aren't aware of the difference between PSYCHIC and PSYCHIC_M.
This would prevent someone from using the wrong PSYCHIC constant.
Good day.
I wanted to drop by and ask if there are some plans about giving Pokemon Yellow the same treatment as Red & Blue?
I would love to see the game in full colour along with many of the Gen II features.
I would surely give it a second run from scratch up to all the 151 Pokemon if it becomes available.
Thanks in advance!
Hey, do you guys have any plans for making this work with Green (or the Japanese games in general)? I want to make a Green hack but as it is now it means replacing the graphics, pallette, cave layout, and all the dialogue, and then anyone else who wants to do the same thing has to go through all the same trouble as me....
EDIT: nevermind, I found out someone's doing it!
The map connection macros have constants like ROUTE_10_HEIGHT - 24
, but that doesn't really capture what the actual value should be. I'm not sure what the right thing to do is, but it seems like hardcoding the actual value would be better than doing confusing subtraction.
Was Pokemon Red originally written in Assmbly?
Why not C? Was it because of some hardware limitations? Was it to optimize it as much as possible in terms of performance and required space?
Hi, it would be really cool if we could somehow have the option of picking from the English or Japanese graphics. Seems like the Japanese Red and Green have different graphics compared to the Japanese Yellow, but the English Red uses the Japanese Yellow graphics. Check it out:
The only things I've seen people talk about so far have been the pokemon battle sprites + the overworld flowers being different, but as the pictures show there's probably a lot more...
EDIT: Maybe it's mostly just a mapping issue? It seems like the English Yellow actually uses some of the same graphics as the Japanese RBG, so I guess I'll be stealing stuff from pokeyellow!
i want to listen to the unused tracks and the cries and idk how to open the asm files for them
help plz
I'm assuming the map files .blk are hex files. Do you think it would be possible to have these in a readable format and then converted back to hex during make?
Like have it in ascii format
HEADER
tile (0,0)(tile#,special1,special2)
tile (0,1)(tile#,special1,special2)
Since it isn't assembly code and just standard bytes I think making it user friendly in source would be great. This would make map editing much easier
What is called the trade center is really the battle center and vice versa. Also, the battle center is called the Colosseum in the game.
Hey, in the Japanese games the alphabet has assigned a special key so that if you press ° it'll overlay on top of the character and make ぱぴぷぺぽ as opposed to はひふへほ for example. I wanted to utilize this for my game, so that if I were to replace it and press ˆ I'd get ĈĜĤ.
But I don't know how to:
It could be that one of the many blank keys on the English alphabet layout is this special key, so I guess I can try looking at that first...
After coming across this wonderful project, I saw an issue in the Crystal disassembly planning a MIDI importer, and after studying the music macro format a bit I decided to bang one out for Red over the last week:
https://github.com/mtolly/pokemid
Currently the main features are: it takes care of turning MIDI durations and pitches into the right sequence of note speed and octave commands, it supports both one-shot and looping tracks, as well as most of the note alteration macros, and also does some rudimentary code shrinking by finding repeated sections and making subroutines.
For now it is a ~500-line Haskell program, but I've put up binaries on the release page for Windows/Mac/Linux so you hopefully shouldn't need to install anything to try it out. It comes with 2 short MIDI files as tests, which generate equivalent (but not identical) code for introbattle.asm
and safarizone.asm
.
Basically I'd like to know what you guys want out of the tool. It is not finished but all the core logic and design is there. The primary issue is that it does not generate identical code to the original files, only code which behaves equivalently (to my knowledge). Emitting identical assembly can't be easily done without making the MIDI files specify more low-level details of labels and branching which doesn't seem useful to me. So I wouldn't really recommend using this to store the repo's music in MIDI like how the images are stored in PNG.
I'm using Arch Linux here and got "python" pointing to Python 3.5.2.
Typing "make" would result in the following message:
$ make
rgbasm -D _RED -h -o audio_red.o audio.asm
File "extras/pokemontools/gfx.py", line 72
tiles = sorted(enumerate(tiles), key= lambda (i, tile): i % width)
A workaround for me was to modify the first line of the Makefile from PYTHON := python
to PYTHON := python2.7
.
I've been looking all over for the routine PrintText. All I want to see is how the game prints the text to the screen in the text box. Thanks if anybody can answer this and sorry for posting this in here.
Hi,
I'm trying to compile with cygwin but i get this error:
$ make red
Preprocessing 1 file...
rgbasm -h -o red/audio.o red/audio.tx
rgbasm -h -o red/main.o red/main.tx
ERROR: red/main.tx(2) -> main.tx(15) -> home.tx(4677) -> add_tx_pre(1) :
Macro 'ext_id' not defined
ERROR: red/main.tx(2) -> main.tx(15) -> home.tx(4678) -> add_tx_pre(1) :
syntax error
Assembly aborted in pass 1 (2 errors)!
Makefile:87: recipe for target 'red/main.o' failed
make: *** [red/main.o] Error 1
I go to the code:
add_tx_pre CardKeySuccessText ; 01
then i go to add_tx_pre:
add_tx_pre: MACRO
\1_id:: dw \1
ENDM
The problem is inside that.
I tried to compile with a version before Text was changed to add_tx_pre and it works.
This file is named "ninetails.asm", but everywhere else, the spelling "Ninetales" is used.
So, I've tried to build the ROM files but I seem to get an error.
bash-4.4$ git clone --recursive https://github.com/pret/pokered
Cloning into 'pokered'...
remote: Counting objects: 22380, done.
remote: Total 22380 (delta 0), reused 0 (delta 0), pack-reused 22380
ects: 100% (
Receiving objects: 100% (22380/22380), 11.84 MiB | 543.00 KiB/s, done.
Resolving deltas: 100% (14763/14763), done.
Checking connectivity... done.
Checking out files: 100% (2847/2847), done.
Submodule 'extras' (git://github.com/kanzure/pokemon-reverse-engineering-tools.git) registered for path 'extras'
Cloning into '/usr/bin/pokered/extras'...
remote: Counting objects: 4577, done.
remote: Total 4577 (delta 0), reused 0 (delta 0), pack-reused 4577
ts: 100%
Receiving objects: 100% (4577/4577), 2.29 MiB | 546.00 KiB/s, done.
Resolving deltas: 100% (2882/2882), done.
Checking connectivity... done.
Submodule path 'extras': checked out '0e1798937a4bf723813574281d0dc12c471c9199'
bash-4.4$ cd pokered
bash-4.4$ make
rgbasm -D _RED -h -o audio_red.o audio.asm
make: rgbasm: Command not found
make: *** [Makefile:37: audio_red.o] Error 127
bash-4.4$
I'm running 64-bit Windows 10. I've installed Cygwin on HDD E:\ , I've put the rgbasm files on the right directory and I believe I have set the var "Path" correctly. Any clues?
git submodule init && git submodule update
Hey! Bit of a linux noob here but I know my way around. After getting all rgbds to finally work (using stable branch), get this problem.
(precise)sam@localhost:~/newfolder/test/pokered$ make
rgbasm -h -o red/main.o red/main.asm
ERROR: red/main.asm(1) -> red.asm(2) -> charmap.asm(2) :
syntax error
Assembly aborted in pass 1 (1 errors)!
make: *** [red/main.o] Error 1
So it says there's a syntax error in charmap.asm at line 2. Can't see what it is but I've never programmed assembly.
Can you disassemble the Japanese Green? I'm trying to get something from the files, but I can't find them anywhere else online. Thanks!
IMAP $29,$2,$B,PalletTownName
IMAP OAKS_LAB + 1, 2, 11, PalletTownName
This is a good opportunity to enumerate map constants. That way you could instead do
...
enum REDS_HOUSE_1F
enum REDS_HOUSE_2F
enum BLUES_HOUSE
enum OAKS_LAB
IMAP_PALLET equ __enum__
enum VIRIDIAN_POKECENTER
...
then
IMAP PALLET, 2, 11, PalletTownName
I'm having trouble determining which MBC is officially used for these cartridges.
I can see from the disassembly, and from my own dumped Pokemon Blue, that it acts like an MBC1. But looking at the header data, at 0x0147, I find the value 0x13, indicating an MBC3 controller with SRAM and battery, but no RTC.
Have I overseen something, or is the value of 0x13 or my MBC table just incorrect?
$ make
rgbasm -h -o red/main.o red/main.tx
ERROR: red/main.tx(2) -> main.tx(15) -> home.tx(4676) -> add_tx_pre(1) : Macro 'ext_id' not defined
ERROR: red/main.tx(2) -> main.tx(15) -> home.tx(4677) -> add_tx_pre(1) : syntax error
Assembly aborted in pass 1 (2 errors)!
Makefile:87: recipe for target 'red/main.o' failed
make: *** [red/main.o] Error 1
I'm using Linux, Debian. Someone else is getting the same issue using Windows 7, however. I am also having an error for
sudo pip install -r extras/requirements.txt
I get the error:
Command /usr/bin/python -c "import setuptools, tokenize;file='/tmp/pip_build_root/pillow/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-Si_iHU-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/pillow
Storing debug log for failure in /root/.pip/pip.log
Not sure if it's worth mentioning, but I have an older version installed, all the way from May, and it still compiles just fine.
Thanks!
The only sounds working correctly are Professor Oak song while choosing name and such and pokemon cries. The rest are either playing the wrong songs, wrong speed, or just aren't present.
The first battle with Gary glitches after first attack, taking forever to load, not continuing, etc.
This is the current build.
I also noticed that there were warning signs during make about jp [hl] and [sp + 0] being obsolete, so i wrote a script to fix them, although this does not fix the problems listed above.
find . -name "*.asm" -exec sed -i -e 's/jp \[hl\]/jp hl/g' {} \;
echo "Done fixing jp hl"
find . -name "*.asm" -exec sed -i -e 's/\[sp + 0\]/sp+0/g' {} \;
echo "Dont fixing sp+0"
When im compiling the ASM code with rgbasm i get the next error:
rgbasm: Unable to open incbin file 'gfx/tilesets/flower/flower1.2bpp': No such file or directory
The error is that there isn't a file named flower1.2bpp
on the folder gfx/tilesets/flower
.
Find a way to arrange disorganized sections in the same order as the baserom.
Section prototypes were proposed in the past. Example:
section "first", wram0
section "second", wram0
section "main", rom0
dw wSecond, wFirst
section "second", wram0
wSecond:
ds 10
section "first", wram0
wFirst:
ds 10
outputs
c00a c000
This method works already within an object, but rgblink considers one object at a time when determining section placement, even if both sections are declared in both objects.
While trying to compile in cygwin, I get the following error:
ERROR: wram.asm(3146):
Constant mustn't be negative: -2
make: *** [Makefile:46: wram_red.o] Error 5
However, I haven't actually made any changes to this file, especially not anything related to that particular line, so I'm unsure of what would be causing it.
I was searching and wd74b at wram is the flag that controls if the players has the pokedex.
wd74b could be: W_ISPOKEDEXOWNED or something similar
With this disassembly, are you doing a 1:1 compatible build of the Pokemon Red/Blue ROMs?
For example if you play any of the built ROMs, will the game be identical to the retail ROM? Or do we have bug fixes that nerf some of the common glitches and other things like MissingNo?
I don't mind if we're doing a 1:1 replica of the classic game code, but bonus points if MissingNo and friends get nerfed.
I'm on mac. I'm completely new to programming. How do I assemble a ROM that reflects the changes I've made? The command in install.md builds the original disassembly.
Even after applying the patch in #147, building fails with:
ERROR: wram.asm(3143):
Constant mustn't be negative: -2
I just follow the steps:
xcode-select --install
sudo easy_install pypng
git clone https://github.com/bentley/rgbds
cd rgbds
sudo make install
cd ..
git clone --recursive https://github.com/pret/pokered
cd pokered
make
.
.
.
But it happens as follow:
$ make
rgbasm -h -o red/audio.o red/audio.asm
make: rgbasm: No such file or directory
make: *** [red/audio.o] Error 1
On Mac OS X:
$ make
c99: invalid argument `error=implicit-int' to -W
Makefile:83: recipe for target 'src/asm/asmy.o' failed
make: *** [src/asm/asmy.o] Error 64
need to unearth pkmncompress.c and use the other pokecrystal c tools instead of the submodule
Trying to build using cgywin, it comes up with this error.
$ make
rgbasm -h -o red/audio.o red/audio.asm
rgbasm -h -o red/main.o red/main.asm
rgbasm -h -o red/text.o red/text.asm
rgbasm -h -o red/wram.o red/wram.asm
rgblink -n pokered.sym -o pokered.gbc red/audio.o red/main.o red/text.o red/wram.o
: Unable to load fixed ROMX section into bank $1F
Makefile:91: recipe for target 'pokered.gbc' failed
make: *** [pokered.gbc] Error 1
What causes this?
I was able to build Kanzure's version without any errors. (except the fact my modified .asm files would not be applied in the build)
In the data/mapObjects/ files, objects are defined with object
and warp-to points with EVENT_DISP
. However, warps and signs are defined with db
. Using named macros would make it easier for mapping programs to parse these files. warp
and sign
would work, and would avoid colliding with pokecrystal's warp_def
, warp_event
, or signpost
.
db $7 ; people
db SPRITE_HIKER, $3 + 4, $5 + 4, $ff, $d0, TRAINER | $1, BLACKBELT + $C8, $1
db SPRITE_HIKER, $4 + 4, $3 + 4, $ff, $d3, TRAINER | $2, BLACKBELT + $C8, $2
db SPRITE_HIKER, $6 + 4, $3 + 4, $ff, $d3, TRAINER | $3, BLACKBELT + $C8, $3
db SPRITE_HIKER, $5 + 4, $5 + 4, $ff, $d2, TRAINER | $4, BLACKBELT + $C8, $4
db SPRITE_HIKER, $7 + 4, $5 + 4, $ff, $d2, TRAINER | $5, BLACKBELT + $C8, $5
db SPRITE_BALL, $1 + 4, $4 + 4, $ff, $ff, $6 ; person
db SPRITE_BALL, $1 + 4, $5 + 4, $ff, $ff, $7 ; person
db 7
object SPRITE_HIKER, 3, 5, FACE, DOWN, 1, BLACKBELT, 1
object SPRITE_HIKER, 4, 3, FACE, LEFT, 2, BLACKBELT, 2
object SPRITE_HIKER, 6, 3, FACE, LEFT, 3, BLACKBELT, 3
object SPRITE_HIKER, 5, 5, FACE, RIGHT, 4, BLACKBELT, 4
object SPRITE_HIKER, 7, 5, FACE, RIGHT, 5, BLACKBELT, 5
object SPRITE_BALL, 1, 4, FACE, STAY, 6
object SPRITE_BALL, 1, 5, FACE, STAY, 7
It would also help to describe what each parameter is and/or create shortcuts. For instance, $ff, $d3
means "face left".
object: macro
; sprite, x, y, action, direction, script
; - item_id
; - trainer, id
...
endm
Trainers and items take an extra two bytes and one byte respectively, so they can be inferred from _NARG
.
I wondered if you will be removing Missingno. Also I can I test this game? I don't know how to convert it into a .gba game yet but thanks anyway
Its supposed to remain the slow Cities1 music from when Oak walks in and talks to Red and Blue, and continue to play despite changing maps.
Can some one make an updated version on how to ad genders
I am not sure if "duty" and "dutycycle" are the best names. They could be potentially confusing because they don't agree with the usual meaning of "duty cycle".
Normally, the term "duty cycle" means the percentage of time a signal is active over one cycle (on a Game Boy, this can be 12.5%, 25%, 50% or 75%).
We are calling a fixed duty cycle "duty", which is fine, but we have another command called "dutycycle" which seems like it should be a synonym but isn't.
The "dutycycle" command specifies 4 duty cycles. Every update, the duty cycles are rotated. This results in a sequence of duty cycles that repeats every 4 updates. It could be called a cycle of duty cycles.
I don't know what the best names would be. Maybe "dutycycle" and "dutycycles" would make it more obvious. I also think that the existing "dutycycle" command should take 4 parameters rather than one.
What do you think?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.