CPCWiki forum

General Category => Programming => Topic started by: zhulien on 07:27, 15 February 23

Title: A cool Z80 optimisation
Post by: zhulien on 07:27, 15 February 23
http://www.z80.info/sint.htm

I wonder if there are any other obscure but cool Z80 optimisations such as this?
Title: Re: A cool Z80 optimisation
Post by: roudoudou on 08:36, 15 February 23
take a look at TI-85 website, spectrum or MSX forums ;)

try this on any search engine
"Z80 math"
"Z80 optimisation"
"z80 fast"
Title: Re: A cool Z80 optimisation
Post by: zhulien on 14:00, 15 February 23
Regarding rasm... what is it coded in? Can it be cross compiled to run on Linux? In particular can it run as a php extension?
Title: Re: A cool Z80 optimisation
Post by: roudoudou on 14:29, 15 February 23
Quote from: zhulien on 14:00, 15 February 23Regarding rasm... what is it coded in? Can it be cross compiled to run on Linux? In particular can it run as a php extension?

rasm is pure C, it may compile with MorphOS, MacOS, Linux, Windows, MSDOS (with a few restrictions)

i know it's possible to use it with webassembly but do not ask me for details :D


Title: Re: A cool Z80 optimisation
Post by: Prodatron on 15:17, 15 February 23
Quote from: zhulien on 07:27, 15 February 23http://www.z80.info/sint.htm

I wonder if there are any other obscure but cool Z80 optimisations such as this?
In fact it is replacing a

CALL condition,#38 (3 bytes, 5 or 3 nops)

by

JR condition,-1 (2 bytes, 3+4 or 2 nops)

You save one byte.
But depending on how often the condition is true, you will loose execution time.
If it's 50:50 you already loose half a nop, if the condition is mostly true, even up to 2 nops.
Title: Re: A cool Z80 optimisation
Post by: dthrone on 15:37, 15 February 23
This was even referenced in JSW2!

https://tcrf.net/Jet_Set_Willy_II:_The_Final_Frontier_(Amstrad_CPC)

Title: Re: A cool Z80 optimisation
Post by: zhulien on 16:59, 15 February 23
Quote from: roudoudou on 14:29, 15 February 23
Quote from: zhulien on 14:00, 15 February 23Regarding rasm... what is it coded in? Can it be cross compiled to run on Linux? In particular can it run as a php extension?

rasm is pure C, it may compile with MorphOS, MacOS, Linux, Windows, MSDOS (with a few restrictions)

i know it's possible to use it with webassembly but do not ask me for details :D



Sounds Like what I am trying to do. Actually in 8bitology I used someone else's assembler to allow for online assembly of z80.  It really never got to commercial quality so it can't really assemble much.  I'd love to use rasm for my cross assembler which would allow direct assembly and download to a real cpc via m4.
Powered by SMFPacks Menu Editor Mod