Deutsch English Français Italiano |
<vs6nep$enig$1@paganini.bofh.team> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!3.eu.feeder.erje.net!feeder.erje.net!newsfeed.bofh.team!paganini.bofh.team!not-for-mail From: antispam@fricas.org (Waldek Hebisch) Newsgroups: comp.lang.c Subject: Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?) Date: Fri, 28 Mar 2025 17:49:15 -0000 (UTC) Organization: To protect and to server Message-ID: <vs6nep$enig$1@paganini.bofh.team> References: <vrd77d$3nvtf$2@dont-email.me> <87iko3s3h2.fsf@nosuchdomain.example.com> <vrrvgp$1828d$1@dont-email.me> <874izi82a4.fsf@nosuchdomain.example.com> <vrttin$321rm$1@dont-email.me> <vrus18$3srn9$1@dont-email.me> <vruttb$3tpl0$1@dont-email.me> <vrv15d$1gs4$1@dont-email.me> <vs0kv7$1hb4h$2@dont-email.me> <vs11oi$1tp3r$1@dont-email.me> <vs1b8b$24nub$5@dont-email.me> <vs1ftc$2a7cq$1@dont-email.me> <vs225e$2pgqi$1@dont-email.me> <vs28hh$2ug7$1@paganini.bofh.team> <vs29so$30qs0$1@dont-email.me> Injection-Date: Fri, 28 Mar 2025 17:49:15 -0000 (UTC) Injection-Info: paganini.bofh.team; logging-data="482896"; posting-host="WwiNTD3IIceGeoS5hCc4+A.user.paganini.bofh.team"; mail-complaints-to="usenet@bofh.team"; posting-account="9dIQLXBM7WM9KzA+yjdR4A"; User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (Linux/6.1.0-9-amd64 (x86_64)) X-Notice: Filtered by postfilter v. 0.9.3 Bytes: 3730 Lines: 57 bart <bc@freeuk.com> wrote: > On 27/03/2025 01:10, Waldek Hebisch wrote: >> bart <bc@freeuk.com> wrote: >>> On 26/03/2025 18:09, Janis Papanagnou wrote: >>> >>>> , primitive CPU architectures, >>> >>> 8-bit architectures were fine, just a bit short of registers and with >>> limitation instruction sets. But that is to be expected with only 27,000 >>> transistors on a chip or whatever it was for Z80. >> >> All sources that I found say that Z80 is about 8000 transistors. >> You probably took number from 8086 which was climed to have 27000 >> transitors. > > OK, then with 8000 it makes the capabilities even more remarkable. > Current processors have billions of transistors. > >> Z80 (like earlier 8080) in "general" instructions required >> accumulator as one of arguments, that severly limited utility >> of registers. >> >>> (BTW, have a go at emulating such a processor in sofware; tell me in 3 >>> months how you got on.) >> >> Lone processor is not very interesting. I do not think coding >> simple emulator would take a lot of time. Z80 instruction set >> is a bit bulky, due to prefixed instructions, but decode could >> be done quite naively using 5 tables with 256 positions each >> (or a bit smarter using 3 tables) > > I don't think this is the one I saw, but the z80.c file here: > > https://github.com/redcode/Z80/tree/master/sources > > is nearly 3000 lines. There is a lot of stuff consider! Yes, that looks like resonable size for Z80 CPU emulator. I have bunch of emulators that I fetched from the net and size of Z80 emulation seem to be between 2000 and 8000 lines. > In my case, I wanted something performant, but I could see 90% of > emulation time being spent in multiple flags most of which would never > be tested. I am not sure why you care about performance. Currenly popular method to get good performance is on the fly binary translation. You translate short streches of instructions, that gets rid of most flag setting. Also, at assembly level one can take advantage of similarity between Z80 and x86 flags. I shortly looked into existing emulators and was thinking about making my own, but then decided that this is not worth the effort. I have buch of programs from period when I used Z80, but almost no need to use them now. -- Waldek Hebisch