Jump to content
IGNORED

MAD Pascal : 4 lines of text a displayList.


Recommended Posts

hello, good day.

4 lines of text a displayList.


greeting.




var
dlist: array [0..110] of byte;
dl_idx: word;
screen: word;
z: 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($42);DLWord($bc40);
DLByte($02);DLByte($02);DLByte($02);
DLByte($41); DLWord(a);
end;

begin
dl_idx:= word(@dlist);

InitDlist(word(@dlist));

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

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

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

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

Poke(36960,129);
Poke(36961,255);
Poke(36962,129);

for z:=0 to 240 do begin
DPoke($bc40+z,z);
end;

repeat
until keypressed;
end.

post-31221-0-87971200-1438254243_thumb.jpg

Link to comment
Share on other sites

 

hello, good day.
4 lines of text a displayList.
greeting.
 
var
dlist: array [0..110] of byte;
  dl_idx: word;
  screen: word;
  z: 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($42);DLWord($bc40);
  DLByte($02);DLByte($02);DLByte($02);
  DLByte($41); DLWord(a);
end;
 
begin
  dl_idx:= word(@dlist);
  
  InitDlist(word(@dlist));
  
  InitGraph(7);   
  DPoke(560,word(@dlist));
  DPoke($58,36960);
  
  SetColor(1);
  MoveTo(0,0);
  LineTo(159,95);
  
  SetColor(2);
  MoveTo(159,0);
  LineTo(0,95);
  
  SetColor(3);
  Circle(80,48,45);
  
  Poke(36960,129);
  Poke(36961,255);
  Poke(36962,129);
 
  for z:=0 to 240 do begin
    DPoke($bc40+z,z);
  end;
  
  repeat
  until keypressed;
end.

 

 

Hi,

 

copy and paste your example, I found 2 strange things:

 

1. Few Dots in the upper left corner, remove it by deleting the following lines

Poke(36960,129);
Poke(36961,255);
Poke(36962,129);

2. I do not circle appears.

greetings

post-11721-0-44268700-1438258520_thumb.png

Edited by ascrnet
Link to comment
Share on other sites

the poke is to test for the beginning address: 36960 :


Poke(36960,129);

Poke(36962,255);

Poke(36964,129);

it works for me with the circle.


The photo above is from the MIST and the VGA monitor and one photo from altirra-emu.


greeting




var
dlist: array [0..110] of byte;
dl_idx: word;
screen: word;
z: 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($42);DLWord($bc40);
DLByte($02);DLByte($02);DLByte($02);
DLByte($41); DLWord(a);
end;

begin
dl_idx:= word(@dlist);

InitDlist(word(@dlist));

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

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

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

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

SetColor(3);
Circle(80,48,25);

Poke(36960,129);
Poke(36962,255);
Poke(36964,129);

for z:=0 to 140 do begin
DPoke($bc40+z,z);
end;

repeat
until keypressed;
end.


post-31221-0-92852700-1438262776_thumb.jpg

post-31221-0-63782500-1438262783_thumb.jpg

  • Like 1
Link to comment
Share on other sites

also works with an array !


greeting





var
dlist: array [0..52] of word;

procedure InitDlist(a: word);
begin
dlist[0]:=$7070; dlist[1]:=$4d70;
dlist[2]:=$9060;
dlist[3]:=$0d0d; dlist[4]:=$0d0d; dlist[5]:=$0d0d; dlist[6]:=$0d0d;dlist[7]:=$0d0d;
dlist[8]:=$0d0d; dlist[9]:=$0d0d; dlist[10]:=$0d0d; dlist[11]:=$0d0d;dlist[12]:=$0d0d;
dlist[13]:=$0d0d; dlist[14]:=$0d0d; dlist[15]:=$0d0d; dlist[16]:=$0d0d;dlist[17]:=$0d0d;
dlist[18]:=$0d0d; dlist[19]:=$0d0d; dlist[20]:=$0d0d; dlist[21]:=$0d0d;dlist[22]:=$0d0d;
dlist[23]:=$0d0d; dlist[24]:=$0d0d; dlist[25]:=$0d0d; dlist[26]:=$0d0d;dlist[27]:=$0d0d;
dlist[28]:=$0d0d; dlist[29]:=$0d0d; dlist[30]:=$0d0d; dlist[31]:=$0d0d;dlist[32]:=$0d0d;
dlist[33]:=$0d0d; dlist[34]:=$0d0d; dlist[35]:=$0d0d; dlist[36]:=$0d0d;dlist[37]:=$0d0d;
dlist[38]:=$0d0d; dlist[39]:=$0d0d; dlist[40]:=$0d0d; dlist[41]:=$0d0d;dlist[42]:=$0d0d;
dlist[43]:=$0d0d; dlist[44]:=$0d0d; dlist[45]:=$0d0d; dlist[46]:=$0d0d;dlist[47]:=$0d0d;
dlist[48]:=$0d0d; dlist[49]:=$0d0d; dlist[50]:=$0d41;
dlist[51]:=a;
end;

