(classic) New target: Colecovision

Discussion about other targets
Post Reply
User avatar
dom
Well known member
Posts: 2091
Joined: Sun Jul 15, 2007 10:01 pm

(classic) New target: Colecovision

Post by dom »

For some reason we've never added support for the Colecovision. I'm not sure why since it's a pretty off-the-shelf sort of hardware:

* CPU: Z80 @ 3.579 Mhz
* VDP: TMS9918, 16k VRAM
* PSG: SN76489
* RAM: 1k
* ROM: 8k

It's now been added, input support is via joystick() which also supports the Colecovision keypads - see https://github.com/z88dk/z88dk/wiki/Pla ... lecovision for details.

The MSX library is available which should allow for a fair bit of portability.
stefano
Well known member
Posts: 2150
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

there was an existing sdk, iirc it was based on Hi-Tech C, the port was probably more complex than simply writing all from scratch, and was never completed. good achievement !
User avatar
dom
Well known member
Posts: 2091
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

Yeah, there's a couple of Hitech C ones, Philipp's sdcc one and now Rafael's MSX one that's in z88dk

I think it makes sense for the all the VDP targets to have the same API - why write for one platform when you can get 10 at the same time?

The next machine I'm currently working on is proving tricky - I can't find any 3rd party software for it, nor much in the way of documentation. I think only about 1000 of them were made so there's not even a wikipedia entry. On the other hand, I think I figured out how to load and execute code should I figure out the file format.

I think RobertK will love it if I can get it to work...
User avatar
RobertK
Well known member
Posts: 347
Joined: Mon Feb 26, 2018 12:58 pm

Post by RobertK »

Now that Mitsubishi machine is too exotic even for me! ;)

Just kidding - great job, keep the new targets coming!

BTW, among the still unsupported targets the Alphatronic PC would be first on my wish list...
User avatar
dom
Well known member
Posts: 2091
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

But there's a manual online for the Alphatronic! That just makes it too easy.

It doesn't look too tricky to actually add support for:

- a character mapped display tucked away at the top of memory (so generic_console will work)
- Mame has the keyboard mappings defined (so inkey() is easy)
- basck does a good job of extracting information from the Microsoft BASIC

The main difficulty would probably be generating a file in a format that can be loaded by an emulator.

I've raised https://github.com/z88dk/z88dk/issues/830 to track this. Not sure when I'll get time to take a look at it though.
stefano
Well known member
Posts: 2150
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

the one I'd like to see is the spc1000, I disassembled the rom and used basck to comment it, it is now in our github docs collection. there is an sdcc port online and few paged in korean which I can provide translated
User avatar
dom
Well known member
Posts: 2091
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

I'm going round in circles trying to find downloadable links to an emulator etc - can you share them?
stefano
Well known member
Posts: 2150
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

ok :)
User avatar
RobertK
Well known member
Posts: 347
Joined: Mon Feb 26, 2018 12:58 pm

Post by RobertK »

Back to the Colecovision target...
RobertK wrote:BTW, I have already tried c_plot() and c_point() on the Colecovision and it works great, thank you.
Having said that, I found out that c_plot() no longer works correctly on that target: the plotted points only appear in the top left area (56 x 48) of the screen.

It was definitively working in one of the earlier nightly builds (I had the demo mode of my game already running).

It seems to affect only the Colecovision target, on the Multi8 and Aquarius there is no such problem.

Here is a c_plot() test quickly added to my plot test program.

Code: Select all

/* plot(), Unplot() and Point() Test by RobertK, 2018-07-07

   Compile command for the following targets:
  
   === ZX81 (64?48) === (ok)
   zcc +zx81 -startup=2 -Cz--disable-autorun -o plottest_ZX81 -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.

   === 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

   === 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)
   zcc +vg5k -create-app -clib=graphics -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.
   Issues:
   - Pixels are not all the same size (probably a system feature that we will have to live with)
   - 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) ===
   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
   Issues:
   - clearing the screen does not work
   
   === 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)
   
   === ABC80 (78?72) === (still to be tested)
   zcc +abc80 -lm -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."
   .BAC or .BAS file can be quickloaded and listed in M.A.M.E., but cannot be run
   
   === Nascom (96?48) === (still to be tested)
   zcc +nascom -lm -o plottest_nascom -create-app plottest.c
   (.nas file can be successfully loaded in M.A.M.E. in 
   both Nascom 1 and Nascom 2, but what to do next?)
      
*/

