Jump to content
IGNORED

Mad Pascal


Recommended Posts

Hi!

2 hours ago, Atlan_Roland said:

Thank you very much TeBe and XXL!


I (theoretically) get the concept now; but i couldn't put it down in code; my assembler skills - an knowledge of the OS system calls - are to little yet.

You did not understood what Tebe said.

 

Madpascal has two functions: FilePos returns current file position and Seek sets the position. In DOS 2.5 or compatibles (like xbootdos), you should only call Seek with values returned from FilePos other values would give undefined behavior.

 

In SDX and other compatible like BW-DOS FilePos will return the position in bytes and Seek will also set the position in bytes, so you can use arbitrary values. If you need this functionality, use BW-DOS or SDX.

 

Basically "FilePos" is like NOTE, "Seek" is like POINT.

 

Have Fun!

  • Like 2
Link to comment
Share on other sites

you can also use xBIOS: (unit xBIOS for MadPacal) https://bocianu.gitlab.io/blibs/xbios.html

 

xBiosSetFileOffset

procedure xBiosSetFileOffset(pos: cardinal); assembler;


Sets the current read/write position in the current file with a value stored in parameter. This item is calculated relative to the beginning of the file. In DOS speak, the operation is called "POINT". You can only move this pointer forward.
parameters:
  • pos - new position in the current file
  • Like 1
Link to comment
Share on other sites

New Mad Pascal target: Commodore Plus/4

 

#!/bin/bash

mp="$HOME/Programs/MadPascal/mp"
mads="$HOME/Programs/mads/mads"
base="$HOME/Programs/MadPascal/base"

if [ -z "$1" ]; then
  echo -e "\nPlease call '$0 <argument>' to run this command!\n"
  exit 1
fi

$mp $1 -t c4p -z 10 -o
name=${1::-4}

if [ -f $name.a65 ]; then
  [ ! -d "output" ] && mkdir output
  mv $name.a65 output/
  $mads output/$name.a65 -x -i:$base -o:output/$name.prg
else
  exit 1
fi

if [ ! -z "$2" ]; then
  xplus4 output/$name.prg
fi
var
  COLORRAM    : array [0..0] of byte absolute $0800;
  SCREEN      : array [0..0] of byte absolute $0c00;
  BORDERCOLOR : byte absolute $ff15;
  BGCOLOR     : byte absolute $ff19;

var
  w0i, row    : word;
  b0i, b1i    : byte;

begin
  BORDERCOLOR := 0; BGCOLOR := 0;
  FillByte(@SCREEN, 40 * 25, $a0);

  for b0i := 0 to 7 do begin
    row := 40 * b0i;
    for b1i := 0 to 15 do COLORRAM[row+b1i] := (b0i shl 4) + b1i;
  end;
end.

Screenshot_2021-01-11_12-50-46.thumb.png.ffad5d6801a5f95ea47047dcab03e502.png

 

test.pas test.prg

Edited by zbyti
example was refactored
  • Like 2
Link to comment
Share on other sites

  • 4 weeks later...

@Gury right now I'm reading Writing Strategy Games On Your Atari Computer. If I just come up with how to apply this knowledge in this game I will push this game forward ;)

 

I will quote you the beginning of the mentioned book:

Quote

There comes a time in any computer owner's life when he becomes tired
of zapping aliens. As the 1,079,864th flying saucer crashes spectacularly
to the ground (or, more often, the player crashes instead), he thinks about
signing a peace treaty with the rest of the galaxy and turning to something
else.

Are you really want to zapp another alien mothership? ;) 

  • Like 2
  • Haha 1
Link to comment
Share on other sites

While reading "Writing Strategy Games On Your Atari Computer" I decided to have some fun writing a simple AI for siege type games.

At the moment I wrote a few simple strategies for bots:

 

- STRAIGHT
- BULLY
- MIRROR
- SAPPER

 

Game prototyping in Mad Pascal is real fun :] I even started drawing graphics ;)

 

siege.png.8340e27884592b9f037152ebad26b76b.png

 

Gameplay movie taken on C+4, human player on the left.

 

Edited by zbyti
typo
  • Like 2
Link to comment
Share on other sites

Raster IRQ and C+4

 

var
  DETIRQSRC                          : byte absolute $ff09;  //detect IRQ source, and clear IRQ flag
  SETIRQSRC                          : byte absolute $ff0a;  //set IRQ source
  RC                                 : byte absolute $ff0b;  //raser counter bits 0-7
  BORDER                             : byte absolute $ff19;
  VCOUNT                             : byte absolute $ff1d;  //vertical line bits 0-7
  IRQVEC                             : word absolute $fffe;

var
  tmp                                : byte absolute $ff;


procedure myRasterIrq; interrupt;
begin
  asm { phr };

  Inc(BORDER);
  tmp:= VCOUNT + 32; repeat until tmp = VCOUNT;
  Dec(BORDER);

  DETIRQSRC := DETIRQSRC and %01111111;
  asm { plr };
end;

begin
  pause;

  asm { sei \ sta $ff3f};

  RC := 204; SETIRQSRC := 2;
  DETIRQSRC := DETIRQSRC and %01111111;

  IRQVEC := word(@myRasterIrq);

  asm { cli };

  repeat until false;
end.

 

Edited by zbyti
typo
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...