Jump to content
IGNORED

MAD-Pascal : PM-Collision with Picture


Recommended Posts

Hello, good day.

Here is the PM-Collison with Picture.

 

atari.hea:
...........
iocb = $340 ; IOCB
iocom = iocb+2 ; Komenda dla IOCB
ioadr = iocb+4 ; (2) Adres bufora dla IOCB
iolen = iocb+8 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>!!!!!! new
ioaux1 = iocb+10 ; Bajt pomocniczy 1 IOCB
ioaux2 = iocb+11 ; Bajt pomocniczy 2 IOCB
.......
greeting
const
  _max = 7;     
  _speed = 200;  
  
var
dlist: array [0..52] of word;
  p0Data : array [0.._max] of byte;
  
  px0 : byte; 
  py0 : byte;  
  pmgMem : Word;
  i : Byte;
  name: string;
  scr,lenght,namew: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;
 
procedure fileget(namew,scr,lenght:word);
begin
asm
{ 
  stx @sp
  ldx #$10
  lda #12 
  sta iocom,x
  jsr ciov
 
  ldx #$10  
  lda #3 
  sta iocom,x
  mwa namew ioadr,x
  lda #4 
  sta ioaux1,x
  jsr ciov
  
  ldx #$10
  lda #7 
  sta iocom,x
  mwa scr ioadr,x
  mwa lenght iolen,x
  jsr ciov
  
  ldx #$10
  lda #12 
  sta iocom,x
  jsr ciov
 
  ldx @sp
  rts
};
end;
 
begin
  InitDlist(word(@dlist));
  
  InitGraph(7);   
  DPoke(560,word(@dlist));
  DPoke($58,36960);
  
  name:='D:MULBI.BIN';
  namew:=word(@name);
  scr:=$9060;
  lenght:=$f00;
  
  fileget(namew,scr,lenght);
 
  // Initialize P/M graphics
  Poke(53277, 3);
 
  Poke(54279, 168);    
  pmgMem := 168 * 256;
  Poke(559, 46);
 
  px0 := 40; py0 := 40;
  
  p0Data[0] := $ff;
  p0Data[1] := $81;
  p0Data[2] := $81;
  p0Data[3] := $81;
  p0Data[4] := $81;
  p0Data[5] := $81;
  p0Data[6] := $81;
  p0Data[7] := $ff;
 
  // 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;
    
    if peek($D004) > 0 then begin
      Poke($D01E,1);
      
      fillchar(pointer(pmgMem+512), 128, 0);
      px0 := 40; py0 := 40;
      for i := 0 to _max do begin
        Poke(pmgMem+512+py0+i, p0Data[i]);
      end;
      Poke(53248,px0);
    end;
  until keypressed;
 
  InitGraph(0);
  Poke(53277, 0);
end.

alles.atr

Edited by funkheld
Link to comment
Share on other sites

Hi funkheld, nice example. A simple "Don't touch" game example :)

 

You can change:

 

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

 

to

 

Move(@p0Data, pointer(pmgMem+512+py0), _max+1)
It's more efficient and faster!
Greetings
Link to comment
Share on other sites

Hello.

here is the new PM with :

Move(@p0Data, pointer(pmgMem+512+py0), _max+1);


and


open(namew) >>>>> Kanal 1

bget(scr,lenght)

close >>>>> Kanal 1


greeting




const
_max = 7;
_speed = 200;

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

px0 : byte;
py0 : byte;
pmgMem : Word;
i : Byte;
name: string;
scr,lenght,namew: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;

procedure close;
begin
asm
{
stx @sp
ldx #$10
lda #12
sta iocom,x
jsr ciov
ldx @sp
rts
};
end;

procedure open(namew:word);
begin
asm
{
stx @sp
ldx #$10
lda #3
sta iocom,x
mwa namew ioadr,x
lda #4
sta ioaux1,x
jsr ciov
ldx @sp
rts
};
end;

procedure bget(scr,lenght:word);
begin
asm
{
stx @sp
ldx #$10
lda #7
sta iocom,x
mwa scr ioadr,x
mwa lenght iolen,x
jsr ciov
ldx @sp
rts
};
end;

begin
InitDlist(word(@dlist));

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

name:='D:MULBI.BIN';
namew:=word(@name);
scr:=$9060;
lenght:=$f00;

open(namew);
bget(scr,lenght);
close;

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

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

px0 := 40; py0 := 40;

p0Data[0] := $ff;
p0Data[1] := $81;
p0Data[2] := $81;
p0Data[3] := $81;
p0Data[4] := $81;
p0Data[5] := $81;
p0Data[6] := $81;
p0Data[7] := $ff;

// 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);
Move(@p0Data, pointer(pmgMem+512+py0), _max+1);
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);
Move(@p0Data, pointer(pmgMem+512+py0), _max+1);
Delay(_speed- ;
end;

if peek($D004) > 0 then begin
Poke($D01E,1);

fillchar(pointer(pmgMem+512), 128, 0);
px0 := 40; py0 := 40;
Move(@p0Data, pointer(pmgMem+512+py0), _max+1);
Poke(53248,px0);
end;
until keypressed;

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

Edited by funkheld
Link to comment
Share on other sites

 

how can you :
bput (scr, lenght); ? with MAD Pascal: ASM
It need only a new file will be created ?
How does it work ?
Open (.....)
BPUT (scr, lenght)
close
greeting

 

Are you saying you want to create a new file and haven't been able to or that you have only been able to create a new file rather than writing to an existing one?

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

  • Recently Browsing   0 members

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