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

Safe code for ace - Page 1

Safe code for ace

Posted by: DocB
Date: 2018-03-20 17:51:22
What kind of instruction can be used just like a nop in an ace with the ws m?
Tere are some register that you can edit without any impact? There are some instructions that do nothing?
I noticed that inc e could be pretty harmless but I didn't test it properly…
What about ld b,b ?

Any help?

Re: Safe code for ace

Posted by: ISSOtm
Date: 2018-03-20 21:20:24
It simply depends on what registers are clobbered at a given time.
`ld b,b` is always safe, and `inc e` is, as long as the value of E when it's executed isn't meaningful. (Or you can cancel it out with a `dec e`)

Re: Safe code for ace

Posted by: Krys3000
Date: 2018-03-21 03:37:10
I never use b in any code so I Inc b dec b etc. a lot

Re: Safe code for ace

Posted by: DocB
Date: 2018-03-21 05:09:31
Well ld b,b is very useful for odd code shorter than 8 byte, instead of use 201 amount of the final iteam for the ret you can use x64 of that iteam and a TM 01

If you use the ws m/8F for the first time you don't have to meet another missing no

Re: Safe code for ace

Posted by: ISSOtm
Date: 2018-03-21 06:25:48
The problem with `ld b, b` is that it maps to the Gold Tooth item, the quantity of which you can't modify. So that removes most of its usefulness.

And if you're trying to pad the tailing `ret`, it's better to use 3 of that item which maps to `inc bc` - but since you're RET-ing right after, BC doesn't matter anymore by that point.
3 items is better than 64.

Re: Safe code for ace

Posted by: DocB
Date: 2018-03-22 05:10:37

The problem with `ld b, b` is that it maps to the Gold Tooth item, the quantity of which you can't modify. So that removes most of its usefulness.


In wich way? ld b,b desn't simply put the value of the b semiregister in the b semiregister

Re: Safe code for ace

Posted by: Krys3000
Date: 2018-03-22 05:57:54
He's talking about the item matching the hex ID for ld b,b.

Inc b/d and dec b/d are better placeholders because they match cheap items and low quantities.

Re: Safe code for ace

Posted by: DocB
Date: 2018-03-22 10:32:54
Oh yeah, I misunderstood.
Thank you for the replies

Re: Safe code for ace

Posted by: ISSOtm
Date: 2018-03-22 17:14:38
Btw, b is a register, not a semiregister.

Re: Safe code for ace

Posted by: DocB
Date: 2018-03-23 08:40:28
isn't bc the register and b and c the semiregisters?

Re: Safe code for ace

Posted by: ISSOtm
Date: 2018-03-23 12:11:21
No, b and c are registers, bc is a register, although a register pair.

Re: Safe code for ace

Posted by: DocB
Date: 2018-03-23 12:43:15
Man Z80 makes me perplexed sometimes!
Thanks for the explanation