(classic) New target: Bandai Supervision 8000

Post Reply
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

(classic) New target: Bandai Supervision 8000

Post by dom »

Time for a new target! This one is the Bandai Supervision 8000 from 1979. Hardware isn't too bad for that age:

- Z80 @3.57 Mhz
- MC6847 w/ 3kb VRAM
- 1kb Memory
- 2 Joysticks
- AY-3-8910

Which probably contributed to the high cost on release. It looks like only about 7 games were released for it.

The limitations factor (besides VRAM) is that cartridge size is limited to 4kb by Mame so memory is very tight. I've got some ideas to reduce binary size to fit a bit more in.

More details on the wiki: https://github.com/z88dk/z88dk/wiki/Pla ... ision-8000
User avatar
RobertK
Well known member
Posts: 347
Joined: Mon Feb 26, 2018 12:58 pm

Post by RobertK »

I tried to compile my Screen Mode Test for the SV8000 like this...

zcc +sv8000 -create-app -o smt_sv8000 smt.c

...but I get this compiler error:

Error: cannot read file 'sv8000_clib.lib'

The result is the same with the nightly from 27 February and the current nightly.

I am looking forward to try this new target, although we can't do much with it due to MAME's current 4K limit.
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

Sorry, it looks like I forgot to enable the library build. It should be fixed in the 20190302 build.

I'm not sure what the/if there is a process for getting the 4k limit lifted in Mame. I'm guessing we'd need someone with the real hardware to test if larger cartridges work.
User avatar
RobertK
Well known member
Posts: 347
Joined: Mon Feb 26, 2018 12:58 pm

Post by RobertK »

Now it works, thanks. Below are my updated Screen Mode Test and Plot Test programs.

I had to leave out the c_plot() part to make the plot test fit into 4K. Disabling text mode using -pragma-define:CLIB_DISABLE_MODE0=1 helped a little, but the program size was still a little over the limit.
I took the chance to modifiy the point() part of my plot test so that the scrolling screen won't give wrong results anymore.

P.S. So the bottom line cannot be used in graphics mode? The games here seem to be using the entire screen.

Code: Select all

/*
        smt.c - Screen Mode Test
        Test program for screen mode switching using console_ioctl()
        Author: RobertK, 2019-03-03

        Compile with:
        zcc +gal -subtype=galaxyp -create-app -pragma-redirect:fputc_cons=fputc_cons_generic -pragma-redirect:CRT_FONT=_font_8x8_bbc_system -o smtgalplus smt.c -D__GALPLUSHIRES__
        zcc +laser500 -pragma-redirect:CRT_FONT=_font_8x8_bbc_system smt.c -o smt -create-app -Cz--audio -Cz--fast
        zcc +mc1000 -pragma-redirect:fputc_cons=fputc_cons_generic -pragma-redirect:CRT_FONT=_font_8x8_bbc_system -create-app -Cz--audio smt.c -o smt_mc1000
        zcc +multi8 smt.c -create-app -o smt_multi8 -pragma-redirect:CRT_FONT=_font_8x8_bbc_system
        zcc +pc6001 -subtype=rom -pragma-redirect:fputc_cons=fputc_cons_generic -pragma-redirect:CRT_FONT=_font_8x8_bbc_system -create-app -o smt_pc6001Mk2 smt.c
        zcc +spc1000 -create-app -pragma-redirect:CRT_FONT=_font_8x8_bbc_system smt.c -o smt
        zcc +cpm -subtype=tiki100 -ltiki100 -create-app -pragma-redirect:fputc_cons=fputc_cons_generic -o SMT.COM smt.c
        (For the following systems we test text mode switching)
        zcc +cpm -subtype=microbee -pragma-redirect:fputc_cons=fputc_cons_generic -create-app -o smt smt.c -D__BEE__
        zcc +cpm -subtype=einstein -pragma-redirect:fputc_cons=fputc_cons_generic -o SMT.COM smt.c -create-app -D__EINSTEIN__ -D__EINSTEIN80COLUMNS__
        zcc +mz2500 -create-app -o smt smt.c
        zcc +fp1100 -create-app -o smt_FP1100 smt.c
        zcc +pc88 -pragma-redirect:fputc_cons=fputc_cons_generic -create-app -Cz--audio -o smt_pc8001 smt.c
        zcc +cpc -lndos -subtype=dsk -pragma-redirect:fputc_cons=fputc_cons_generic -create-app -o smt smt.c
        zcc +pc88 -pragma-redirect:fputc_cons=fputc_cons_generic -create-app -Cz--audio -o smt_pc8001 smt.c
        zcc +pasopia7 -create-app smt.c -o smt_pasopia7
        zcc +sv8000 -create-app -pragma-redirect:CRT_FONT=_font_8x8_bbc_system -o smt_sv8000 smt.c
        
        Galaksija Plus: all ok
        Laser 500: all ok
        MC-1000: all ok
        Multi-8: all ok
        NEC PC-6001 Mk2: all ok
        Samsung SPC-1000: broken screen after switching back to text mode
        Tiki-100: all ok
        (For the following systems we test text mode switching)
        Casio FP-1100: all ok
        Sharp MZ2500: all ok
        Microbee: all ok
        Tatung Einstein TK02 80-Columns card: all ok, but note that you need to explicitly switch to mode 0 if you 
          want to output text on the 40-columns screen (even if this is DSW-set to be the default screen), otherwise
          the screen will be partly broken
        Alphatronic PC: Mode 1 displays 40 columns instead of 80. Screensize() in mode 1 returns 80x24. Not sure if 
          maybe 80-column support needs to be activated somehow in the emulation settings.
        Amstrad CPC: all ok
        NEC PC-8801: screen switching is ok, but in mode 1 screensize() returns 37x25 instead of 40x25
        Pasopia 7: all ok
        Bandai Supervision 8000: all ok. Note that you need to use uppercase characters in text mode (mode 0).
                
*/

