TRSE : adressen 4096 to 4602 with joy controll?

You need an actual VIC.

Moderator: Moderators

Post Reply
funkheld
Vic 20 Devotee
Posts: 241
Joined: Tue Sep 10, 2019 4:23 am

TRSE : adressen 4096 to 4602 with joy controll?

Post by funkheld »

Hi good afternoon.
I want from address 4096 to address 4602 from vic20
how can you set a pointer that addresses all 506 addresses??? i want to control the addresses with the taste A/S/D/W.

I can't get any further than 255.
but there are 506 addresses.


how does that work with trse?

greeting

Code: Select all

program schiebechar;

var
charset : array[16] of byte = ( 24,24,60,126,255,24,36,66);

a,b,f,x,y,p : byte;

zpcharz: pointer;
zpscr: pointer;
zpcol: pointer;

procedure  warte(t : byte);
begin
	for a:=0 to 50 do
	begin 	     
    wait(100);
  end;
end;

begin
  ClearScreen(white, screen_col_loc);
    
  zpcharz:=5120;
  zpscr:=4096;
  
  zpcol:=37888;
  
  poke(^37139,0,0);
  poke(^37154,0,127);
  poke(^36869,0,205);
  
  zpcharz:=5120;
	for b:=0 to 8 do
	begin
		zpcharz[b]:=charset[b];
	end;

  x:=11;
  y:=5;
  p:=y*22+x;
  f:=5;
  zpscr[p]:=0;
  zpcol[p]:=f;
		 
  while (true) do
	begin
	  waitforraster(0);
	  
    if peek(^197,0)= 18 then 
    begin
      warte(10);
      x:=x+1;
      if (x>21) then x:=21;
      p:=y*22+x;
      zpscr[p]:=0;
      zpcol[p]:=f;
      zpscr[p-1]:=128;
    end; 
    
    if peek(^197,0)= 17 then 
    begin
      warte(10);
      x:=x-1;
      if (x=255) then x:=0;
      p:=y*22+x;
      zpscr[p]:=0;
      zpcol[p]:=f;
      zpscr[p+1]:=128;
    end; 
    
   if peek(^197,0)= 41 then 
    begin
      warte(10);
      y:=y+1;
      if (y>10) then y:=10;
      p:=y*22+x;
      zpscr[p]:=0;
      zpcol[p]:=f;
      zpscr[p-22]:=128;
    end; 
    
   if peek(^197,0)= 9 then 
    begin
      warte(10);
      y:=y-1;
      if (y=255) then y:=0;
      p:=y*22+x;
      zpscr[p]:=0;
      zpcol[p]:=f;
      zpscr[p+22]:=128;
    end; 
     
    if peek(^197,0)= 10 then 
    begin
      warte(10);
      f:=f+1;
      if (f>7) then f:=7;
      zpcol[p]:=f;
    end;  
    
    if peek(^197,0)= 42 then 
    begin
      warte(10);
      f:=f-1;
      if (f=255) then f:=0;
      zpcol[p]:=f;
    end;  
  end; 
end.
User avatar
AndyH
Vic 20 Afficionado
Posts: 364
Joined: Thu Jun 17, 2004 5:51 am
Website: https://www.hewco.uk
Location: UK
Occupation: Developer

Re: TRSE : adressen 4096 to 4602 with joy controll?

Post by AndyH »

You can only address a byte for a pointer offset -

p1[ 0 ] := 1;
...
p1[ 255 ] := 1;

You will need to set the address p1 points to access any memory address. Take a look at the help for CreateAddressTable and AddressTable, then you can do something like:

Code: Select all

	p1:= AddressTable( addr, x, y);
        p1[0]:=1;
or

Code: Select all

	p1:= AddressTable( addr, 0, y);
        p1[ x ]:=1;
Which removes the need to add x to the p1 address, and uses sta (p1),y instead.

Recommend checking the ASM file your TRSE code produces to understand what method may work better for you.
--
AndyH
HEWCO | Vic 20 blog
funkheld
Vic 20 Devotee
Posts: 241
Joined: Tue Sep 10, 2019 4:23 am

Re: TRSE : adressen 4096 to 4602 with joy controll?

Post by funkheld »

hello, thanks for the info.

CreateAddressTable is very good.

greeting.
Post Reply