Glitch City Laboratories Archives

Glitch City Laboratories closed on 1 September 2020 (announcement). This is an archived copy of a thread from Glitch City Laboratories Forums.

You can join Glitch City Research Institute to ask questions or discuss current developments.

You may also download the archive of this forum in .tar.gz, .sql.gz, or .sqlite.gz formats.

Arbitrary Code Execution Discussion

Now I know a little bit about gbz80 assembly. - Page 1

Now I know a little bit about gbz80 assembly.

Posted by: joshuarpl2
Date: 2018-12-04 10:22:32
I now know how to change an address in Assembly, It goes like this

Loading a value into A! ld  a,<value>
Loading A's value into an address! ld  (<adress>),a
But i have no idea how to increment or decrement values, but at least what I know now is a start to programming.
However I have a problem with this https://eldred.fr/gbz80toitems3/
Whenever I use ld  (<adress>),a It says Line <Line number> : <address> is badly formatted hexadecimal !
How do I fix this?  :-\

Re: Now I know a little bit about gbz80 assembly.

Posted by: Torchickens
Date: 2018-12-04 10:28:48
ld a,$<value> and ld ($<address>),a should work. Hope this helps.

The converter can be really picky with certain things. Let me know if there are any other errors and I'll try to resolve them for you.

Re: Now I know a little bit about gbz80 assembly.

Posted by: joshuarpl2
Date: 2018-12-04 10:42:22
Oh, hey, thanks! I was just forgetting the $! Thanks for fixing it for me, I was scared there for a second.

Re: Now I know a little bit about gbz80 assembly.

Posted by: ISSOtm
Date: 2018-12-04 13:21:34
If you want to learn GB ASM, I made a tutorial.

Re: Now I know a little bit about gbz80 assembly.

Posted by: joshuarpl2
Date: 2018-12-04 16:49:59
2 questions

How do you display a textbox with you're own text?
How do you do a delay?

Re: Now I know a little bit about gbz80 assembly.

Posted by: ISSOtm
Date: 2018-12-05 00:34:53
Displaying a textbox is fairly complicated… I'm not sure, especially considering that there's already text on-screen when an item is used.

I'm not sure what you mean by "a delay". If you want to wait for the next frame, you can call the DelayFrame function; if you just want to wait, there's the SGB wait function (waits four frames or so), or you can just make your own time-wasting loop

Re: Now I know a little bit about gbz80 assembly.

Posted by: joshuarpl
Date: 2018-12-20 18:52:52
So, someone banned my alt account, huh? Well, Guess i'll have to work towards getting rid of my WPM!
By "delay" I mean like, how do you delay for an amount of seconds?

Re: Now I know a little bit about gbz80 assembly.

Posted by: ISSOtm
Date: 2018-12-21 01:33:05
You can call `DelayFrames`. But what do you need this for?

Re: Now I know a little bit about gbz80 assembly.

Posted by: joshuarpl
Date: 2018-12-29 16:21:29
In Blockland, 1000 milliseconds is a single second!
I wonder if this works the same way?

Re: Now I know a little bit about gbz80 assembly.

Posted by: Parzival
Date: 2018-12-29 19:27:17
1000 milliseconds to 1 second is the standard metric conversion, yes. The system runs at something like 59.8338FPS constant iirc, so one frame is 1/59.8338, or 16.852 milliseconds a frame. Also, isn't Blockland a PC game? How does that have any bearing on this?

Re: Now I know a little bit about gbz80 assembly.

Posted by: joshuarpl
Date: 2019-02-07 15:10:13

1000 milliseconds to 1 second is the standard metric conversion, yes. The system runs at something like 59.8338FPS constant iirc, so one frame is 1/59.8338, or 16.852 milliseconds a frame. Also, isn't Blockland a PC game? How does that have any bearing on this?


I know it's a PC game (Blockland), but does Pokemon Blue/Red/Yellow also see 1000 milliseconds as a single second?

Re: Now I know a little bit about gbz80 assembly.

Posted by: Torchickens
Date: 2019-02-07 15:21:22