#include <stdio.h>
#include <graphics.h>
#include <sys/ioctl.h>                // required for switching the screen mode

// Define standard text mode number
#if defined(__TIKI100__)
        #define MODE_FIRSTSCREEN 2
#elif defined(__CPC__)
        #define MODE_FIRSTSCREEN 1
#else
        #define MODE_FIRSTSCREEN 0         // Standard value if not defined otherwise
#endif

// Define second screen mode number (usually graphics mode, on some systems other text mode)
#if defined(__LASER500__) || defined(__MULTI8__) || defined(__BEE__) || defined(__CPC__)
        #define MODE_SECONDSCREEN 2
#elif defined (__EINSTEIN__)
        #define MODE_SECONDSCREEN 10
#else
        #define MODE_SECONDSCREEN 1        // Standard value if not defined otherwise
#endif

// Some systems do not support clg()
#if defined(__SPC1000__) || defined(__GAL__) || defined(__LASER500__)
        #define DO_NOT_USE_CLG 1
#endif

// normally we switch between text mode and graphics mode, but on some 
// systems we test switching between different text modes
#if defined(__BEE__) || defined(__EINSTEIN__) || defined(__FP1100__) || defined(__MZ2500__) || defined(__SMC777__) || defined(__ALPHATRO__) || defined(__CPC__) || defined(__PC88__) || defined(__PASOPIA7__)
        #define TEXT_MODE_SWITCHING 1
#endif

// some systems (gaming consoles) don't have a keyboard, so we don't use fgetc_cons() to 
// wait for user input, so we must advance automatically after some waiting time
#if defined(__SV8000__)
        #define NO_KEYBOARD 1
#endif

#if defined(__SV8000__)
        // In text mode, the SV8000 supports only upper-case characters
        #define TEXT_BORDER_CHARACTER "X"
#else
        #define TEXT_BORDER_CHARACTER "x"
#endif


void myCls()        // Clear the screen (generic or VT100 console)
{
        printf("%c",12);
        printf("\x0c");  // the "\x0c" (0x0c character) resets the cursor position to the top left corner
}

        
void ShowTestScreen_Text(int modeNumber)        // Displays the text mode test screen
{
        int XScreenSize,YScreenSize;        // dimensions of the text screen
        int x,y;        

        myCls();        // Clear the screen
        // determine text screen size
        screensize(&XScreenSize, &YScreenSize);
        
        // Draw a screen border using the character "x"
        // we do not print to the bottom line because on some systems this makes the screen scroll
        for (x = 0; x <XScreenSize; ++x)
        {
                gotoxy(x,YScreenSize-2);
                printf(TEXT_BORDER_CHARACTER);
                gotoxy(x,0);
                printf(TEXT_BORDER_CHARACTER);
        }
        for (y = 1; y <YScreenSize-1; ++y)
        {
                gotoxy(0,y);
                printf(TEXT_BORDER_CHARACTER);
                gotoxy(XScreenSize-1,y);
                printf(TEXT_BORDER_CHARACTER);
        }
        
        #if defined(__SV8000__)
                // In text mode, the SV8000 supports only upper-case characters
                gotoxy(2,2);
                printf("TEXT SCREEN TEST (MODE %d)",modeNumber);
                gotoxy(2,4);
                printf("SCREEN SIZE: X=%d, Y=%d\n",XScreenSize,YScreenSize);
                gotoxy(2,6);
                printf("PRESS X TO EXIT, ANY");
                gotoxy(2,7);
                printf("OTHER KEY TO SWITCH");
                gotoxy(2,8);
                printf("SCREEN MODE...");                                
        #else
                gotoxy(2,2);
                printf("text screen test (mode %d)",modeNumber);
                gotoxy(2,4);
                printf("screen size: x=%d, y=%d\n",XScreenSize,YScreenSize);
                gotoxy(2,6);
                printf("press x to exit, any");
                gotoxy(2,7);
                printf("other key to switch");
                gotoxy(2,8);
                printf("screen mode...");                        
        #endif
        
}

#if !defined(TEXT_MODE_SWITCHING)
void ShowTestScreen_Graphics(int modeNumber)        // Displays the graphics mode test screen
{
        int xMax,yMax;        // dimensions of the graphics screen
        int x,y;
        
        myCls();        // Clear the screen
        // determine the graphics screen dimensions
        // coordinates go from 0 to this max value
        xMax=getmaxx();
        yMax=getmaxy();
  
        // Draw a screen border
        for (x = 0; x <=xMax; ++x)
        {
                plot(x,yMax);
                plot(x,0);

                plot(x,yMax-4);
                plot(x,3);
        }
        for (y = 1; y <=yMax; ++y)
        {
                plot(0,y);
                plot(xMax,y);

                plot(3,y);
                plot(xMax-3,y);
        }
        
        gotoxy(2,2);
        printf("graphics screen test (mode %d)",modeNumber);
        gotoxy(2,4);
        printf("screen size: x=%d, y=%d\n",xMax+1,yMax+1);
        gotoxy(2,6);
        printf("press x to exit, any");
        gotoxy(2,7);
        printf("other key to switch");
        gotoxy(2,8);
        printf("to text mode...");
}
#endif

