Jump to content
IGNORED

Mad Pascal


Recommended Posts

Hello, thanks.

 

the not print:

numc:=-27234;

this print 38302 ???

 

greeting.

 

 

var
numb : byte; 
  numw : word;
  numc : cardinal;
  numr : real;
  
begin
ClrScr;
TextColor(15); 
  
  numb:=134;
  numw:=54678;
  numc:=-27234;
  numr:=123.345;
  
GotoXY(1,1);
write(numb);
  
  GotoXY(1,3);
write(numw);
  
  GotoXY(1,5);
write(numc);
  
  GotoXY(1,7);
write(numr);
  
repeat 
until keypressed;
end.
Link to comment
Share on other sites

 

Hi, Thank You.
One question all run these commands with the "MAD Pascal":
Thank You.

 

 

Predefined:

SIZEOF
WRITE
WRITELN
INC
DEC
CHR
ORD
ASM
IF ELSE THEN
FOR TO DO
WHILE DO
REPEAT UNTIL
DIV
OR
AND
XOR
SHR
SHL
CRT.PAS
TextMode
TextBackground
TextColor
Delay
Keypressed
ClrScr
GotoXY
WhereX
WhereY
GRAPH.PAS
InitGraph
SetBkColor
SetColor
PutPixel
MoveTo
LineTo
Line
FloodFill (not working)
Circle
MATH.PAS
Round
Trunc
Frac
IntToReal
SYSTEM.PAS
Poke
DPoke
Peek
DPeek
Random
Fillchar
Move
Edited by tebe
Link to comment
Share on other sites

 

Hello, thanks.

 

the not print:

numc:=-27234;

this print 38302 ???

 

greeting.

 

BYTE (0..255)

WORD( 0..65535)

CARDINAL (0..4294967295)

REAL (-8388607..8388607)

 

if you want test SIGN

if (a and $80<>0) then MINUS        // for BYTE
if (a and $8000<>0) then MINUS      // for WORD
if (a and $800000 <> 0) then MINUS  // for CARDINAL
Edited by tebe
Link to comment
Share on other sites

Hello, ASM ist wonderfull mit MAD Pascal.

procedure scrasm;
begin
asm
{ lda #35
  sta $bc40
  lda #36
  sta $bc41
  lda #37
  sta $bc42
};
end;
  
begin
  ClrScr;
 
  scrasm;
  
repeat 
until keypressed;
end.

 

Don't you need to preserve the previous content of A in that assembly?
Link to comment
Share on other sites

fpc -Mtp filename.pas

// Show colors
// AsCrNet
 
uses crt;
 
var
num : byte; 
 
begin
ClrScr;
TextColor(15); 
repeat 
            num := Random(255);
            TextBackground(num);
 
            GotoXY(14,9);
            write('Show colors');
 
            Delay(900);
until keypressed;
end.

run application on PC and XE/XL :)

 

:-o I had not thought of making it compatible with PC, thanks for example. :thumbsup:

 

but I thought that in the future, having more typical of ATARI features like these players and missiles, display list, array handling, handling of controls such as joystick, light pen, etc ... easy to use, I can think of something like library for PM:

 

uses PM;

CreatePM (pm);
ColorPM (pm, color);
MovePM (x, y, pm);
CollisionPM (pm);

regards

Link to comment
Share on other sites

only regX is important, it's used for stack (STACKORIGIN, STACKWIDTH)

 

in asm full access for local, global variables, constants (by their names)

 

RESULT is predefined variable for FUNCTION

function add(a,b: byte): word;
begin
asm
{  lda a
   clc
   adc b
   sta Result
   lda #0
   adc #0
   sta Result+1
};
end;
 
begin
  writeln( add(150,200) );
end;
Edited by tebe
Link to comment
Share on other sites

I'm having difficulties compiling PasIntro. Mp105 completes OK and generates PasIntro.a65. However, Mads assembler complains about these instructions within PasIntro.a65.

 

bne @-

bne @+

 

