SOL20 Terminal Computer

Discussion about other targets
Post Reply
nippur72
Member
Posts: 26
Joined: Sat Sep 29, 2018 4:47 pm

SOL20 Terminal Computer

Post by nippur72 »

Has anyone ever compiled for the SOL20 Terminal Computer ? I tried with the +cpm -m8080 -clib8080 options but my program crashes on startup. I also tried with a minimal crt0.asm which only sets the stack; the program starts normally but it hangs sometime later for no apparent reason.

It would be great if we could have this target added to Z88DK. The info I've gathered so far:

Code: Select all

CPU 8080 with 48K RAM
VIDEO: 64x16 text, screen memory at $CC00-$CCFF
CHARSET: plain ASCII with reverse characters, 0-31 are special (useless) glyphs
KEYBOARD:
- status port: $FA (~INP($FA) & 1) == 0 means no key pressed
- data port: $FC plain 7 bit ascii
AUDIO: 1 bit audio triggered by the interrupt enable line (flipping DI / EI)
Peripherarls: tape and disk, it can run CP/M but the most common configuration is the tape-only one with builtin ROM monitor.
According to MAME, the memory layout is the following:
//      map(0x0000, 0x07ff).bankrw("boot");
//      map(0x0800, 0xbfff).ram(); // optional s100 ram
//      map(0xc000, 0xc7ff).rom();
//      map(0xc800, 0xcbff).ram(); // system ram
//      map(0xcc00, 0xcfff).ram().share("videoram");
//      map(0xd000, 0xffff).ram(); // optional s100 ram
How to quickly test a program on the sol-20 emulator:

There is an emulator for Windows called Solace. After you run it, go to "File" -> "Load Program..." and choose a .ENT file. Then type EXEC DF80 (where DF80 is the loading address shown in the status bar on the bottom of the window).

An ENT file is a monitor-like text dump like this:

Code: Select all

EN DF80
DF80: 23 7E FE C3 C2 24 E0 2E 1F 7E FE 3A C2 24 E0 7C 
DF90: 32 D0 DF 32 FC DF 2E 00 2B 22 91 D1 21 E9 DF 22 
... omitted ...
FFE0: CA C7 FF 2B C3 DF FF FE 0D C8 7E FE 0D CA C1 FF 
FFF0: C3 CE FF 2A EF D0 22 91 D1 C3 60 E0/

Useful links:
- Mame's ptcsol.cpp
- Sol20.org
- Sol-20 Wikipedia article
nippur72
Member
Posts: 26
Joined: Sat Sep 29, 2018 4:47 pm

Re: SOL20 Terminal Computer

Post by nippur72 »

and btw this is the minimal crt0.asm I'm using right now:

Code: Select all

zcc +test -crt0=sol20_crt0.asm -m8080 -clib=8080  --list -m -s tetris.c -o out\tetris.com -DZCC -DSOL20

Code: Select all

EXTERN _main           
EXTERN main            
                       
    org 0x0100         
                       
    start:             
        ld hl, 0xbfff  
        ld sp, hl      
        call _main     
        ret            
        halt
My tetris port starts normally but hangs later during the game. The (almost) same code compiled for another CP/M computer works perfectly.
nippur72
Member
Posts: 26
Joined: Sat Sep 29, 2018 4:47 pm

Re: SOL20 Terminal Computer

Post by nippur72 »

UPDATE: the issue was caused by a memory leak :rolleyes:, so it's working now with the minimalistic custom crt0.asm.

Anyway it would still be interesting to have it as a target, I am interested mainly in using the sound library (bit_fx()), I don't know if it's possible to port it to 8080 and DI/EI bit flipping.
User avatar
dom
Well known member
Posts: 1676
Joined: Sun Jul 15, 2007 10:01 pm

Re: SOL20 Terminal Computer

Post by dom »

I always like adding new targets!

It looks like most of it is there - VDM video is already supported. Just need a subtype= and a disc format.

I’ve not had a chance to search yet, but a pointer to the ROMs and CPM boot disc for mame would be handy.