#include <stdio.h>                // required for printf()
#include <graphics.h>        // contains plot() and point() functions

void main()
{ 
  int x,y;
  int xMax, yMax;
  // determine the screen dimensions for this system
  // coordinates go from 0 to this max value
  xMax=getmaxx();
  yMax=getmaxy();
  
  printf("%c",12); // clear the screen  
  printf("\n\n\n\n\n*** plot test (%d x %d) ***\n\n",xMax+1,yMax+1);

  #if defined(__PV1000__) || defined(__COLECO__)
        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__) 
        clg();  // activate graphics mode
  #elif defined(__VZ200__) || defined(__VG5000__) || defined(__P2000__) || defined(__SPC1000__) 
        printf("%c",12);   // 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
  
  plot(1,1);
  plot(3,3);
  plot(40,4);
  plot(5,5);
  unplot(5,5);
  plot(7,7);
    
  #if defined(__PV1000__) || defined(__COLECO__)
        printf("point-checking...\n\n");
        msleep(3000);
  #else
        printf("press any key to point-check\n\n");
        fgetc_cons();        // wait for keypress
  #endif
  
  printf("point(3,3)  (plotted) is %d\n",point(3,3)); // should be 1
  printf("point(40,4) (plotted) is %d\n",point(40,4)); // should be 1
  printf("point(5,5) (unplotted) is %d\n",point(5,5)); // should be 0
  printf("point(10,10)  (blank) is %d\n",point(10,10)); // should be 0

  // check if the screen dimensions for this platform have been defined above
  if (xMax>0 && yMax>0)
  { 
          #if defined(__PV1000__) || defined(__COLECO__)
                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(__PV1000__) || defined(__COLECO__)
        printf("\nclearing screen...\n");
        msleep(3000);
  #else
        printf("\npress any key to clear screen\n");
        fgetc_cons();        // wait for keypress
  #endif

  printf("%c",12); // 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(__PV1000__) || defined(__COLECO__)
        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__) 
        clg();  // activate graphics mode
  #elif defined(__VZ200__) || defined(__VG5000__) || defined(__P2000__) || defined(__SPC1000__) 
        printf("%c",12);   // 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);
    
  #if defined(__PV1000__) || defined(__COLECO__)
        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
  
  printf("c_point(3,3)  (plotted) is %d\n",c_point(3,3)); // should be 1
  printf("c_point(18,4) (plotted) is %d\n",c_point(18,4)); // should be 1
  printf("c_point(5,5) (unplotted) is %d\n",c_point(5,5)); // should be 0
  printf("c_point(10,10)  (blank) is %d\n",c_point(10,10)); // should be 0

  // check if the screen dimensions for this platform have been defined above
  if (xMax>0 && yMax>0)
  { 
          #if defined(__PV1000__) || defined(__COLECO__)
                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);
          }
  }
  
  #if defined(__PV1000__) || defined(__COLECO__)
        printf("\nclearing screen...\n");
        msleep(3000);
  #else
        printf("\npress any key to clear screen\n");
        fgetc_cons();        // wait for keypress
  #endif

  printf("%c",12); // clear the screen 
    
        
  printf("done.\n");
  #if defined(__PV1000__) || defined(__COLECO__)
        msleep(3000);
  #else
        fgetc_cons();        // wait for keypress
  #endif
}
User avatar
dom
Well known member
Posts: 2091
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

Thanks for the expanded snippet - I'll replace my derived test apps with that version.

I'm sorry, I can't reproduce this one with the lastest code and rebuild, the border draws correctly. It might be worth trying with tomorrows build in case there was a recent bad one?
User avatar
RobertK
Well known member
Posts: 347
Joined: Mon Feb 26, 2018 12:58 pm

Post by RobertK »

The problem is still there in the current nightly. With nightly 2018-07-04 the result was still correct, here is a preview of my game running on the ColecoVision:

Image

With nightly 2018-07-06 or 2018-07-09 it looks like this:

Image
Post Reply