Slide Show program

Post your CP/M & TDOS questions here
User avatar
Wmaalouli
Posts: 155
Joined: Sat Jul 20, 2019 2:09 pm

Slide Show program

Post by Wmaalouli » Mon Aug 05, 2019 11:40 pm

This project is a result of my experimentation with accessing the VDP and embedded assembly language using Turbo Pascal 3 under CP/M 2.2. It's a slide show program which takes a series of bitmap images and displays them in a continuous loop on the screen. It was programmed entirely on the Adam computer (not an emulator) with the help of the Adamed editor since the TP3 integrated editor does not work well with the Adam.

In order to create the bitmap images, I used a PC program by Mike Brent called Convert9918 initially designed for the TI 99/4A computer. However, since both the TI and the Adam share the same VDP, the program works for both. Here's a link to it: http://www.harmlesslion.com/cgi-bin/onesoft.cgi?2, and it's very easy to use although you do have to play with the different settings in order to get the best image conversion. The output of the program is 2 files for each image, a pattern file and a color file, with the extension of TIAP and TIAC respectively. You need to change these extensions to .P and .C for use with the Slide Show program. Once converted, the images can be transferred to the Adam using the Adam Image Manager.

Put all the image files (.P and .C files) on the same disk as the Slide Show program, then create a text file using Adamed listing the names of each image file in capital letters without the extensions, one on each line, and save it as IMAGE.LIB. This library file will be used by Slide Show to load the appropriate images from disk. If it does not find it, then it will complain and terminate. Slide Show is optimized with the way Adamed stores files on disk, so IMAGE.LIB should only be created using the Adamed editor. Here's a sample of an IMAGE.LIB file:

Code: Select all

FLOWER
STARTREK
ISLAND
To run Slide Show, boot the diskette up and once the CP/M prompt appears, type SLIDESHW and press Enter, and the program will run. There will be initially some screen corruption as the bitmap mode is set up. To exit the program, press any key and it will exit back to CP/M after the following image.

Here's a short demo:

https://youtu.be/FFICTWPQuhQ

And here's the Turbo Pascal 3 listing for the curious:

Code: Select all

program Slideshow;
Label
  RstFile, Loop;
Type
  Fname = String[11];
Var
  OK : Boolean;
  FilNam : Fname;
  N, SIT, I, ImgNum : Integer;
  ImgLib : Text;
  FilChr : Char;

procedure ShowImg(Var OK : Boolean;
                  FilNam : Fname);
Var
  FilStr : String[11];
  ImgFile : File;
  Pass : Integer;
  Buffer : array[1..6144] of Byte;
begin
  Pass := 1;
  repeat
     FilStr := '';
     if Pass = 1 then
        FilStr := FilNam + '.P'
     else
        FilStr := FilNam + '.C';
     Assign (ImgFile, FilStr);
     {$I-} Reset(ImgFile) {$I+};
     OK := (IOresult = 0);
     if not OK then
        exit;
     {Read file header and discard}
     Blockread(ImgFile, Buffer, 1);
     {Read image data}
     Blockread(ImgFile, Buffer, 48);
     if Pass = 1 then
        {Write pattern data to VDP}
        inline($21/Buffer/$11/0/0/1/
               0/$18/$CD/$5D/$DA)
     else
        {Write color data to VDP}
        inline($21/Buffer/$11/0/$20/
               1/0/$18/$CD/$5D/$DA);
     Close(ImgFile);
     Pass := Pass + 1;
  until Pass = 3;
end;

begin
  {Initialize screen image table}
  {Fill with 0 to $FF times 3}
  SIT := $1800;
  for I := 1 to 3 do
     begin
        N := 0;
        repeat
           inline($2A/SIT/$EB/$21/N/
                  1/1/0/$CD/$5D/$DA);
           N := N +1;
           SIT := SIT + 1;
        until N = 256;
     end;
  {Disable sprites}
  {Place $D0 at start of Sprite
   Attribute List @ $3880}
  inline($11/$80/$38/1/$01/0/$3E/$D0/
         $CD/$5A/$DA);
  {Open picture library file}
  Assign(ImgLib,'IMAGE.LIB');
  {$I-} Reset(ImgLib) {$I+};
  OK := (IOresult = 0);
  if not OK then
     begin
        inline($CD/$66/$DA);
        writeln('Library file error!');
        halt;
     end;
  Loop:
  ImgNum := 1;
  repeat
     Readln(ImgLib,FilNam);
     Delete(FilNam,Pos(' ',FilNam),40);
     {Display image}
     ShowImg(OK, FilNam);
     if not OK then
        goto RstFile;
     Delay(2000);
     if KeyPressed then
        begin
           {Restore VDP settings}
           inline($CD/$66/$DA);
           close(ImgLib);
           halt;
        end;
     ImgNum := ImgNum + 1;
     if ImgNum = 4 then
        begin
           read(ImgLib, Filchr);
           read(ImgLib, Filchr);
           ImgNum := 1;
        end;
  until EOF(ImgLib);
  RstFile:
  reset(ImgLib);
  goto Loop;
