Jump to content

Photo

Games in Mad Pascal


29 replies to this topic

#1 Gury OFFLINE  

Gury

    Stargunner

  • 1,215 posts

Posted Sun Mar 6, 2016 4:50 AM

Hello there,

 

I've got an idea of posting games written in Mad Pascal. Here you can post any game you created in this language, it could even be a type-in listing game from any magazine or book, but converted to Mad Pascal.

 

I begin with Wolves, type-in listing from ex-Yu book Mirko Tipka Na Radirko, which included games and utility listings written in Sinclair BASIC for ZX Spectrum. Game was originally written by Primoz Petrlin. There is executable file at the bottom of this post. If you wish, you can modify it and make it even better.

 

wolves_zx.png wolves_zx01.png

 

Story: Small village in Bosnian mountains is attacked by hord of hungry wolves. Your 5 heroes must defend your people by stopping wolves eating them. When five of them reach your village, people are doomed and game is over.

 

Controls: 5 - left, 6 - down, 7 - up, 8 - right

 

I tried to make game close to the original, but making some changes, for example, in sounds which are not the same. I also added title music, which is actually a code excerpt from De re Atari book.
 
// Wolves
// Ported from the book Mirko tipka na radirko
// Original author: Primoz Petrlin
// Original game written for ZX Spectrum in Sinclair BASIC
// Ported to Atari XL/XE/400/800 in Mad Pascal: Bostjan Gorisek 2016

uses
  graph, crt, sysutils;

var
  topMem : word;
  CHBAS : byte absolute $2F4;
  RAMTOP : byte absolute $6A;  
  playerName : string[15] = 'M.M';
  playerScore : shortInt = 10;
  score, lives,
  a, b,          // Our hero's coordinates
  s, d  : byte;  // Wolf coordinates  
  isNewGame : boolean = true;
  
  // Data for new characters
  _grave : array[0..6] of byte = (
    %01111100, %10000010, %10000010, %10000010, %10000010, %01010100, %11111110);  // character g
  _hero02 : array[0..7] of byte = (
    %00011100, %00101010, %00010100, %00001000, %00111111, %01001000, %00010100, %00110110);  // character c
  _dead_wolf : array[0..7] of byte = (
    %00010000, %00010000, %11111110, %00010000, %00010000, %00010000, %00010000, %00010000);  // character j
  _hero : array[0..7] of byte = (
    %00011100, %00101010, %10010100, %01001001, %00111110, %00001000, %00010100, %00110110);  // character p
  _weapon : array[0..7] of byte = (
    0, %01100000, %01100000, %01000000, %11000000, %01000000, %01000000, 0);  // character o
  _wolf : array[0..6] of byte = (
    0, %00100000, %11100010, %01111100, %00111100, %00100100, %00100100);  // character d
  _tree : array[0..7] of byte = (
    0, %00011100, %00111110, %01111111, %00111110, %00010100, %00010100, 0);  // character h

// Custom write routines
procedure PrintAt(x, y : byte; text : string); overload; begin GotoXY(x+1, y+1); Write(text); end;
procedure PrintAt(x, y : byte; text : char); overload; begin GotoXY(x+1, y+1); Write(text); end;

// New game?
function NewGame : boolean;
var
  ch : char;
