Omnimaga
Calculator Community => TI Calculators => ASM => Topic started by: obj04 on April 07, 2020, 02:56:14 pm
-
Hey calculator community!
A while ago, I made a Pokémon Yellow savefile editor.
I explored the world of Pokémon 1st Generation glitches until it became boring.
Somehow, I found an online article about ROM-Hacking which made me think about making my own game.
I decided to write my game for the Nintendo GameBoy Color :crazy: , because I happened to have gbc4nspire installed on my Nspire.
Are you shocked because I mentioned my Nspire? :o
Hold on, the best is yet to come.
I had to write my own Assembly compiler in Micropython! :w00t:
And - it works just fine, although I just cobbled some more or less sensible classes together...
My game does not do very much yet. This could be caused by the fact that I only had some GameBoy (not GameBoy Color) docs to learn the GBC development. :banghead:
But I already finished the overworld map, great thanks to Zeda. :)
You can find my map draft in the attachments.
Stay cool everyone. See ya!
-
"thanks to Zeda" ===> "Zeda said that the map and names it looked cool"
That is genuinely cool stuff, I'm quite impressed with that compiler and development right on the nspire, great work!
-
I would be interested to get some more information on the assembly compiler you wrote.
-
"thanks to Zeda" ===> "Zeda said that the map and names it looked cool"
That is genuinely cool stuff, I'm quite impressed with that compiler and development right on the nspire, great work!
I wrote this because you had the idea to name some of the cities after electronic components :)
-
I would be interested to get some more information on the assembly compiler you wrote.
It works like this:
- Split the source file into an array of code lines and replace "#include <xyz>" by an array of code lines of "xyz"
- Remove comments
- Create a list which contains all jump-labels and aliases
- Convert every line of code into it's opcode, followed by it's arguments, e.g. "nop" -> 0x00, and insert the results into a bytearray
- Replace all aliases by their values
- Write the bytearray's content into a file
I hope this is what you wanted to know. :)
-
Nice project! This reminds me of the time when I tried to build a pokemon clone for the nspire with a few friends. It never went anywhere. :P Good luck, I hope you'll get further than we did.
-
Nice project! This reminds me of the time when I tried to build a pokemon clone for the nspire with a few friends. It never went anywhere. :P Good luck, I hope you'll get further than we did.
Thanks, I have a good feeling about my project, because I currently don´t have very much other things to do.
But I´ll probably need some help when I have to invent some Pokémon names.
I´m not very creative in creating fictional names in English... x.x
For all people interested in my homebrew compiler:
If you want to test my compiler, make sure to have micropython and nTxt installed.
Then create the following files/directories:
/documents/
|- DevBoy/
|- compileASM.py.tns (<- you can find this file in the attachments)
|- project/
| |- main.asm.tns
|
|- global/
|- opcodes.inc.tns
|- inc/
|- asm/
|- bin/
The opcodes.inc file follows this structure (you´ll have to insert all opcode-mnemonic-assignments you want to use *.*):
00 = nop
76 = halt
7F = ld a,a
3A = ld a,(**)
3E = ld a,*
CB 07 = rlc a
* means a 1-Byte value or address
** means a 2-Byte value or address
You can use the following compiler commands in your source files:
- #define alias value - replaces all occurences of alias with value in the compilation process.
- #include <xyz> - includes the global library global/inc/asm/xyz.asm in your project.
- #include "xyz" - includes the project-level library project/xyz.asm in your project.
- .db $CB,$07 - inserts hex CB07 at the current position in the bytearray that is to be written into the ROM file. .db $CB,$07 would be equivalent to rlc a.
- .org $015A - makes the compiler continue writing the compilation results into the rom file at position hex 15A. See the example below.
; This is the file "main.asm".
; The ROM starts at pos $00, logically.
.db $FF ; Write 1 byte to pos $00 ==> pos will be incremented by 1
; pos is now $01
.org $02 ; Jump to pos $02 (skip pos $01)
.db $EE ; Write 1 byte to pos $02 ==> pos will be incremented by 1
When you compile this, your ROM file will contain the following 3 bytes: \xFF\x00\xEE
Jump labels etc. are marked by ::, e.g.:
infinite_loop::
jp infinite_loop
If you want to insert some immediate values, i.e. as command parameters, you have the following options:
ld a,%10010101 ; load binary 10010101 (=149) into register a
ld a,$95 ; load hex 95 (=149) into register a
ld a,#149 ; load decimal 149 into register a
If you use the .db command, you can insert an ASCII string too (e.g. .db "Hello World").
Edit (Eeems): Merged double post
-
Jump labels etc. are marked by ::, e.g.:
infinite_loop::
jp infinite_loop
What's the reason for going with :: instead of the standard :
-
Jump labels etc. are marked by ::, e.g.:
infinite_loop::
jp infinite_loop
What's the reason for going with :: instead of the standard :
There's no special reason. I just took it over from a code example.
Furthermore, I'll be able to add : for file-level jump labels.
-
I made a grass tile.
It has 3 possible background colors, for a grass, mud, or snow terrain.
Actually, it should look like one of the grass tiles from Pokémon
generation 3 & 4, but now I think it kinda looks like a hemp leaf...
What do you think? Do you have some better ideas?
By the way, the image preview is upside down, for some reason.
Edit (Eeems): merged double post
-
This is interesting. I hope you keep on trying!