void main()
{        
        int mode; // for screen mode switching
        char c; // for keyboard input
        int exitProgram=0;        
                        
        /* main loop */
        while(exitProgram<1)
        {

                // First screen (standard text mode)
                ShowTestScreen_Text(MODE_FIRSTSCREEN);
                
                #if defined(NO_KEYBOARD)
                        msleep(3000);
                #else          
                        c = fgetc_cons();        // wait for keypress
                #endif
                
                myCls();                        // Clear the screen (done here only for multi screen systems like the Tatung Einstein)
        
                if (c=='x' || c=='X')
                        exitProgram=1;
                else
                {
                        // Second Screen (usually graphics mode)
                        // switch to the other screen mode
                        mode = MODE_SECONDSCREEN;
                        console_ioctl(IOCTL_GENCON_SET_MODE, &mode);
                        #if !(defined(TEXT_MODE_SWITCHING) || defined(DO_NOT_USE_CLG))
                                clg();
                        #endif
                        
                        #if defined(TEXT_MODE_SWITCHING)
                                ShowTestScreen_Text(MODE_SECONDSCREEN);
                        #else
                                ShowTestScreen_Graphics(MODE_SECONDSCREEN);
                        #endif
                                                
                        #if defined(NO_KEYBOARD)
                                msleep(3000);
                        #else          
                                c = fgetc_cons();        // wait for keypress
                        #endif
                
                        if (c=='x' || c=='X') exitProgram=1;                        
                        myCls();                        // Clear the screen (done here only for multi screen systems like the Tatung Einstein)

                        // switch back to standard text mode
                        mode = MODE_FIRSTSCREEN;
                        console_ioctl(IOCTL_GENCON_SET_MODE, &mode);
                }
                
        }
        myCls();        // Clear the screen        
        return;
}

Code: Select all

