(classic) New target: Tesla PMD85

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

(classic) New target: Tesla PMD85

Post by dom »

I?ve just merged support for this family of machines - they?re quite special in that they are the first genuinely 8080 machines supported by z88dk.

There should be support to get quite a few things running:

- Generic console supporting custom fonts and udgs
- Colour support for the ColorAce mod
- Inkey keyboard
- Plot/unplot graphics support

The graphics library in z88dk makes heavy use of the z80 features so any high level constructs are missing unfortunately. They could be added back with some work as required.

There?s more details on the wiki and the library should come out in the 20190112 nightly build.
RobertK
Well known member
Posts: 199
Joined: Mon Feb 26, 2018 12:58 pm

Post by RobertK »

Great, thanks for one more target!
dom wrote:- Inkey keyboard
Does this mean that fgetc_cons() should work already or not?

As it didn't work for me, I provisionally added this condition in my plot test to treat it like a keyboard-less system:

#if defined(__PV1000__) || defined(__COLECO__) || defined(__PACMAN__) || defined(__Z80TVGAME__) || defined(__SV8000__) || defined(__GAMEBOY__) || defined(__PMD85__)
#define NO_KEYBOARD 1
#endif

Plotting works fine, albeit a little slow, I hope it will be enough to get H-Tron working (at least in two-player mode where no AI is required).

Code: Select all

/* plot(), Unplot() and Point() Test by RobertK, 2020-01-12

   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 (256x96) === (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"
   
   === Tesla PMD-85.1 (288x256) ===
   zcc +pmd85 -pragma-redirect:fputc_cons=fputc_cons_generic -create-app -o plottest_pmd85 plottest.c
   or
   zcc +pmd85 -pragma-redirect:fputc_cons=fputc_cons_generic -pragma-redirect:CRT_FONT=_font_8x8_msx_system -create-app -o plottest_pmd85 plottest.c
   After inserting the tape, type
   MGLD 00
   JUMP 0000
   All ok, but keyboard does not work yet, so we provisionally define NO_KEYBOARD for testing.
   
*/

#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(__FP1100__) // || 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

// To avoid the Sharp MZ run out of stack space - solution according to dom: 
// "compiling with the atexit size removed - by default on the MZ that's taking up 64 bytes of stack"
// "For your case, I don't think there's any benefit in protecting that #pragma as just for the MZ - 
// I'm guessing you're not using atexit() so it might as well be 0 for all targets."
// #if defined(__SHARPMZ__)        // Sharp MZ
        #pragma output CLIB_EXIT_STACK_SIZE = 0
// #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__) || defined(__GAMEBOY__) || defined(__PMD85__)
        #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(__FP1100__)        // Casio FP-1100
        mode=2;        // 80x48
        console_ioctl(IOCTL_GENCON_SET_MODE, &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__) && !defined(__GAMEBOY__)  // 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(__FP1100__)  // || 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: 1194
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

It should have a keyboard. I've figured out what happened - a previous target built the input library for the z80 and it wasn't rebuilt for the 8080. The net result of this was basically the program restarting as an unknown opcode was hit.

There's possible a couple more of those around the place, but input/ is now properly sorted.
RobertK
Well known member
Posts: 199
Joined: Mon Feb 26, 2018 12:58 pm

Post by RobertK »

What can I say, it seems we now have a perfectly working new target!

A new release of H-Tron is now out with PMD 85 support.

Image

in_KeyPressed() works great (but also standard keyboard input works fine).

One-Player mode is quite slow (about 55% of my desired speed), but still playable.

Do you think that you could do "UDG lores plotting" without much effort and that it would be faster?
User avatar
dom
Well known member
Posts: 1194
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

That's good - it looks like I can almost add a working target first time these days!

I think there's a couple of reasons why plotting is so slow:

- The clock speed is only ~2Mhz
- Plotting depends on dividing by 6 to find the correct character cell

I'm using repeated subtraction as the method since I need the remainder as well for the pixel position. Figuring out a quicker way to do it would boost speed - I've got an idea using a smallish lookup table that I'll try out.

Regarding UDG based approach, that would work and be quicker, but the lores pixels would be 3x4 hires pixels so wouldn't be square.
RobertK
Well known member
Posts: 199
Joined: Mon Feb 26, 2018 12:58 pm

Post by RobertK »

Dom hast found some extra plotting speed for the last nightly, so I have updated H-Tron on my SourceForge site, now one-player mode runs at the desired speed on the PMD 85.

I have also updated Mastermind RK which now supports the PMD 85. Two .ptp files are included: a standard B/W one and a "Color Ace" version. I have disabled inverse for the game pieces in the B/W version because of its poor readability (changing the font does not help either because of this system's narrow 6x8 character cells).

However, one thing is still not functional: floating point calculations currently crash. I hope this is not the same 8080 issue that we have with the Gameboy target (floating point support is still not functional there).

Code: Select all

// Floating point calculation test
// Author: RobertK, 2018-12-29

// Compile with:
// zcc +gal -create-app -lm -o fct floatcalctest.c
// zcc +zx81 -create-app -lm -startup=2 -o fct_zx81 floatcalctest.c
// zcc +zx80 -create-app -lm -o fct_zx80 floatcalctest.c
// zcc +gb -create-app -lm -o fctgb.gb floatcalctest.c
// zcc +pmd85 -create-app -lm -o fct_pmd85.gb floatcalctest.c

#include <stdio.h>

void main()
{   
  printf("\nhello world\n");
  printf("\npress any key to calculate 5*0.1...\n");
  fgetc_cons();        // wait for keypress          
  printf("\n5*0.1 is %.1f\n",5*0.1);
  printf("\npress any key to exit...\n");  
  fgetc_cons();        // wait for keypress          
}
User avatar
dom
Well known member
Posts: 1194
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

RobertK wrote:However, one thing is still not functional: floating point calculations currently crash. I hope this is not the same 8080 issue that we have with the Gameboy target (floating point support is still not functional there).
The good news is that we do have a floating point library for the 8080 - the original Microsoft mbf32 library. We don't ship with it since it would get caught by various Linux package makers being non-free.

For reference how to build it:

Code: Select all

cd z88dk/libsrc
rm mbf32*.lib
cd math/mbf32/z80
wget http://www.z88dk.org/misc/math_mbf32.asm
cd ..
make
cd ../..
cp mbf32_*.lib ../lib/clibs/
RobertK
Well known member
Posts: 199
Joined: Mon Feb 26, 2018 12:58 pm

Post by RobertK »

Dom has fixed the remaining issues, so I could update my Elite Planet Browser which now supports the PMD85.

For the math library, --math-mbf32_8080 is used instead of -lm. The three files

mbf32.lib
mbf32_8080.lib
mbf32_iy.lib

need to be replaced in the z88dk lib\clibs directory.

For the Galactic Chart I have added a workaround for the missing circle function, on the PMD85 a box is plotted around the star.
User avatar
dom
Well known member
Posts: 1194
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

I forgot to mention: I added support for lines, boxes and circles to the PMD85 a few weeks ago.
Post Reply