home bbs files messages ]

Just a sample of the Echomail archive

COMPLANC:

<< oldest | < older | list | newer > | newest >> ]

 Message 242,492 of 243,097 
 bart to David Brown 
 Re: 8 bit cpu 
 19 Dec 25 16:05:06 
 
From: bc@freeuk.com

On 19/12/2025 15:16, David Brown wrote:
> On 19/12/2025 14:43, bart wrote:

>> I'm targeting Z80 right now from my systems language.

>> This is where my language will differ: b + c produces an 8-bit result,
>> and it is that that is widened.
>>
>
> Okay.  I think that is a better choice for a language for 8-bit devices
> than the choice C made.  I understand the rules for C integer promotion,
> but I don't like them.

I think it is a better choice for a capable processor, and I actually
adopted C's approach at some point.

Currently it works very well for my 64-bit product, but here C stops
short at promoting only to 32 bits! (When 'int' is 32 bits.) So you have
a mix of auto-promotion plus explicit casts to 64 bits.

>
>> Casts are needed to emulate the behaviour of the auto-widening done in
>> C. But this means somewhat more efficient code with a simpler compiler.
>
> Yes.
>
> Why are you targeting the Z80?  Is it just for fun?

Mostly, yes. My Z80 will be emulated, and I hadn't worked on an emulator
before.

Currently, emulated Z80 code runs at an equivalent clock-speed of 2-4GHz
(for whole-instruction-based emulation; some emulate clock-by-clock and
do pin-signals too).

The original Z80s ranged from 2.5 to 8MHz. (Newer Z80-based CPUs take
fewer clocks per instruction, and may use pipelining.)

The other side of it is in exercising the IL I use for my compilers, and
seeing how well it can cope with a small device. My product will be a
cross-compiler, and it'll be a novelty seeing modern language features
(lots don't depend on target capabilities) be used for such a device.

(I wrote real Z80 compilers in the past; those actually ran on the Z80!
But were crude.)

>  It was a great
> device in its time, and I learned a lot of assembly with that processor,
> but has been decades since it was used for anything new.  While the
> chips are still available,

They stopped making Z80 chips in 2024 (you can still get Z180 etc). I've
got one on my shelf somewhere (decades ago my company bought them in
bulk!). I might get around to using it for real.

--- SoupGate-Win32 v1.05
 * Origin: you cannot sedate... all the things you hate (1:229/2)

<< oldest | < older | list | newer > | newest >> ]


(c) 1994,  bbs@darkrealms.ca