/* plot(), Unplot() and Point() Test by RobertK, 2019-03-03

   Compile command for the following targets:
  
   === ZX81 (64?48) === (ok)
   zcc +zx81 -startup=2 -o plottest_ZX81 -create-app plottest.c

   === ZX81 WRX (256?192) === (ok)
   zcc +zx81 -subtype=wrx -clib=wrxansi -startup=4 -o plottest_ZX81_wrx -create-app plottest.c
   
   === ZX80 (64?48) === (ok)
   zcc +zx80 -o plottest_ZX80 -create-app plottest.c
   Note: point() function was not working yet for this system 
   with 1.99B (calling it made the program crash), since nightly 
   build 2018-03-22 it works correctly.
 
   === Jupiter Ace (64x48) === (ok)
   zcc +ace -lgfxace -clib=ansi -vn -create-app plottest.c -o pt.bin
   Note: with 1.99B plotted points could not be seen, and the 
   point() function returned inverse values -> fixed since nightly
   build 2018-03-28 (-lgfxace option added by Stefano for 64x48)
   Last remaining issue: clearing the screen does not clear the 
   bottom line. Workaround: compiling with the paramter -clib=ansi for 
   VT100 ANSI mode solves the problem.
   Load the program on the Jupiter Ace by typing:
   0 0 bload pt.bin
   
   === Galaksija (64?48) === (ok)
   zcc +gal -vn -create-app plottest.c -o plottest_galaksija.bin   
   Note: on the Galaksija computer type OLD to load a program from cassette.
   In MAME, you can speed up emualation (and the loading process) by pressing F10,
   press F10 again to return to normal speed. But close all UI windows before, otherwise
   the F10 key won't work.

   === VZ200 / Laser 210 / Laser 110 (128?64) === (ok)
   zcc +vz -lm -pragma-redirect=fputc_cons=putc4x6 -o plottest_vz200.vz plottest.c 
   Note from the z88dk wiki: "The graphics mode is automatically switched on 
   by calling ?clg? or printing CHR$ 12 or calling the vz_mode() function."
   We use clg() in this example.
   Works correctly since nightly build 2018-03-31. Stefano: 
   "The VZ200. Its "operating system" (aka BASIC interpreter) is designed to switch 
   back to text mode as soon as a character is being printed.
   After this nightly build you should have a new function in all the mid and low-rez 
   graphics drivers permitting to output some text in graphics mode.
   You just need to add the following parameter in your zcc command line:"
   -pragma-redirect=fputc_cons=putc4x6

   (64x32, new since 2018-07-18)
   zcc +vz -lm -lgfxvzblock -o plottest_vz200_lgfx.vz plottest.c 
   Issues:
   - background colour of the entire screen needs to be set to black
     for that we use this workaround: we simply fill the screen with 
         black pixels to get a black background.
                for (x = 0; x <= X_RES-1; ++x)
                        for (y = 0; y <= Y_RES-1; ++y)
                                myPlot(x,y,0);
   
   === TRS-80 (128?48) === (ok)
   zcc  +trs80 -lndos -lm -create-app -o plottest_trs80.bin -subtype=disk plottest.c
   Clearing the screen does not work with 1.99B, since nightly build 2018-03-24 
   this works as well. Use the HT1080Z emulator for testing (select "Autostart file" 
   and open the .cmd file)
   
   === Robotron Z1013 (64?64) === (ok)
   zcc +z1013 -lm -create-app plottest.c -o plottest_z1013
   Note: top line (plotted pixel at 1,1) was not visible with 1.99B, 
   since nightly build 2018-03-22 it works correctly.
 
   === Robotron Z9001 (80x48) === (almost ok)
   zcc +z9001 -lm -lgfx9001 -o plottest_z9001 -create-app plottest.c
   or
   zcc +z9001 -lm -lgfx9001 -subtype=kcc -o plottest_z9001 -create-app plottest.c
   Use JKCEMU for testing, there you can run either a .TAP or a .KCC file.
   Note: combining -lgfx9001 and -clib=ansi...
   zcc +z9001 -lm -lgfx9001 -clib=ansi -o plottest_z9001_ansi -create-app plottest.c
   ...works only on monochrome systems (on colour machines, characters cannot be 
   seen and plotted points are partly invisible)
   
   === Philips VG5000 (80?72) === (ok)
   old:
   zcc +vg5k -create-app -clib=graphics -lm plottest.c -o plottest_vg5000
   new since 2018-08:
   zcc +vg5k -create-app -lm plottest.c -o plottest_vg5000   
   Note: In 1.99B plot() function displayed " characters instead of pixels.
   New compile option -clib=graphics added since nightly build 2018-03-31.
   Use the DCVG5K emulator (dcvg5k.free.fr) for testing
   Attach the .k7 cassette file and type CLOAD to load the program
   (note that the VG5000 has a French AZERTY keyboard so on most 
   other keyboard layouts you have to type CLOQD)
   
   === Mattel Aquarius (80?48) === (ok)
   zcc +aquarius -lm -create-app plottest.c -o plottest_aquarius
   Note: Everything works, except for that plotted pixels are not 
   all the same size. In the plot test the second pixel looks ok 
   while the first and third are too flat.
   
   Stefano: "I saw a comment about odd pixels on the Mattel Aquarius. 
   Sadly there is very little we can do for it, the character set is 
   so fancy and unbalanced.  The bottom right pixel in a 2x3 matrix is 
   totally missing while the bottom-right pixel in a 2x2 matrix is 
   repeated twice, this is something I really can't understand because 
   the font was accurately overloaded of any kind of different symbol 
   and a duplicate like this is very odd (chr 26 = chr 224).
   By the way I added a graphics variant [in nightly build 2018-03-29]:
   just use  '-lgfxaq48' to bend your graphics resolution from 64x72 
   to 64x48 [should be 80x48],  they are both compatible with the text mode."
   -> looks good now, the plotted pixels are all the same size now
   
   Use the "Virtual Aquarius" emulator for testing. Loading 
   instructions from the z88dk wiki:
    from within the emulator, load the loader: cload
    press ENTER twice, then play the ?_plottest_aquarius.caq? cassette file (loader)
    at the ?OK? prompt, type RUN <ENTER>
    press ENTER twice, then play the ?plottest_aquarius.caq? cassette file
    wait? then have fun !
   
   === Sharp MZ-700 (80?50) === (ok)
   zcc +mz -lm -create-app plottest.c -o plottest_sharpmz
   Note: clearing the screen does not work in 1.99B, fixed since 
   nightly build 2018-03-29
   In M.A.M.E. attach The .mzt cassette file, then press L and Enter 
   to initiate loading, then use M.A.M.E.'s tape control to start the tape.

   === EG2000 (160?100) === (probably ok)
   zcc  +trs80 -lndos -lm -create-app -subtype=eg2000disk -pragma-redirect=fputc_cons=putc4x6 -o plottest_eg2000.bin plottest.c   
   Note: plotted points could not be seen with 1.99B. New compile option
   -pragma-redirect=fputc_cons=putc4x6 added in nightly build 2018-04-05.
   Use the Genieous emulator (gaia.atilia.eu) for testing. See the TRS-80 
   loading instructions above (use "Autostart file" after entering SYSTEM).
   
   === Philips P2000 (78?72) === (ok)
   zcc +p2000 -pragma-redirect=fputc_cons=putc4x6 -o plottest_p2000g -create-app -lm plottest.c
   M.A.M.E. (tested with 0.170 and 0.196) does not allow to load software on that system. 
   Tested with the M2000 emulator for DOS (in DOSBox), use the -tape <filename> option to 
   attach the .cas file, load it with "cload" and then type "run".
   Stefano: "text and graphics cannot be mixed on the P2000. As on the vg5000 it uses the same 
   videochip designed for the "TELETEXT" TV service (known in Italy as TELEVIDEO), later adopted 
   also by the French "MINITEL"  (known in Italy as "VIDEOTEL", or "PRESTEL" in the UK).
   It works on a text row base, where a first control character determines the output mode for 
   the whole text row (e.g. TEXT versus GRAPHICS).   The Graphics mode is just a different font 
   configured for the well known blocky low resolution.
   So..  you can still try to apply some target specific trick to force text or graphics 
   content on selected rows (I could provide a clg variant acting on a single row specified), 
   or you try to fit the new 4x6 font mode."
   -> 4x6 parameter added to the compile command above.
   Everything works correctly since nightly build 2018-04-20.
   
   === Casio PV-1000 (56x48) === (ok)
   zcc +pv1000 -o plottest_pv1000 -create-app plottest.c

   === Exidy Sorcerer (128x60) === (ok)
   zcc +srr -lm -lndos -o plottest_sorcerer -create-app plottest.c -Cz--audio
   Note: in MAME, insert the WAV cassette file, type LO to start loading, and then GO 0100 to run the program.
   - Pixels are not all the same size (probably a system feature that we will have to live with)
   Issues:
   - Bottom line of the border (at y coordinate 89) cannot be seen
   - Plotting over a character results in the letter "z" instead of the pixel being displayed
   -> all fixed since nightly build 2018-06-27 (graphics screen resolution was 128x90 until then)
   
   === Triumph-Adler Alphatronic PC (80x72) === (ok)
   zcc +alphatro plottest.c -create-app -o plottest_alphatronic
   Use MAME for testing and run the created .rom file
   
   === Samsung SPC-1000 (64x32) === (ok)
   zcc +spc1000 plottest.c -create-app -o plottest_scp1000
   Select "Basic" (not CP/M) on startup
   Type "load" to load the program
  
   === Mitsubishi Multi8 (640x200) === (ok)
   zcc +multi8 plottest.c -create-app -o plottest_multi8 -pragma-redirect:CRT_FONT=_font_8x8_bbc_system
   Note: use Takeda Emulator http://takeda-toshiya.my.coocan.jp/multi8/ for testing
   (extract the three files from the MAME rom set multi8.zip into the emulator directory)
   Use Menu "CMT" to insert the .cas file and then type...
    MON
    R
    GC000
   ...to load and run the program
   
   === Colecovision (256x192) === (ok)
   zcc +coleco plottest.c -create-app -o plottest_coleco
   Note: use c_plot() and c_point() which generate pseudo-low-res graphics
   by plotting 4x4 pixel blocks (giving a 64x48 resolution on this system)
   
    === Nascom (96?48) === (ok)
   zcc +nascom -clib=ansi -lm -o plottest_nascom -create-app plottest.c
   Use VNascom emulator in DOSBox for testing
   Rename plottest_nascom.nas to pt.nas and copy it to the emulator directory
   Then run the emulator like this:
   vnascom ROM=nassys1.nas RAM=pt.nas KBD=E1000
   Issue when compiling without the -clib=ansi parameter: pixels at top row (y=0) are not visible. With ANSI everything is ok
   
   === NEC PC6001 Mark II (64x48) ===
   zcc +pc6001 -clib=ansi -subtype=rom -create-app -lm plottest.c -o plottest_pc6001
   Issue: Colours need to be fixed (WHITE results in orange colour)
   
   === Sega SC3000 (256x192) === (ok)
   zcc +sc3000 -subtype=rom -o plottest_sc3000.sc plottest.c 
   Note: in the Takeda emulator, attach the created .rom cart file, not the .sc file! 

   === Robotron KC85/2..KC85/5 and HC900 (320x256) === (ok)
   zcc +kc -lndos -pragma-redirect:fputc_cons=fputc_cons_generic -lm -create-app plottest.c -o plottest_kc85
   HC900 Issue: program occasionally crashes in the jkcemu emulator. Problem seems to be connected 
   to the "Einf?gen von Text direkt in den Tastaturpuffer" option. Could be an emulator problem.
   
   === MSX (256x192) === (ok)
   zcc +msx -create-app -lndos plottest.c -o plottest_msx -pragma-need=ansiterminal -pragma-define:ansifont=7359 -pragma-define:ansifont_is_packed=0 -pragma-define:ansicolumns=32
   Note: load the program from cassette with
   bload "cas:",r
   
   === VTech Laser 350/500/700 (80x48) == (ok)
   zcc +laser500 plottest.c -o plottest_laser500 -create-app -Cz--audio
   Will create a file that will load on real hardware.
   zcc +laser500 plottest.c -o plottest_laser500_MAME -create-app -Cz--audio -Cz--fast 
   Will create a file that will load on the Mame emulator
   Type CLOAD to load the program from cassette.

   === ABC80 (78?72) ===
   zcc +abc80 -o plottest_abc80 -create-app plottest.c
   Note from z88dk Wiki: "The pseudo graphics mode is supported. You first 
   need to issue a clg () command to set up the graphics page."
   Use ABCWin (http://www.devili.iki.fi/pub/emulators/Luxor/) for testing.
   Configure the file path (e.g. "C:\Misc\Emulator\ABCWin\Files\"), make sure that 
   there is a \ at the end. Put the .bac file into the files folder and rename it 
   to e.g. "PLOT.BAC". Now type
   RUN"PLOT"
   and wait until the program gets loaded (it takes a few seconds), it starts automatically. 
   Or use ABC80SIM (Windows version by Stefano B.), which can also run larger programs.
   Compile it like this...
   zcc +abc80 -subtype=hex -create-app -zorg=49200 -o plottest_abc80 plottest.c
   ...and copy the plottest_abc80.ihx file into the emulator directory.
   Now run the emulator like this...
   ABC80.EXE plottest_abc80.ihx
   and type A=CALL(49200) to run the program.   
   Issue: x-coordinate 0 is at the second text column (that would be x=3)

   === CPC (640x200) ===
   zcc +cpc -lndos -lm -subtype=wav -create-app -o plottest_cpc plottest.c
   Note: use a 6128 or 664 for testing, as the 464 does not understand 
   the |... commands required for loading.
   Loading instructions according to the Github wiki:
     | tape
     | ----
     memory &11ff
     load "",&1200
     call &1200
   Issues:
   - What is meant by the second line "| ----"? If typed in like that, the command is not understood.
   - Program shows odd behaviour: text appears partially, no plotted points appear, program flow is 
     not as it should be. Different behaviour on every attempt to run the program, sometimes it immediately 
     resets the machine.  Not sure if clg() is necessary, calling it makes the program crash.

   === Tatung Einstein (256x192) === (almost ok)
   zcc  +cpm -lm -subtype=einstein -pragma-redirect:fputc_cons=fputc_cons_generic -o PT.COM plottest.c -create-app
   Use MAME for testing and run it like this with two disks inserted:
   mame einstein -flop1 dos80.dsk -flop2 PT.dsk
   Wait until the system has booted from the first disk. Then type
       1:
       app
   Minor Issue:
   - When you return to CP/M after the program terminates, the system displays broken characters.
   
   === Osborne 1 (104x48) ===  (ok)
   zcc +cpm -subtype=osborne1 -create-app -o plottest_osborne1 plottest.c
   Note: use printf("\032"); for clearing the screen. Workaround for hiding the cursor: position it 
   somewhere on the screen where there is already a plotted block, the cursor will be green on green 
   and therefore invisible.
   Use MAME for testing and run it like this with two disks inserted:
   mame osborne1 -flop1 OS1S1YSD.IMD -flop2 plottest_osborne1.dsk
   Press RETURN to start booting, then wait until the system has booted from 
   the first disk, then press ESCAPE to get to the command prompt.
   Then type
       b:
       app
   
   === Otrona Attach? (320x240) === (ok)   
   zcc +cpm -subtype=attache -lgfxattache -create-app -o plottest_attache plottest.c -D__ATTACHE__
   Issue:
   - after plotting the first points, the screen is cleared

   === Kaypro 83 (80x48) === (ok)
   zcc +cpm -subtype=kaypro83 -o plottest_kaypro83 -create-app plottest.c
   Note: implemented using characters like "," so usability is limited 
        Kaypro10 (84) * ???
        Kaypro 4/84
        Kaypro 2 84
        Kaypro 2X
        Kaypro II+88
        Kaypro 4/84+88

   === Kaypro 84 (160x100) ===
   zcc +cpm -subtype=kaypro84 -o plottest_kaypro84 -create-app plottest.c
        Kaypro II
        KayproIV
        Kaypro10 (83) * ???
   Tested on Kaypro 4 - 4/83 and kpivdsdd.td0 CP/M boot disk from http://www.retroarchive.org/maslin/disks/kpro/
   Plotting shows only text characters.        
   Kaypro10 (83) can be booted from kaypro_k10hload.td0 (is a reload disk, press Ctrl-C 
   to get to the CP/M prompt), but the z88dk-created .DSK file cannot be read).
   
   === Camputers Lynx (64x64) === (ok)
   zcc +lynx -create-app plottest.c -o plottest_lynx
   Type LOAD"" to load a program from tape.
   Note: in MAME, the computer crashes at the end of loading.
   So use the Jynx emulator https://jynxemulator.wordpress.com/ for testing (Menu "File" -> "Run TAP file")

   === Memotech MTX 512 (256x192) === (ok)
   For the MTX 512:
   zcc +mtx -create-app -startup=2 plottest.c
   For the MTX 500:
   zcc +mtx -create-app plottest.c
   Rename the resulting file "a" to plottest_MemotechMTX512.mtx or plottest_MemotechMTX500.mtx
   Use MEMU for testing: http://www.nyangau.org/memu/memu.htm
   Start the emulator like this...
   memu -v plottest_MemotechMTX512.mtx
   ...then enter LOAD"" to load the program and RUN to run it.
   Issues:
   - When specifying an output file name using the -o option, you get the following message: "Input and output file names must be different"
     Workaround: use the extension .o for the output file name. Finally rename the other extension-less output file to .mtx, this file can be loaded by the MEMU emulator.
 
   === CCE MC1000 (256x192) === (ok)
   zcc +mc1000 -pragma-redirect:fputc_cons=fputc_cons_generic -pragma-redirect:CRT_FONT=_font_8x8_bbc_system -create-app -Cz--audio plottest.c -o plottest_mc1000
   The .wav file can be loaded in MAME, type LOAD to load the program from tape
   Issue: when the program terminates, it switches back to text mode using console_ioctl(IOCTL_GENCON_SET_MODE, 0);
   This basically works, but the system misbehaves after that.
   
   === Microbee (160x48 or 80x50) === (ok)
   zcc +cpm -subtype=microbee -pragma-redirect:fputc_cons=fputc_cons_generic -create-app -o plottest_microbee plottest.c -D__BEE__
   You can use either MAME... for testing:
   mame mbee128 -flop1 Microbee_games_demo_ds80.dsk -flop2 plottest_microbee.dsk
   ...or Ubee512...
   ubee512 --image_b=plottest_microbee.dsk
   ...for testing.
   
   === TIKI-100 (1024x256, 512x256 or 256x256) === (ok)
   zcc +cpm -subtype=tiki100 -ltiki100 -create-app -pragma-redirect:fputc_cons=fputc_cons_generic -o PT.COM plottest.c
   Use MAME for testing:
   mame kontiki -flop1 tiki100_kpm117.dsk -flop2 PT.dsk

   === Dick Smith Super-80 (64x48 for the e/m models, 160x50 for the r/v models) === (ok)
   zcc +super80 -create-app -o plottest_super80em plottest.c
   zcc +super80 -create-app -clib=vduem -o plottest_super80rv plottest.c
   Use MAME for testing:
   mame super80e -quickload plottest_super80em.ql
   mame super80m -quickload plottest_super80em.ql
   mame super80r -quickload plottest_super80rv.ql
   mame super80v -quickload plottest_super80rv.ql
   
   === Sony SMC-777 (160x50 or 80x50) === (ok)
   zcc +cpm -subtype=smc777 -pragma-redirect:fputc_cons=fputc_cons_generic -o PT.COM plottest.c -create-app -D__SMC777__
   
   === Z80 TV Game (168x208) === (ok)
   zcc +z80tvgame plottest.c -create-app -o plottest_z80tvg
   
   === Bandai Supervision 8000 (256x92) === (ok)
   zcc +sv8000 -create-app -pragma-redirect:CRT_FONT=_font_8x8_bbc_system -pragma-define:CLIB_DISABLE_MODE0=1 -o plottest_sv8000 plottest.c 
   Note: We disable text mode using -pragma-define:CLIB_DISABLE_MODE0=1 to stay within the 4K limits. However, the resulting
   cart would still be too large so we have to leave out the c_plot part
   "Large cartridges can be created using -subtype=32k however loading them isn't support by the Mame emulator"
   
*/

