(classic) New target: Casio PV-1000

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

(classic) New target: Casio PV-1000

Post by dom »

I've just merged support for the Casio PV-1000.

This was a very short-lived (on the market for just a few months) console with the following hardware:

* Z80 @ 3.579Mhz
* 3k RAM, 0k ROM
* VDP: D65010G031
* Audio: On ports 0xf8, 0xf9, 0xfa - D65010G031
* Joysticks: 2x on 0xfd

The VDP can read 224 tiles from ROM and 32 from RAM. The tiles are defined in a format that embeds the colour information, so if you want the same tile in a different colour you have to redefine it. The screen size is meant to be 32x24 characters, but emulators only show 28x24.

The +pv1000 will produce a 16k ROM by default including a default tile set. The tileset can be changed by user programs, details are on the wiki page: https://github.com/z88dk/z88dk/wiki/Pla ... sio-PV1000

At the moment, the port includes the VT52 console and the joystick() function from games.h so terminal based games should be portable to it.
User avatar
RobertK
Well known member
Posts: 347
Joined: Mon Feb 26, 2018 12:58 pm

Post by RobertK »

Thanks for this great new target!

I have noticed two issues:

1. When I try to compile my joystick test program https://www.z88dk.org/forum/viewtopic.p ... 148#p16148 like this...

zcc +pv1000 -o joytest_pv1000 -create-app joytest.c

...I get these compile errors:

Code: Select all

Error at file 'joytest.c' line 69: symbol '_joystick_type' not defined
Error at file 'joytest.c' line 158: symbol '_joystick_type' not defined
2 errors occurred during assembly
Errors in source file C:\Misc\z88dk\lib\config\\..\..\\lib\target\pv1000\classic
\pv1000_crt0.asm:
Error at file 'joytest.c' line 69: symbol '_joystick_type' not defined
                   ^ ---- (null)Error at file 'joytest.c' line 158: symbol '_joy
stick_type' not defined
                   ^ ---- (null)
2. Since I cannot use joystick input and fgetc_cons() does nothing on the PV-1000 (as it has no keyboard), I have provisionally modified my plot test program to make a pause on the PV-1000 instead of waiting for keyboard input.

Code: Select all

/* Plot(), Unplot() and Point() Test by RobertK, 2018-06-25

   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) ===
   zcc +pv1000 -o plottest_pv1000 -create-app plottest.c
   point() function always returns 0, everything else works
   
   === 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 myWait(uint msec)
{
        // waits a specified number of milliseconds
        // this is the place for the platform-dependent 
        // implementation of this function
    #if defined(__ZX81__) || defined(__ZX80__)
                in_Wait(msec);
        #else
                // provisional solution for other platforms
                // Taken from CROSS CHASE by Fabrizio Caruso (sleep_macros.c)
                // value is not in milliseconds, has to be adjusted for each platform                
                unsigned int ii; 
                for(ii=0;ii<msec;++ii){}; 
        #endif
}

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__)
        printf("plotting and unplotting...\n\n");
        myWait(15000);
  #else
        printf("press any key to plot and unplot\n\n");
        fgetc_cons();        // wait for keypress
  #endif
  
  #if defined(__ABC80__) || defined(__EG2000__)
        clg();  // activate graphics mode
  #elif defined(__VZ200__) || defined(__VG5000__) || defined(__P2000__)
        clg();  // activate graphics mode
        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

  plot(1,1);
  plot(3,3);
  plot(5,5);
  unplot(5,5);
  plot(7,7);
    
  #if defined(__PV1000__)
        printf("point-checking...\n\n");
        myWait(15000);
  #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(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__)
                printf("\ndrawing border...\n");
                myWait(15000);
          #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__)
        printf("\nclearing screen...\n");
        myWait(15000);
  #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__)
        myWait(15000);
  #else
        fgetc_cons();        // wait for keypress
  #endif
}
The problem is that point() always returns 0, everything else works correctly.
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

Thanks for the report.

Both of those should be fixed now - to get the joystick type you need to add #define DEFINE_JOYSTICK_TYPE as usual.
User avatar
RobertK
Well known member
Posts: 347
Joined: Mon Feb 26, 2018 12:58 pm

Post by RobertK »

Joystick control works now, thanks! Ok, here we need to define DEFINE_JOYSTICK_TYPE, while for other targets this seems to be already defined somewhere else.

Point() now works correctly in my test program, but a test with my game shows that it seems to return wrong values at specific screen locations.
A quick test makes me wonder if maybe x and y are inverted in the point() function?

In my test program I should better use coordinates with x<>y...

One more question: how do I avoid this warning when compiling for the PV-1000 target?

Warning: could not get the 'myzorg' value, binary ORG defaults to rombase = 0

And one final hint: in games.h, the pv1000 section is there twice, with the second one missing the last _ character in the system identifer. This second part can probably be removed.
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

Ok, here we need to define DEFINE_JOYSTICK_TYPE, while for other targets this seems to be already defined somewhere else.
Ah, it's missing a library function that defines them, I've just fixed that up.
A quick test makes me wonder if maybe x and y are inverted in the point() function?
Good spot, they were!
One more question: how do I avoid this warning when compiling for the PV-1000 target?
I've squashed that one as well
in games.h, the pv1000 section is there twice
Thank you - I thought I'd added it and was a bit puzzled that I couldn't find it, which is why I added it again.

All of these should be sorted in the next nightly
Post Reply