Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2013-03-11 01:43:08

AlexTheRose
New member
Registered: 2013-03-11
Post 1/2

Resource for scripting in R/B

Is there a resource for scripting in Red/Blue that doesn't involve ASM knowledge?

I kind of prefer knowing what each byte does and its arguments in hex, so...

Offline

#2 2013-03-11 02:41:42

Tauwasser
Member
Registered: 2010-10-16
Post 353/448

Re: Resource for scripting in R/B

Considering that most scripts are in plain ASM, the answer is probably no. Except of course if you want to edit ASM through your hex editor ',:-)

cYa,

Tauwasser

Offline

#3 2013-03-11 05:08:33

comet
Member
Registered: 2012-04-09
Post 161/679

Re: Resource for scripting in R/B

AlexTheRose wrote:

I kind of prefer knowing what each byte does and its arguments in hex, so...

that is literally asm

Offline

#4 2013-03-11 16:14:42

AlexTheRose
New member
Registered: 2013-03-11
Post 2/2

Re: Resource for scripting in R/B

I'm talking like this stuff:

;ROM6:4E5B
    ld a,($d74b)    ;1
    bit 4,a         ;2
    jr z,.next0\@   ;3
    ld hl,$d747     ;4
    set 6,(hl)      ;5

.next0\@
;ROM6:4E67
    call $3c3c      ;6
    ld hl,$4e73     ;7
    ld a,($d5f1)    ;8
    jp $3d97        ;9

I can't read that. If ASM is just plain hex commands, then it's easy for me. It's all that stuff in the code tags that doesn't make sense. :<

...Maybe there's a resource for reading that above...?

Last edited by AlexTheRose (2013-03-11 16:20:54)

Offline

#5 2013-03-11 18:51:20

Miksy91
Member
Registered: 2010-10-16
Post 1,561/2,317

Re: Resource for scripting in R/B

All of these are called instructions. Each instruction is 8-bits (or 1 byte) long. But many have parameters attached to them.
The way you read this code is simply;

The first instruction there is used to load register a with the value of a certain ram address, ld a, ($ram address). You could write the same thing in rom using a hex editor but that kind of presentation is simply not user-friendly. If you are to read/write code, you want it to be presented so you can understand what you're doing. And "ld a,($d74b)" is a way more understandable way of presenting what the processor is made to execute than the same thing being written in byte form which happens to be "FA 4B D7". This "FA" wouldn't tell anyone much, or at all, really.

ASM is a machine language, a coding system the processor uses. Scripting language is a built-in programming language based on the assembly. Just like with asm, you wouldn't want to edit script data in hex, you'd much rather use a script editor for the job.

Look for a site called "ASMSchool", that was the place I started with. The site doesn't cover that much information, but it will give you the basics you need. Then, look for a z80 processor instruction set and start looking at what you've got there.

And another example of what we've got above:

call $3C3C

Here we've got call -instruction. And attached to it, we've got two parameters for the rom address we call another routine from. So all in all, we've got one byte for the instruction ("call") and two bytes for the rom address we call from. And in rom, this is written as "CD 3C 3C" in which CD presents "call".

Last edited by Miksy91 (2013-03-11 19:02:46)

Offline

#6 2013-03-11 20:31:15

Tauwasser
Member
Registered: 2010-10-16
Post 354/448

Re: Resource for scripting in R/B

I always liked this page: http://www.z80.info/z80code.htm

It will teach you the basic mnemonics for all basic commands. Notice though that the GB does not contain shadow registers and some new opcodes have slightly different mnemonics and semantics.

cYa,

Tauwasser

Offline

Board footer

Powered by FluxBB