#include <stdio.h>                // required for printf()

#if defined(__TIKI100__)
        #include <tiki100.h>
#endif

#include <graphics.h>        // contains plot() and point() functions

#if defined(__PC6001__)        || defined(__MC1000__) || defined(__BEE__) || defined(__TIKI100__) || defined(__GALPLUSHIRES__) || defined(__KAYPRO83__) || defined(__SV8000__) // || defined(__KAYPRO84__) // || defined(__PC88__) // || defined(__LASER500__) // NEC PC-6001 or CCE MC-1000
        #include <sys/ioctl.h>
#endif

#if defined(__MSX__)
        #pragma output nofileio
#endif

#if defined(__PC6001__) // || defined(__TIKI100__) // NEC PC-6001
        // we need to include conio.h only for the colour constants
        #include <conio.h>
        #define USE_ANSI 1
#endif

// some systems (gaming consoles) don't have a keyboard, so we don't use fgetc_cons() to 
// wait for user input, so we must advance automatically after some waiting time
#if defined(__PV1000__) || defined(__COLECO__) || defined(__PACMAN__) || defined(__Z80TVGAME__) || defined(__SV8000__)
        #define NO_KEYBOARD 1
#endif

void myCls()
{
#if defined(__OSBORNE1__) || defined(__KAYPRO83__) || defined(__KAYPRO84__) || defined(__ATTACHE__)
        printf("\032");
#else
        printf("%c",12);
        // printf("\x0c");  // the "\x0c" (0x0c character) resets the cursor position to the top left corner
#endif
}