begin
InitDlist(word(@dlist));

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

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

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

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

Poke(36960,129);
Poke(36961,255);
Poke(36962,129);

repeat
until keypressed;

fillchar(pointer($9060), $f00, 255);

repeat
until keypressed;
end.

Edited by funkheld
Link to comment
Share on other sites

PM from Stargunner with my array-displayList




const
_max = 7;
_speed = 40;

var
dlist: array [0..52] of word;

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

procedure InitDlist(a: word);
begin
dlist[0]:=$7070; dlist[1]:=$4d70;
dlist[2]:=$9060;
dlist[3]:=$0d0d; dlist[4]:=$0d0d; dlist[5]:=$0d0d; dlist[6]:=$0d0d;dlist[7]:=$0d0d;
dlist[8]:=$0d0d; dlist[9]:=$0d0d; dlist[10]:=$0d0d; dlist[11]:=$0d0d;dlist[12]:=$0d0d;
dlist[13]:=$0d0d; dlist[14]:=$0d0d; dlist[15]:=$0d0d; dlist[16]:=$0d0d;dlist[17]:=$0d0d;
dlist[18]:=$0d0d; dlist[19]:=$0d0d; dlist[20]:=$0d0d; dlist[21]:=$0d0d;dlist[22]:=$0d0d;
dlist[23]:=$0d0d; dlist[24]:=$0d0d; dlist[25]:=$0d0d; dlist[26]:=$0d0d;dlist[27]:=$0d0d;
dlist[28]:=$0d0d; dlist[29]:=$0d0d; dlist[30]:=$0d0d; dlist[31]:=$0d0d;dlist[32]:=$0d0d;
dlist[33]:=$0d0d; dlist[34]:=$0d0d; dlist[35]:=$0d0d; dlist[36]:=$0d0d;dlist[37]:=$0d0d;
dlist[38]:=$0d0d; dlist[39]:=$0d0d; dlist[40]:=$0d0d; dlist[41]:=$0d0d;dlist[42]:=$0d0d;
dlist[43]:=$0d0d; dlist[44]:=$0d0d; dlist[45]:=$0d0d; dlist[46]:=$0d0d;dlist[47]:=$0d0d;
dlist[48]:=$0d0d; dlist[49]:=$0d0d; dlist[50]:=$0d41;
dlist[51]:=a;
end;

begin
InitDlist(word(@dlist));

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

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

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

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

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

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,2); // 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.

Edited by funkheld
Link to comment
Share on other sites

Can't you do something like this? Syntax may be slightly off here but you shouldn't have to assign every array element one at a time on that.

 

Set up your default display list array:

Const dlist:Array [0..52] Of word = (
  $7070,$4d70,$9060,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,  
  $0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,
  $0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,
  $0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d41,$0000 
);
InitDList:

dlist[51] := word(@dlist);
*edit*

You should double check the values in the array to make sure I didn't corrupt the data.

 

An explanation of why this should work

http://stackoverflow.com/questions/3240689/why-pascal-const-arrays-arent-actually-constants

Edited by JamesD
Link to comment
Share on other sites

Does every $0d have to be assigned in the source at compile time? (either explicit array element assignment or array declaration)

 

Couldn't it work with a loop assigning array elements at run time? (less typing).

 

How does pascal keep the array space from crossing over the 1K display list boundary limit? Or have the working examples just been lucky up to this point ?

  • Like 1
Link to comment
Share on other sites

Can't you do something like this? Syntax may be slightly off here but you shouldn't have to assign every array element one at a time on that.

 

Set up your default display list array:

Const dlist:Array [0..52] Of word = (
  $7070,$4d70,$9060,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,  
  $0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,
  $0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,
  $0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d0d,$0d41,$0000 
);
InitDList:

dlist[51] := word(@dlist);
*edit*

You should double check the values in the array to make sure I didn't corrupt the data.

 

An explanation of why this should work

http://stackoverflow.com/questions/3240689/why-pascal-const-arrays-arent-actually-constants

 

Actually, should wasn't the proper word. I should have said might.

It doesn't. It's a Turbo Pascal extension to the language that we used in college.

Link to comment
Share on other sites

This syntax works in Turbo Pascal and Free Pascal. Obviously MAD Pascal currently doesn't support such way of assigning arrays. But this language made great step in evolving considering it is first version published. This language already has many features and ways of doing things. It can easily be on par with Action!, cc65 and other high level languages for Atari 8-bit computers.

 

When it brings us file support and some other candies like CASE, COPY (substring) and other string routines, etc., it will become even more powerful.

  • Like 2
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...