Slide Show program

Post your CP/M & TDOS questions here
Post Reply
User avatar
Wmaalouli
Posts: 61
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 11 times

User avatar
Milli
Site Admin
Posts: 52
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: 61
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!

Post Reply