No SDcard or USB keyboard yet alas..
A (ZX81) program binary can been uploaded through the serial port (xmodem) and keyboard emulation is a crude serial to ZX keyrow conversion.
Need a Vsync or other 50/60 Hz time reference.
gertk wrote:Just to get the hang of this Bare Metal stuff I ported my mbed ZX81 emulator to the Pi![]()
No SDcard or USB keyboard yet alas..
hermanhermitage wrote:of course resource management (task, interrupt, processes, memory) is a little tricky to do in a neutral manner. Any takers?
jackokring wrote:hermanhermitage wrote:of course resource management (task, interrupt, processes, memory) is a little tricky to do in a neutral manner. Any takers?
I won't take to the coding, but you could do worse than virtual machines for this king of stuff.
hermanhermitage wrote:jackokring wrote:hermanhermitage wrote:of course resource management (task, interrupt, processes, memory) is a little tricky to do in a neutral manner. Any takers?
I won't take to the coding, but you could do worse than virtual machines for this king of stuff.
Not what I'm suggesting at all.
Instead I'm suggesting a policy agnostic library in C and assembler for re-use in different bare metal and OS projects. The key points (1) being C and asm are widely available and require minimal hosting and it's a well trodden path, and (2) there is only so much fun in raw SD, Ethernet and USB lower level layers - its ripe for re use to allow everyone to get on with the things that do excite them, like a Scheme based OS or a vintage emulation OS etc.
The skill is in the balancing act of setting up the hooks so the same raw code can be hosted in a suitable form for drivers across a range of OS from Linux to RISC OS to Tufty's or Dex's work etc.
jackokring wrote:
Each library needs OPEN, CLOSE, TXRX functions. TXRX accepts a command string, the contents of which are the command language of the interface. So construction of the command language is the abstraction. In fact one function call TXRX is needed, and open and close can be done on first and last use. Device selection could be part of the IO language.
jackokring wrote:I bet it's fast. I hope you take advantage of the multiple of memory to do a lot of pre-decoding of the Z80 bytecode.I suppose cross compiling it to ARM code in 4* the bytes could be expensive in memory? The nightmare of self modifying code with entry to the instruction stream half way through an opcode for multiple use.
![]()
Does the display disappear as you run out of memory?
ldr r0, =0x2000B214
ldr r1, =0x00010000
str r1, [r0]
/* Reset interrupt via SMICS register */
ldr r0, =0x20600000
mov r1, #0
str r1, [r0]
/* Address of GPU Pending 2 register */
ldr r0, =0x2000B208
/* Wait for the 48 SMI / VSync interrupt to occur */
LoopVSync$:
ldr r1, [r0]
tst r1, #0x00010000
beq LoopVSync$
DrPinball wrote:Let me know how you get on with it!
gertk wrote:I'm not sure if the display routine is the culprit or the Z80 emulation compiled by gcc is a lot slower than when using the mbed compiler. The emulator on the Pi is doing 4 to 5 frames per second...
poglad wrote:Wow this is superb, only just noticed it here. Don't worry about the keyboard line handling - a ZX81 keyboard membrane is a tenner off eBay! Even if you get it working via a USB keyboard, you should retain the possibility of connecting a real membrane as an option!![]()
Do you get the nice load/save lines on the screen? For testing, RAND USR 777 in fast mode dives straight into the SAVE routine for an extended period.
poglad wrote:Ahhhh... at the risk of being pedantic... no no no! Emulating the electron beam timings is a big part of the challenge of the ZX81. It really shouldn't be much more work than what you have already, you "just" have to determine whether a signal (including vsync, hsync) is actually coming from the "ZX81" as you're scanning down your frame buffer... and to follow the same kind of behaviour a TV would when the signal suddenly returns with a vsync at an unexpected moment. i.e., the picture rolls for a few milliseconds until the TV catches up.
Seriously, it's really worth doing for authenticity, and might actually be necessary for certain clever software that does special screen modes based on timing. The thrill of a ZX81 with rock-solid display would soon dissipate... rather like a Speccy without attribute clash hehe!
poglad wrote:Goody!!! This is great stuff.
Concerning the shortage of GPIO pins for use with a membrane keyboard, I wouldn't worry much about that. As long as the keyboard is put through something like a MCP23017 chip, which is just a wiring job really, it will magically transform into an i2c device that requires only two pins. Err, so they say.![]()
Now, if you can map GPIO access into the memory or port space of the ZX81, then we'll be able to write software to control the Gertboard etc.