1000 milliseconds to 1 second is the standard metric conversion, yes. The system runs at something like 59.8338FPS constant iirc, so one frame is 1/59.8338, or 16.852 milliseconds a frame. Also, isn't Blockland a PC game? How does that have any bearing on this?


I know it's a PC game (Blockland), but does Pokemon Blue/Red/Yellow also see 1000 milliseconds as a single second?


I think if it is 16.852 milliseconds a frame, then 16.852 x 59.834 gives you the number of milliseconds for one second on a Game Boy game, which is about 1008.32 milliseconds.

Re: Now I know a little bit about gbz80 assembly.

Posted by: Parzival
Date: 2019-02-07 20:25:16



1000 milliseconds to 1 second is the standard metric conversion, yes. The system runs at something like 59.8338FPS constant iirc, so one frame is 1/59.8338, or 16.852 milliseconds a frame. Also, isn't Blockland a PC game? How does that have any bearing on this?


I know it's a PC game (Blockland), but does Pokemon Blue/Red/Yellow also see 1000 milliseconds as a single second?


I think if it is 16.852 milliseconds a frame, then 16.852 x 59.834 gives you the number of milliseconds for one second on a Game Boy game, which is about 1008.32 milliseconds.
1008.3191976 milliseconds, without rounding, yeah.

Re: Now I know a little bit about gbz80 assembly.

Posted by: joshuarpl
Date: 2019-05-08 17:15:15
I found a way to display strings without taking up TOO much memory, I know this doesn't really have too much relation, but I used the TI-84 z80 assembly compiler's Quick hex feature, bgb doesn't support labels, and I couldn't figure out how to install Cygwin or make properly, and I'm no Linux user, I use Windows,
I'd just change the header code

#define    progStart  $9D95
.org        progStart-2
.db        $BB,$6D

to
#define    progStart  $DA80
.org        progStart


and write my code below (not including BCALLS because BCALLS are a custom assembly function only on the TI-84 calculator)

I then use the Quick hex feature and paste that into DA80 on emulated Pokemon Yellow…

…Oh, and if this post is way too long, I am sorry for breaking the rules if I am!

Assembly code
ld hl,$C3A0
    ld bc,character
write:
ld a,(bc)
    cp $00
    jr z,return
    jr continue
continue:
ld (hl),a
    inc hl
    inc bc
jp write
return:
ret
character:
.db 1,2,3,4,5,6,7,8,9,10,11,12,0


Hexadecimal
21 A0 C3 01 94 DA 0A FE 00 28 08 18 00 77 23 03
C3 86 DA C9 01 02 03 04 05 06 07 08 09 0A 0B 0C 00


Oh, and end the string with 00, The string is right past the C9

Re: Now I know a little bit about gbz80 assembly.

Posted by: Sherkel
Date: 2019-05-09 03:24:36
Huh! That's quite a lot it looks like you've done there. The TI-84 assembler is certainly a strange workaround, to say the least, but it did seem to produce valid GBz80 and binary. I'm not sure what might have gotten in the way of installing Cygwin on Windows, as I remember it being straightforward after downloading the installer from the program's site. As for make, that's much faster yet, once you have Cygwin of course. You can certainly ask about anything you're stuck on, especially considering you seem to have created more questions for yourself in the process of trying to figure this out than you answered. What Isso was saying was just to make some effort to figure out the answer to something first instead of asking straight away about it. There's also nothing at all in the rules about long posts. As for your code…it didn't do anything on my end. It didn't freeze, but it also didn't do anything else. You're on the right track by trying to write to $C3A0. But as for actually doing it…well, remind me to get back to that when I'm more awake. In the meantime, though, maybe check out jfb1337's RAM writer for reference. There's even a video to show exactly how it looks. Do you have a picture of what it looked like for you when you tried yours? And again, you don't need to be nearly so nervous here, especially when it comes to relevant content.

All that said, maybe your first project could be something else? Maybe something based off an example in Isso's programming guide, or a well-known RBY script? I just think there might be a better place to start.