begin
  if KeyPressed then ReadKey;
  Writeln(#$9b#$9b'ANOTHER GAME? (Y/N)');
  isNewGame := false;
  ch := #255;
  repeat
    if KeyPressed then begin
      ch := UpCase(ReadKey);
      isNewGame := (ch = 'Y');
    end;
  until (ch = 'Y') or (ch = 'N');

  result := isNewGame;
end;

// High score code block 
function HighScore : boolean;
var
  i, j : byte;
begin  
  Poke($D201, 168);
  for i:=200 downTo 100 do begin
    Poke($D200, i); Delay(10);
  end;
  ClrScr;
  for j:=1 to 10 do begin
    PrintAt(18, 16, 'HURA!'); PrintAt(18, 6, 'HURA!');
    PrintAt(20, 11, 'P');
    Delay(40);
    Poke($D200, 90);
    ClrScr;
    PrintAt(20, 11, 'c');
    Delay(40);
    Poke($D200, 154);
    for i:=6 to 16 do begin
      PrintAt(11, i, 'HURA'); PrintAt(26, i, 'HURA');
    end;
  end;  
  for i:=255 downTo 60 do begin
    Poke($D200, i); Delay(10);
  end;
  FillChar(Pointer($D200), 2, 0);
  Delay(40); ClrScr; CursorOn;
  if KeyPressed then ReadKey;
  Writeln('YOU REACHED HIGH SCORE!'#$9b'ENTER YOUR NAME:');
  ReadLn(playerName);
  CursorOff;
  playerScore := score;
  result := NewGame;
end;

// Game is on
procedure Game;
var
  y, x, z, n, m : byte;
  ch : char;  
begin
  FillChar(Pointer($D200), 8, 0);
  ClrScr;
  PrintAt(1, 0, 'ppppp');
  score := 0;  // Initialize score
  lives := 5;  // You have 5 lives  
  Randomize;
  
  // Draw trees on random locations
  for y := 1 to 38 do begin
    z := Random(22);
    x := Random(38);
    PrintAt(x, z+1, 'h');
  end;
  // Row of trees
  for y := 0 to 22 do PrintAt(38, y, 'h');

  // Hero position
  a := 11; b := 11;

  // Wolf coordinates
  d := 36; s := Random(22) + 1;

  // Game play loop  
  repeat
    PrintAt(b, a, 'po');  // Hero position

    // Keep track of hero deaths
    if lives < 5 then
      PrintAt(lives+1, 0, ' g');
    
    PrintAt(d, s, 'd');  // Draw attacking wolf
          
    Dec(d);
    //if d = 0 then Continue;
    // Wolf reached your village :(
    if d = 0 then begin
      PrintAt(d+2, s, ' '); PrintAt(d, s, ' ');
      Dec(lives);
      d := 36; s := Random(22) + 1;
      if lives = 0 then begin
        break;
      end;
    end;
        
    PrintAt(d+2, s, ' ');

    // Hero control
    if KeyPressed then begin
      ch := UpCase(ReadKey);
      case ch of
        '8': begin
          Inc(b); 
          if b = 37 then b := 36;
          PrintAt(b-1, a, '  ');
        end;
        '5': begin
          Dec(b);
          if b = 1 then b := 2;
          PrintAt(b+1, a, '  ');
        end;
        '6': begin
          Inc(a);
          if a = 23 then a := 22;
          PrintAt(b, a-1, '  ');
        end;
        '7': begin
          Dec(a);
          if a = 0 then a := 1;
          PrintAt(b, a+1, '  ');
        end;
      end;
    end;
    
    // You hit a wolf
    if (a = s) and (b = d) then begin
      // beep beep
      PrintAt(d, a, ' ');
      Poke($D201, 168);
      for m := 1 to 50 do begin
        for n:=40 to 100 do Poke($D200, n);
      end;
      Poke($D200, 0);  Poke($D201, 0);
      d := 36; s := Random(22) + 1;
      Inc(score);
      GotoXY(30, 1); Write('DEAD=', score);
      PrintAt(b+2, a, 'j');
    end;
    
    Delay(75);
  until lives = 0;
  
  ClrScr;
  if score <= playerScore then begin
    PrintAt(1, 11, 'VILLAGE PEOPLE ARE DEAD.'#$9b'YOU KILLED ');
    Write(IntToStr(score), ' WOLVES!');
    NewGame;
    //if not NewGame then Halt(0);
  end else begin
    // If you break new record...
    HighScore;
  end;
end;

begin
  // Set display mode, colors and left margin
  InitGraph(0); CursorOff;
  Poke(710, 34); Poke(709, 30); Poke(82, 1);
  //Poke($D201, 168);  // sound channel 0 volume and distortion

  // Prepare new character set
  topMem := RAMTOP - 8;
  topMem := topMem * 256;
  CHBAS := topMem div 256;  
  move(pointer(57344), pointer(topMem), 1023);
  
  // Redefine characters for the game
  move(_grave, pointer(topMem+103*8), sizeOf(_grave));          // g
  move(_hero02, pointer(topMem+99*8), sizeOf(_hero02));         // c
  move(_dead_wolf, pointer(topMem+106*8), sizeOf(_dead_wolf));  // j
  move(_hero, pointer(topMem+112*8), sizeOf(_hero));            // p
  move(_weapon, pointer(topMem+111*8), sizeOf(_weapon));        // o
  move(_wolf, pointer(topMem+100*8), sizeOf(_wolf));            // d
  move(_tree, pointer(topMem+104*8), sizeOf(_tree));            // h

  // Title screen
  Writeln(#$9b'           ddd WOLVES ddd' +
          #$9b#$9b'SMALL VILLAGE IN BOSNIAN MOUNTAINS IS' +
          #$9b'ATTACKED BY HORD OF HUNGRY WOLVES.' +
          #$9b'YOU MUST DEFEND YOUR PEOPLE BY STOPPING' +
              'WOLVES BY ANY COST.' +
          #$9b#$9b'                  po'#$9b +
          #$9b'WHEN FIVE OF THEM REACH THE VILLAGE,' +
          #$9b'PEOPLE ARE EATEN AND GAME IS OVER.');

  // Some title music
  // Taken from the book De Re Atari
  Poke(53768, 24); Poke( 53761, 168); Poke( 53763, 168); Poke( 53765, 168);
  Poke(53767, 168); Poke( 53760, 240); Poke( 53764, 252); Poke( 53762, 28);
  Poke(53766, 49);

  // Main game loop
  repeat
    // Best score information
    Writeln(#$9b'BEST SCORE ', playerScore, ' HOLDS ', playerName);
    Writeln(#$9b#$9b'PRESS ANY KEY...');
    repeat until keypressed;
    // Game
    Game;
  until not isNewGame;
end.

ZX Spectrum type-in listing in Sinclair BASIC (Mirko Tipka Na Radirko):

Page 1

Page 2

Attached Files


Edited by Gury, Sun Mar 6, 2016 4:59 AM.


#2 miker OFFLINE  

miker

    Stargunner

  • 1,815 posts
  • Stay Atari!
  • Location:Warsaw, Poland

Posted Sun Mar 6, 2016 6:13 AM

Not bad but steering is ridiculous. Some joystick hack or at least arrows/WSAD? ;)



#3 Gury OFFLINE  

Gury

    Stargunner

  • Topic Starter
  • 1,215 posts

Posted Sun Mar 6, 2016 7:14 AM

Good point! ZX Spectrum key layout :)

 

I modified game to play with joystick. I will take this into consideration when porting ZX games.

 

Greetings

 

Attached Files



#4 miker OFFLINE  

miker

    Stargunner

  • 1,815 posts
  • Stay Atari!
  • Location:Warsaw, Poland

Posted Sun Mar 6, 2016 1:35 PM

Now is much better.

 

Thanks! :)



#5 tebe OFFLINE  

tebe

    Dragonstomper

  • 648 posts
  • Location:Poznań - Poland

Posted Sat Mar 12, 2016 7:30 AM

conversion from Turbo Basic XL (author: mgr inż. Rafał Chabowski) - Duck Hunt

Attached Files



#6 Gury OFFLINE  

Gury

    Stargunner

  • Topic Starter
  • 1,215 posts

Posted Sat Mar 26, 2016 12:23 PM

Nice!



#7 Gury OFFLINE  

Gury

    Stargunner

  • Topic Starter
  • 1,215 posts

Posted Sat Mar 26, 2016 12:40 PM

Another conversion from the book Mirko tipka na radirko, a story about kangaroo in game called Stupid Kangaroo. You are a kangaroo, who was captured by crazy evil king. The king decided to test your intelligence and psychical abilities hoping to break you, because he thinks you are stupid. He was way too WRONG :)

 

You control your hero kangaroo with joystick (left / right). He jumps all the time, so you don't have to jump yourself with joystick button. Your goal is to reach each level by finding red brick, which brings you one point and open door for the next level. Each new level brings you additional points. When you finish all four levels, you come back to first level, but with a surprising twist :)

 

You start with 3 lives and additional life when you finish all 4 levels.

 

sk01.png  sk02.png

 

In Mad Pascal code, don't be confused with coordinate system of PrintAt and Screen routines, because they simulate Sinclair BASIC way of handling coordinate system (y axis first, x axis second). I put these routine in special unit for easier handling of Sinclair BASIC commands.

 

Attached below are source code and binary files.

 

Enjoy the game!

Gury

 

ZX Spectrum type-in listing in Sinclair BASIC (Mirko Tipka Na Radirko):

Page 1  Page 2  Page 3

Attached Files

  • Attached File  sk.zip   102.13KB   123 downloads
  • Attached File  sk.xex   10.38KB   169 downloads

Edited by Gury, Sat Mar 26, 2016 12:47 PM.


#8 tebe OFFLINE  

tebe

    Dragonstomper

  • 648 posts
  • Location:Poznań - Poland

Posted Sun Apr 10, 2016 6:23 AM

NUTS (MadPascal version)

http://jeffpiepmeier...ntest-2016.html

Attached Files


Edited by tebe, Sun Apr 10, 2016 6:23 AM.


#9 Gury OFFLINE  

Gury

    Stargunner

  • Topic Starter
  • 1,215 posts

Posted Mon Apr 11, 2016 12:43 AM

Nice little adrenalin game :thumbsup:



#10 Gury OFFLINE  

Gury

    Stargunner

  • Topic Starter
  • 1,215 posts

Posted Sun Apr 17, 2016 4:34 PM

Stupid Kangaroo, new version 1.1, additional level and high score tracking added...

 

Greetings

 

Attached Files

  • Attached File  sk.zip   9.01KB   50 downloads
  • Attached File  sk.xex   11.75KB   58 downloads


#11 Gury OFFLINE  

Gury

    Stargunner

  • Topic Starter
  • 1,215 posts

Posted Sat Apr 30, 2016 5:33 AM

Yet another conversion from the book Mirko tipka na radirko, now it is time for some action from the second world war. The game is titled Parachute, originally written by Bostjan Jerko. The game begins with flying plane over war zone on the ocean. Your mission is to land as many soldiers as you can in the middle of the island.

 

parachute.png  parachute01.png  parachute04.png

 

When your soldier jumps, it drops very quickly, so you must open your parachute before you land on the island. You control a soldier with joystick by pressing trigger button first time for jump and second time for opening the parachute. Later you open it, more score points you get. But be sure to do this before landing if you don't want to die. When your parachute opens, you can control soldier with joystick (left/right). After five jumps the plane moves lower, making jumping area lower and harder. When you succeed to land soldiers in some 5 jump waves, you progress to next wave (level), where plane moves faster and faster.

 

The game is written in Mad Pascal, version 1.3.1. You can download executable file and source code listing below.

 

Original ZX Spectrum game is written in Sinclair BASIC:

 

Page 1  Page 2  Page 3

 
Greetings,
Gury

Attached Files


Edited by Gury, Sat Apr 30, 2016 5:45 AM.


#12 Gury OFFLINE  

Gury

    Stargunner

  • Topic Starter
  • 1,215 posts

Posted Wed Jun 14, 2017 4:23 PM

Hello,

 

Here is another little game conversion from the book Mirko tipka na radirko, titled Formula 126PZ by Branislav Milosavljevic. In this game you control a car which must struggle through the scrolling screen with obstacles on the way. The car is shaking, but you will be comfortable with it very soon. The score increases as long as you manage not to crash.

 

formula126pz.png formula126pz01.png formula126pz02.png

 
Enjoy!
 
Gury

Attached Files


Edited by Gury, Wed Jun 14, 2017 4:29 PM.


#13 peteym5 OFFLINE  

peteym5

    Stargunner

  • 1,769 posts
  • Location:Buffalo NY USA

Posted Thu Jun 15, 2017 3:33 PM

On the main section, under "More Games to Come..." people had been suggesting this game called "Klax" looks like another Tempest and Columns type game. I feel this will be perfect for the Mad Pascal People to make because it is not complicated and does not require heavy machine language to make this game run on the Atari 8-bit. In there I suggested something with GTIA mode 10 or Super IRG, but that will be the programmer to decide. I know we can do better with our Atari Computers.

 


Edited by peteym5, Thu Jun 15, 2017 3:41 PM.


#14 Stephen OFFLINE  

Stephen

    Quadrunner

  • 6,457 posts
  • A8 Gear Head
  • Location:No longer in Crakron, Ohio

Posted Thu Jun 15, 2017 4:54 PM

On the main section, under "More Games to Come..." people had been suggesting this game called "Klax" looks like another Tempest and Columns type game. I feel this will be perfect for the Mad Pascal People to make because it is not complicated and does not require heavy machine language to make this game run on the Atari 8-bit. In there I suggested something with GTIA mode 10 or Super IRG, but that will be the programmer to decide. I know we can do better with our Atari Computers.

 

If you want to do Klax, please look at the Lynx version!  Excellent graphics, digitised sounds.



#15 tebe OFFLINE  

tebe

    Dragonstomper

  • 648 posts
  • Location:Poznań - Poland

Posted Fri Jun 16, 2017 6:47 AM

written in AmigaBasic :)

 

http://www.gutenberg...ax_(video_game)



#16 Allan OFFLINE  

Allan

    Quadrunner

  • 6,077 posts
  • Location:Wallingford, CT

Posted Fri Jun 16, 2017 8:34 AM

I believe Klax for the Atari 5200 is written in compiled BASIC. I think it is called 5200bas. 

 

Allan



#17 peteym5 OFFLINE  

peteym5

    Stargunner

  • 1,769 posts
  • Location:Buffalo NY USA

Posted Fri Jun 16, 2017 3:03 PM

They have Klax in 5200 Basic? That would save us a lot of time. Can this 5200 Basic set up to compile for the 8-bit?



#18 Gury OFFLINE  

Gury

    Stargunner

  • Topic Starter
  • 1,215 posts

Posted Sun Jun 18, 2017 1:04 AM

Another little conversion from the book Mirko tipka na radirko, now it is time for shooting the stars with the game called Hit Star. The goal is to shoot all stars at the top of the screen. You can do that with two space ships on the left and right side. Use your joystick to move left and right to trigger both ships. When ships collide, the missile is fired. Let's see how many shoots do you need to remove all the stars.

 

hit_star01.png hit_star02.png hit_star03.png hit_star04.png

 

Link to the source book

 

Greetings

Attached Files


Edited by Gury, Sun Jun 18, 2017 1:15 AM.


#19 devwebcl OFFLINE  

devwebcl

    Stargunner

  • 1,132 posts
  • Location:Chile

Posted Sun Jun 18, 2017 6:00 PM

It would be nice to have a single page where are all these Mad games (imho)



#20 CharlieChaplin OFFLINE  

CharlieChaplin

    River Patroller

  • 2,553 posts

Posted Wed Jun 21, 2017 4:10 PM

It would be nice to have a single page where are all these Mad games (imho)

 

Well, Adam created it for you:

 

http://www.atarionli...49a62fc9b22d608

 

at least for now...



#21 Gury OFFLINE  

Gury

    Stargunner

  • Topic Starter
  • 1,215 posts

Posted Sun Jun 25, 2017 6:52 AM

Hello,

 

Today I represent you a game full of adrenalin. Why? Because you must save your planet from enemy attack from outer space. You have to bring four space ships to safe place to prepare them for a fight against the enemy. But, there is always a but... you must do this very quickly, because time is not your friend. Hurry up, hero, defend your planet.

 

galactica01.png galactica02.png galactica03.png galactica04.png galactica05.png galactica06.png

 

Enjoy!

Gury

 

Attached Files



#22 tebe OFFLINE  

tebe

    Dragonstomper

  • 648 posts
  • Location:Poznań - Poland

Posted Sun Aug 13, 2017 1:23 AM

https://gitlab.com/bocianu/PacMad

http://mimuma.pl/PacMadEditor/

Attached Thumbnails

  • pac_mad.png

Edited by tebe, Sun Aug 13, 2017 11:43 PM.


#23 xxl OFFLINE  

xxl

    Dragonstomper

  • 994 posts
  • Location:Rabka-Zdrój /Poland

Posted Sun Aug 13, 2017 3:23 AM

 
Pac-Mad hi-score table banner: 
 
player:

Edited by xxl, Sun Aug 13, 2017 3:25 AM.


#24 MrFish ONLINE  

MrFish

    River Patroller

  • 4,164 posts
  • Location:1010-1010

Posted Sun Aug 13, 2017 10:35 PM

 

Nice game. I have a hard time rolling without the "munch" sound, though. Possible to add in?



#25 devwebcl OFFLINE  

devwebcl

    Stargunner

  • 1,132 posts
  • Location:Chile

Posted Tue Aug 15, 2017 9:40 AM

 

Nice game. I have a hard time rolling without the "munch" sound, though. Possible to add in?

 

The ghost may have a little more AI






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users