end.
Attachments
Slideshow.zip
(42.74 KiB) Downloaded 268 times

User avatar
Milli
Site Admin
Posts: 224
Joined: Fri Jul 19, 2019 3:13 pm
Location: Beaver Falls PA
Contact:

Re: Slide Show program

Post by Milli » Fri Aug 23, 2019 6:47 pm

I really want to tinker with this
Milli

User avatar
Wmaalouli
Posts: 155
Joined: Sat Jul 20, 2019 2:09 pm

Re: Slide Show program

Post by Wmaalouli » Sun Aug 25, 2019 8:50 pm

Knock yourself out :) Show us what you come up with!

User avatar
Sixthview
Posts: 9
Joined: Tue Dec 03, 2019 8:01 pm

Re: Slide Show program

Post by Sixthview » Wed Oct 07, 2020 8:56 pm

So I tried to do two more images but still not working.
I'll attach an image along with the screenshot.
I am hoping I am just doing something silly, but I have a bad feeling it may be the 64 bit thing making the problem? Not sure.
test.png
test.png (10.33 KiB) Viewed 4732 times
My DSK image is with the picture files incase you wanted to see what else I did. I of course haven't tested it on real hardware yet. Just got my SD drive today and the wife is occupying it with Jeopardy.
Attachments
Anime ADAM.rar
(48.85 KiB) Downloaded 177 times

User avatar
Wmaalouli
Posts: 155
Joined: Sat Jul 20, 2019 2:09 pm

Re: Slide Show program

Post by Wmaalouli » Sat Oct 10, 2020 7:15 am

OK I'll test it out tonight on real hardware and get back to you.
I never tried the program under emulation, so there might possibly be an issue there.

User avatar
Milli
Site Admin
Posts: 224
Joined: Fri Jul 19, 2019 3:13 pm
Location: Beaver Falls PA
Contact:

Re: Slide Show program

Post by Milli » Sat Oct 10, 2020 8:05 am

The emulator is a little different. I learned that when you start the emulator all VDP registers are NULL but on real hardware they may not be. Also when using mode 3 I was able to code it to work right on the emulator but it was garbage on real hardware. This is not relying on CPM but my own code from scratch.
Milli

User avatar
Wmaalouli
Posts: 155
Joined: Sat Jul 20, 2019 2:09 pm

Re: Slide Show program

Post by Wmaalouli » Sat Oct 10, 2020 1:06 pm

So I putzed around with this and it looks like you did not use the Adamed text editor (viewtopic.php?f=6&t=7) to create the IMAGE.LIB file. The Slideshow program requires the proprietary file structure of Adamed for IMAGE.LIB in order to load the images properly.
When I did that, the images loaded but were a bit corrupted. Mind you this was all done under emulation and that might be causing issues. I won't have access to my real Adam until tonight.
Incidentally, image A01 is entirely black and white. Is this really the case? Otherwise the color file might be wrong.

User avatar
Sixthview
Posts: 9
Joined: Tue Dec 03, 2019 8:01 pm

Re: Slide Show program

Post by Sixthview » Sat Oct 10, 2020 8:00 pm

You're right. I didn't use Adamed... Just ed. Still picking up on a lot of these nuances. I'll have to check that out.
And the one is just black and white. They were just test images to see what I could get running.
Now that I have my SD Floppy thing, I can move back and forth a bit easier.

Side question, when I used the ADAM Image Manager, it kept trying to rename my files to .com
Should it be doing that?

User avatar
Wmaalouli
Posts: 155
Joined: Sat Jul 20, 2019 2:09 pm

Re: Slide Show program

Post by Wmaalouli » Mon Oct 12, 2020 9:06 am

I tested the images on a real system, and they work fine although there is still a little shift in the second image which might be related to a conversion issue. I use Adamed because it is so much easier to work with than the dreadful Ed :)
As of the Image manager, I think it's a bug in that program. When you transfer a .C or .P file, it will also create a second .COM file. Just delete the latter.
20201012_074924.jpg
20201012_074924.jpg (2.13 MiB) Viewed 4702 times
20201012_074911.jpg
20201012_074911.jpg (3.57 MiB) Viewed 4702 times

User avatar
Sixthview
Posts: 9
Joined: Tue Dec 03, 2019 8:01 pm

Re: Slide Show program

Post by Sixthview » Fri Oct 16, 2020 4:35 pm

Sweet. Now that it is the weekend I have time to play around with it. :D
Could this be set to advance with a button push instead of automatically? :?:

Post Reply