Not all of the sound library will run on an 8080, but a fair bit will. Toggling of the interrupt line is awkward, but I just made a change for the Jupiter Ace that could be a good template.
User avatar
dom
Well known member
Posts: 1676
Joined: Sun Jul 15, 2007 10:01 pm

Re: SOL20 Terminal Computer

Post by dom »

I did a bit of reading, supporting .ent files looks like it's the best way forward really.

Given the tape format is the same as the Sorcerer it should be pretty easy to add an option to generate those for real hardware.

So: https://github.com/z88dk/z88dk/commit/8 ... e1ff6868d3 is the start of it: need to add some keyboard reading to make it slightly viable.

Are you planning on creating a web emulator?
nippur72
Member
Posts: 26
Joined: Sat Sep 29, 2018 4:47 pm

Re: SOL20 Terminal Computer

Post by nippur72 »

thank you I tried to compile my game and it worked flawlessly (+sol20 -create-app).

Anyway the binary size increased from 8426 to 9107 bytes, but I guess there's some compiler switch I can use in order to avoid linking unwanted stuff.

As regards a web emulator, I don't have enough knowledge about the Sol20 and the existing emulator (Solace) is pretty good; the only downside of it is that it's Windows only. MAME should emulate it as well, but I haven't tried it yet.
User avatar
dom
Well known member
Posts: 1676
Joined: Sun Jul 15, 2007 10:01 pm

Re: SOL20 Terminal Computer

Post by dom »

Thanks for the report, that's great news.

Yes, I suspect it will be dragging a bunch of stdio structures etc, the pragmas here: https://github.com/z88dk/z88dk/wiki/Cla ... -behaviour should help you reduce it down.

Solace seems to work well enough under wine so I've not tried name either.
User avatar
RobertK
Well known member
Posts: 297
Joined: Mon Feb 26, 2018 12:58 pm

Re: SOL20 Terminal Computer

Post by RobertK »

Two small issues with this interesting target (tested with the Solace emulator):

1. There is no reaction from the virtual joysticks.

2. Floating point calculations make the program crash. Maybe using mbf32 instead of the standard -lm library would help? @Dom: the last mbf32 files I got from you are version 14, now 16 is required, so these would need to be updated.

Attached is a test package for both issues.
You do not have the required permissions to view the files attached to this post.
User avatar
dom
Well known member
Posts: 1676
Joined: Sun Jul 15, 2007 10:01 pm

Re: SOL20 Terminal Computer

Post by dom »

We imported the source code a few months ago - managing the optimisations we'd made for other CPUs was a little unwieldy.

As a result the nightly should have a working library in it already.
User avatar
RobertK
Well known member
Posts: 297
Joined: Mon Feb 26, 2018 12:58 pm

Re: SOL20 Terminal Computer

Post by RobertK »

Hmm, both issues are still unchanged in tonight's nightly...
User avatar
dom
Well known member
Posts: 1676
Joined: Sun Jul 15, 2007 10:01 pm

Re: SOL20 Terminal Computer

Post by dom »

Well, I'd forgotten that the Sol20 was an 8080 machine which does make a little difference!

joystick() based on getk() was a a complete noop for 8080 which explains why you didn't see anything. This should now be fixed. However, for this target, the joysticks may not be that great:

- There's no autorepeat
- Only one joystick can be read (the act of scanning the IO port clears the value)

Since it's an 8080 machine, only --math-mbf32_8080 or -math-dai32_8080 will work. I've just checked the nightly build and it looks like the library is fully built in it.
User avatar
RobertK
Well known member
Posts: 297
Joined: Mon Feb 26, 2018 12:58 pm

Re: SOL20 Terminal Computer

Post by RobertK »

Thanks, my programs Mastermind RK and Elite Planet Browser now support the SOL-20.
dom wrote: Tue May 10, 2022 8:41 pm - There's no autorepeat
- Only one joystick can be read (the act of scanning the IO port clears the value)
Ah, that't the "only one joystick() call per game loop" problem you already explained here.

The internal --math-mbf32_8080 library works fine.
Post Reply