void main()
{ 
  int x,y;
  int xMax, yMax;
  int mode;
  int point1, point2, point3, point4;
  
  #if defined(__PC6001__)        // NEC PC-6001
        mode=1;
        console_ioctl(IOCTL_GENCON_SET_MODE, &mode);
        textcolor(WHITE);
        textbackground(BLACK);        
//  #elif defined(__BEE__)        // Microbee
        // switch to 80x50 mode.
        /*
        mode=2;
        console_ioctl(IOCTL_GENCON_SET_MODE, &mode);
        clg();
        */
/*
  #elif defined(__LASER500__)        // Laser 500
        mode=2;
        console_ioctl(IOCTL_GENCON_SET_MODE, &mode);
*/
/*
  #elif defined(__PC88__)
        mode=2;
        console_ioctl(IOCTL_GENCON_SET_MODE, &mode);
        clg();  // activate graphics mode
*/
  #elif defined(__TIKI100__)
        /*
        Set graphics mode 
                0 = Freeze dot-clock (one-pixel display)
                1 = BW mode (1024x256x2)
                2 = 512x256x4
                3 = 256x256x16
        */
        clg();                  // initiate graphicsets
        // gr_defmod(3); // set to 256x256 (seems to be default now)
        // gr_defmod(2); // set to 512x256
        // gr_defmod(1); // set to 1024x256
        mode=2; // set to 512x256
        console_ioctl(IOCTL_GENCON_SET_MODE, &mode);
        
        
        // char palette[]={0,0x57,0xFA,0xFF};
        char palette[]={0,0xD2,0x7F,0xFF};
        gr_setpalette(4,palette);

        // textcolor(WHITE);
        // textcolor(5);
        // textbackground(BLACK);
  #elif defined(__GALPLUSHIRES__)
        mode=1;
        console_ioctl(IOCTL_GENCON_SET_MODE, &mode);        // switch to hires mode
  #elif defined(__KAYPRO83__) || defined(__SV8000__) // || defined(__KAYPRO84__)
        mode=1;
        console_ioctl(IOCTL_GENCON_SET_MODE, &mode);        // switch to hires mode
        clg();
  #endif

  // determine the screen dimensions for this system
  // coordinates go from 0 to this max value
  xMax=getmaxx();
  yMax=getmaxy();
  
  myCls(); // clear the screen  
  printf("\n\n\n\n\n*** plot test (%d x %d) ***\n\n",xMax+1,yMax+1);
  
  #if defined(NO_KEYBOARD)
        printf("plotting and unplotting...\n\n");
        msleep(3000);
  #else
        printf("press any key to plot and unplot\n\n");
        fgetc_cons();        // wait for keypress
  #endif
  
  #if defined(__ABC80__) || defined(__EG2000__) || defined(__SORCERER__) || defined(__VZ200__) || defined(__VG5000__) || defined(__P2000__) || defined(__MULTI8__) || defined(__SC3000__) || defined(__MSX__) || defined (__MTX__) || defined(__PACMAN__) || defined(__PC88__) || defined(__ATTACHE__) || defined(__KAYPRO84__) // || defined(__CPC__)
        clg();  // activate graphics mode
  #elif defined(__VG5000__) || defined(__P2000__) // || defined(__SPC1000__)  // || defined(__VZ200__) 
        clg();  // activate graphics mode
        myCls();   // we clear the screen...
        printf("\n\n",12); // ...and move a little down because otherwise the huge 4x6 letters wouldn't fit on the screen
  #elif defined(__MC1000__)        // // CCE MC-1000
        mode=1;
        console_ioctl(IOCTL_GENCON_SET_MODE, &mode);        // switch to hires mode
        clg();
  #endif
  
  #if defined(__SPC1000__)
        printf("\n\n",12);   // move down two more lines
  #endif
  
  plot(1,1);
  plot(3,3);
  plot(40,4);
  plot(5,5);
  unplot(5,5);
  plot(7,7);

  /*
  for ( y = 0; y < 16; y++ ) {
                textcolor(y);
                plot(10,y*3);
  }
  */

  #if !defined(__KAYPRO84__)        // Dom 2019-07-02: "I've left vpeek unimplemented since the emulators aren't working properly"
  
          #if defined(NO_KEYBOARD)
                printf("point-checking...\n\n");
                msleep(3000);
          #else
                printf("press any key to point-check\n\n");
                fgetc_cons();        // wait for keypress
          #endif
         
          point1=point(3,3);
          point2=point(40,4);
          point3=point(5,5);
          point4=point(10,10);
         
          printf("point(3,3)  (plotted) is %d\n",point1); // should be 1
          printf("point(40,4) (plotted) is %d\n",point2); // should be 1
          printf("point(5,5) (unplotted) is %d\n",point3); // should be 0
          printf("point(10,10)  (blank) is %d\n",point4); // should be 0

  #endif

  // check if the screen dimensions for this platform have been defined above
  if (xMax>0 && yMax>0)
  { 
          #if defined(NO_KEYBOARD)
                printf("\ndrawing border...\n");
                msleep(3000);
          #else
                printf("\npress any key to draw border\n");
                fgetc_cons();        // wait for keypress
          #endif
          for (x = 0; x <=xMax; ++x)
          {
                plot(x,yMax);
                plot(x,0);
          }
          for (y = 1; y <=yMax; ++y)
          {
                plot(0,y);
                plot(xMax,y);
          }
  }
  
  #if defined(NO_KEYBOARD)
        msleep(3000);
        printf("\nclearing screen...\n");
        msleep(3000);
  #else
        printf("\npress any key to clear screen\n");
        fgetc_cons();        // wait for keypress
  #endif
 
 
#if !defined(__SV8000__)         // Bandai SV-8000: do not include this part to stay within the 4K limits

  myCls(); // clear the screen 
           
  xMax=xMax/4;
  yMax=yMax/4;  
  printf("\n\n\n\n\n*** c_plot test (%d x %d) ***\n\n",xMax+1,yMax+1);

  #if defined(NO_KEYBOARD)
        printf("c_plotting and c_unplotting...\n\n");
        msleep(3000);
  #else
        printf("press any key to c_plot and c_unplot\n\n");
        fgetc_cons();        // wait for keypress
  #endif
  
  #if defined(__ABC80__) || defined(__EG2000__) || defined(__SORCERER__) || defined(__VZ200__) || defined(__VG5000__) || defined(__P2000__) || defined(__MULTI8__) || defined(__MC1000__) || defined(__PC88__)
        clg();  // activate graphics mode
  #elif defined(__P2000__) || defined(__SPC1000__) // defined(__VZ200__) 
        myCls();   // we clear the screen...
        printf("\n\n",12); // ...and move a little down because otherwise the huge 4x6 letters wouldn't fit on the screen
  #endif
  
  #if defined(__SPC1000__)
        printf("\n\n",12);   // move down two more lines
  #endif
  
  c_plot(1,1);
  c_plot(3,3);
  c_plot(18,4);
  c_plot(5,5);
  c_unplot(5,5);
  c_plot(7,7);

  /*
  for ( y = 0; y < 16; y++ ) {
                textcolor(y);
                c_plot(10,y*3);
  }
  */

  #if !defined(__KAYPRO84__)        // Dom 2019-07-02: "I've left vpeek unimplemented since the emulators aren't working properly"
  
          #if defined(NO_KEYBOARD)
                printf("c_point-checking...\n\n");
                msleep(3000);
          #else
                printf("press any key to c_point-check\n\n");
                fgetc_cons();        // wait for keypress
          #endif

          point1=c_point(3,3);
          point2=c_point(18,4);
          point3=c_point(5,5);
          point4=c_point(10,7);

          printf("c_point(3,3)  (plotted) is %d\n",point1); // should be 1
          printf("c_point(18,4) (plotted) is %d\n",point2); // should be 1
          printf("c_point(5,5) (unplotted) is %d\n",point3); // should be 0
          printf("c_point(10,7)  (blank) is %d\n",point4); // should be 0

  #endif
  
  // check if the screen dimensions for this platform have been defined above
  if (xMax>0 && yMax>0)
  { 
          #if defined(NO_KEYBOARD)
                printf("\ndrawing border...\n");
                msleep(3000);
          #else
                printf("\npress any key to draw border\n");
                fgetc_cons();        // wait for keypress
          #endif
          for (x = 0; x <=xMax; ++x)
          {
                c_plot(x,yMax);
                c_plot(x,0);
          }
          for (y = 1; y <=yMax; ++y)
          {
                c_plot(0,y);
                c_plot(xMax,y);
          }
  }

  // Attempted workaround to avoid the broken characters on the Tatung Einstein after the program terminates (does not help unfortunately)
  #if defined(__EINSTEIN__)        // Tatung Einstein
        printf("\npress any key to set mode 0\n");
        fgetc_cons();        // wait for keypress
        msx_set_mode(0);
        printf("\nMode 0 has been set.\n");
  #endif  
  
  #if defined(NO_KEYBOARD)
        printf("\nclearing screen...\n");
        msleep(3000);
  #else
        printf("\npress any key to clear screen\n");
        fgetc_cons();        // wait for keypress
  #endif

#endif          // Bandai SV-8000: do not include this part to stay within the 4K limits

  myCls(); // clear the screen 
        
  printf("done.\n");
  #if defined(NO_KEYBOARD)
        msleep(3000);
  #else
        fgetc_cons();        // wait for keypress
  #endif
  
  #if defined(__MC1000__) || defined(__GALPLUSHIRES__) || defined(__KAYPRO83__) // || defined(__SV8000__) // || defined(__KAYPRO84__)
        mode=0;
        console_ioctl(IOCTL_GENCON_SET_MODE, &mode);        // return to text mode :
        myCls();
  #elif defined(__TIKI100__)
        mode=3; // set to 256x256
        console_ioctl(IOCTL_GENCON_SET_MODE, &mode);
  #endif
  
}
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

It looks like I failed to divide 192 by 2 correctly. I've now set maxy to the correct answer and that bottom row is now used!

I managed to get something fun running on it last night, with a gencon port of dstar, there's a screenshot on the wiki: https://github.com/z88dk/z88dk/wiki/Pla ... ision-8000

I've asked on a thread where there were some owners to see if we can test on the real hardware/cartridges more than 4k are supported. I'm not holding out much hope of an answer but we'll wait and see.
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

For some reason I'm quite enjoying this 4k challenge.

I've added examples/console/samegame.c which will compile down to a 4k ROM. It should also work on other targets which support UDGs (I've tried it on the SMC777)

A few tips for saving space:

#pragma define CRT_ENABLE_STDIO=0
#pragma define CLIB_EXIT_STACK_SIZE=0

If possible avoid printf() - use cputs() for printing strings, embedded constants can do positioning and control codes.
Post Reply