12:19:42
##forth
<pgimeno>
well, this is frustrating... as some of you know, I spent several days working on an interpreter for the Jupiter ACE flavour of Forth. That interpreter is now feature-complete, save for SAVE (sorry for the pun) which I will complete next. But...
12:21:31
##forth
<pgimeno>
I need to validate the results, and typing on a real or emulated Juppy is cumbersome, and checking the results is prone to mistakes. So it occurred to me to write a JA emulator that traps the ROM line input and display output routines, and redirects them to a file.
12:21:49
##forth
<xentrac>
congratulations! that sounds sensible
12:22:50
##forth
<pgimeno>
Now that emulator is written. It cost me about an hour to write. But... it does basically all that my interpreter does, just with 100% guaranteed accuracy. So it makes me wonder, why did I bother to write the interpreter in the first place? *facepalm*
12:25:03
##forth
<pgimeno>
thanks xentrac
12:28:54
##forth
<veltas>
Learning exercise I guess
12:29:01
##forth
<veltas>
Or fun
12:29:06
##forth
<pgimeno>
incidentally, I was quite surprised that the Z80 emulation core I'm using (jgz80) runs at about 8,5 real CPU cycles per Z80 cycle. So in my 3600 MHz machine it's a Z80 running at 425 MHz.
12:29:12
##forth
<veltas>
Both sound cool to me either way
12:29:51
##forth
<veltas>
My favourite Z80 emulator is what fuse (emulator) uses
12:30:41
##forth
<pgimeno>
veltas: Yes, it was both, I give you that :) I got a much better understanding of indirect threading, for one. It also has two advantages, 1) it does not need to be compiled for every target machine, it just needs a Python interpreter; and 2) it does not need the ROM so no copyright issues
12:30:45
##forth
<veltas>
I think 425MHz is a normal speed for interpreting machine code, so I'm assuming it interprets it rather than doing any JIT magic
12:31:04
##forth
<pgimeno>
yeah, totally interpreted
12:31:34
##forth
<veltas>
CPU's are so good that you still get >400MHz easily, which is really cool
12:32:03
##forth
<veltas>
400MHz Z80 to take over the world lol
12:34:04
##forth
<pgimeno>
I chose this core because it was announced to be fast, and because it turned out to be very simple - monolithic (only 1 header and 1 C file), written in C instead of C++, and just needs 4 callbacks (memory R/W and I/O) to get started. What are the advantages of fuse's core?
12:35:15
##forth
<veltas>
fuse is very mature and runs damn well on even old hardware, all the new speccy emulators don't fit this bill
12:35:39
##forth
<veltas>
But for sake of just the CPU emulation I wouldn't move away from jgz80, if it works
12:36:07
##forth
<pgimeno>
my only "problem" with the jgz80 is that it's too accurate for this purpose (WZ, Q and whatnot), and I could well trade accuracy for speed
12:36:29
##forth
<veltas>
If you want that tradeoff you probably need to write your own
12:36:39
##forth
<veltas>
Everyone emulating Z80 is primarily interested in realism
12:37:57
##forth
<pgimeno>
yeah, you're right, there may be some exceptions (thinking simh for example) but those probably don't care much about speed either
12:38:45
##forth
<pgimeno>
I think rather than writing my own, I could modify jgz80 to remove the extra bloat
12:39:25
##forth
<veltas>
Theoretically 400MHz is already quite good
12:39:58
##forth
<xentrac>
pgimeno: the interpreter is probably more comprehensible, and you can do things like add single-step debugging and stuff
12:40:02
##forth
<pgimeno>
yeah it's about 125 times faster than a juppy
12:40:02
##forth
<veltas>
IMO if you want faster execution, the obvious route is to port the dialect to AMD64 or whatever your CPU is
12:40:16
##forth
<xentrac>
veltas: heh, a 425MHz Z80 sounds great
12:41:30
##forth
<pgimeno>
for the purpose I'm targeting, I'm happy with how it runs, I'm just a bit too perfectionist when it comes to unnecessary bloat, but if I can get over that, it's pretty fine as is
12:41:45
##forth
<xentrac>
pgimeno: does your interpreter work in PyPy? that might make it a lot faster
12:41:46
##forth
<pgimeno>
oh that sounds cool GeDaMo
12:42:01
##forth
<GeDaMo>
Built in an FPGA
12:42:09
##forth
<veltas>
I got a kick out of rewriting the konilo VM in AMD64
12:42:38
##forth
<pgimeno>
xentrac: sorry, there may be a confusion. My interpreter will probably work in PyPy, but we're talking about the Z80-based Jupiter emulator that I wrote for validating the interpreter.
12:43:36
##forth
<xentrac>
right, I understand
12:44:18
##forth
<pgimeno>
the goal of my interpreter was to enable Jupiter users with the ability to write programs in a PC with modern editors and stuff, and compile them to a tape file for use in emulators or in the real Jupiter. For that purpose, actually not much speed is necessary.
12:44:56
##forth
<xentrac>
more speed always opens up new uses for software
12:59:05
##forth
<veltas>
Lots of stuff opens up new uses, but we don't have infinite time for development!
13:00:21
##forth
<xentrac>
nope, which is why PyPy is so nice :)