I compiled PasIntro via linux (32-bit system)/wine and I've tried Mads Assember version 1.9.4 and 1.9.8.

 

-SteveS

 

p.s Same issues with Gury's PMG demos.

 

p.p.s. I forgot to provide the error message from Mads assembler.

 

bne @+

pasintro.a65 (389) ERROR: Unexpected end of line

Edited by a8isa1
Link to comment
Share on other sites

hello, I have brought the pm of Stargunner in my dplist.

the dplist starts at $ 9060 the pm at $ A800.

to get screen mem = $ BC40 not in crash.



the demo is the from my MIST.


greeting




const
_max = 7;
_speed = 40;

var
dlist: array [0..110] of byte;
dl_idx: word;
screen: word;

p0Data : array [0.._max] of byte;
px0 : byte;
py0 : byte;
pmgMem : Word;
i : Byte;

procedure DLByte(a: byte);
begin
Poke(dl_idx, a);
inc(dl_idx);
end;

procedure DLWord(a: word);
begin
DPoke(dl_idx, a);
inc(dl_idx, 2);
end;

procedure InitDlist(a: word);
begin
DLByte($70); DLByte($70); DLByte($70); DLByte($4d);
DLWord(36960);
DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);
DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);
DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);
DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);
DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);
DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);
DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);
DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);
DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);
DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);DLByte($0d);
DLByte($41); DLWord(a);
end;

begin
dl_idx:= word(@dlist);

InitDlist(word(@dlist));

InitGraph(7);
DPoke(560,word(@dlist));
DPoke($58,36960);

Poke(709, 64);
Poke(710, 122);
Poke(712, 130);
Poke(752, 1);

SetColor(1);
MoveTo(0,0);
LineTo(159,95);

SetColor(2);
MoveTo(159,0);
LineTo(0,95);

SetColor(3);
Circle(80,50,45);

// Initialize P/M graphics
Poke(53277, 0);

Poke(54279, 168);
pmgMem := 168 * 256;
Poke(559, 46);

px0 := 120; py0 := 60;

p0Data[0] := 48;
p0Data[1] := 120;
p0Data[2] := 252;
p0Data[3] := 48;
p0Data[4] := 48;
p0Data[5] := 48;
p0Data[6] := 48;
p0Data[7] := 48;

// Clear player 0 memory
fillchar(pointer(pmgMem+512), 128, 0);

// Vertical position of player 0
for i := 0 to _max do begin
Poke(pmgMem+512+py0+i, p0Data[i]);
end;

Poke(53277,3); // Turn on P/M graphics
Poke(53256,0); // Size of player 0 (normal size)
Poke(704,44); // Player 0 color
Poke(53248,px0); // Horizontal position of player 0

repeat
// Move player 0 left
if Peek(632)=11 then begin
Dec(px0);
if px0 < 45 then px0 := 45;
Poke(53248,px0);
Delay(_speed);

// Move player 0 right
end else if Peek(632)=7 then begin
Inc(px0);
if px0 > 203 then px0 := 203;
Poke(53248,px0);
Delay(_speed);

// Move player 0 up
end else if Peek(632)=14 then begin
Dec(py0);
if py0 < 16 then py0 := 16;
Poke(pmgMem+512+py0-1, 0);
Poke(pmgMem+512+py0+_max+1, 0);
for i := 0 to _max do begin
Poke(pmgMem+512+py0+i, p0Data[i]);
end;
Delay(_speed-;

// Move player 0 down
end else if Peek(632)=13 then begin
Inc(py0);
if py0 > 97+8 then py0 := 97+8;
Poke(pmgMem+512+py0-1, 0);
Poke(pmgMem+512+py0+_max+1, 0);
for i := 0 to _max do begin
Poke(pmgMem+512+py0+i, p0Data[i]);
end;
Delay(_speed-;
end;
until keypressed;

InitGraph(0);
Poke(53277, 0);
end.

post-31221-0-17731900-1438193276_thumb.jpg

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...