FAQ  •  Register  •  Login

Collision attr routine.

<<

compiuter

Posts: 51

Joined: Mon May 10, 2010 10:47 pm

Post Sun Mar 06, 2011 10:50 pm

Collision attr routine.

I was thinking about any routines that get attr positions up, right, down and left for one character of x,y position.
-p-
qAr
-s-
And the same for a tile
-pq-
rABt
sCDu
-vw-
and poke those valours into printer buffer or into a variable address, etc.
I'm tired for repeat the same sentences IF ATTR in basic listing cause is a heavy job.
I have no time now, but if someone has free time for this and they want...
I think this can be a library called e.g. ATTTR.bas or ATTTR.asm
Thx.
<<

LCD

Posts: 571

Joined: Fri Feb 13, 2009 3:11 pm

Location: Vienna, Austria

Post Tue Mar 08, 2011 9:42 pm

Re: Collision attr routine.

Why not write a subroutine which pokes these values into printer buffer? Like: POKE buf,peek(attradr-32):POKE buf+1,peek(attradr-1):POKE buf+2,peek(attradr+1):POKE buf+3,peek(attradr+32). This is not standard BASIC function, and I don't think, it will be of any use for other users.
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
<<

compiuter

Posts: 51

Joined: Mon May 10, 2010 10:47 pm

Post Tue Mar 08, 2011 10:24 pm

Re: Collision attr routine.

Tanks, I was thinking in zx basic. Yours is a good system.
<<

boriel

Site Admin

Posts: 1281

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Tue Mar 08, 2011 11:06 pm

Re: Collision attr routine.

LCD wrote:Why not write a subroutine which pokes these values into printer buffer? Like: POKE buf,peek(attradr-32):POKE buf+1,peek(attradr-1):POKE buf+2,peek(attradr+1):POKE buf+3,peek(attradr+32). This is not standard BASIC function, and I don't think, it will be of any use for other users.


I have added AttrAddr(y, x) function in attr.bas library in the latest version 1.2.8r2139
I was thinking exactly the same:
  Code:
#include <attr.bas>

Sub GetAddr(y, x, buf)
    Dim attraddr as UInteger
    attradr = AttrAddr(y, x)
    POKE buf,peek(attradr-32)
    POKE buf+1,peek(attradr-1)
    POKE buf+2,peek(attradr+1)
    POKE buf+3,peek(attradr+32)
End Sub
<<

compiuter

Posts: 51

Joined: Mon May 10, 2010 10:47 pm

Post Wed Mar 09, 2011 4:20 pm

Re: Collision attr routine.

Thanks. :D
<<

compiuter

Posts: 51

Joined: Mon May 10, 2010 10:47 pm

Post Fri Mar 11, 2011 12:53 pm

Re: Collision attr routine.

I was testing the routine and trying news clock sense orientet and with diagonals, and proyected tile clock and diagonals version.
I find that e.g. peek 23400=111
and if in 23401 is filled with 222
then peek 23400+1 play 112 instead 222
Is It like Zx Basic or changed for the compiler?
<<

boriel

Site Admin

Posts: 1281

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Fri Mar 11, 2011 1:35 pm

Re: Collision attr routine.

compiuter wrote:I was testing the routine and trying news clock sense orientet and with diagonals, and proyected tile clock and diagonals version.
I find that e.g. peek 23400=111
and if in 23401 is filled with 222
then peek 23400+1 play 112 instead 222
Is It like Zx Basic or changed for the compiler?

Hmmm, try PEEK (23400 + 1) ?
<<

compiuter

Posts: 51

Joined: Mon May 10, 2010 10:47 pm

Post Sat Mar 12, 2011 2:33 pm

Re: Collision attr routine.

Here is my testing routines clock sense oriented.
I am thinking about use parameters for the sprite height and wide, and made a dinamyc routine for whatever typè of sprites.
updated 11-03-13
  Code:
#include <memcopy.bas>
#include <sinclair.bas>
#include <keys.bas>
#include <attr.bas>
'---CHARS-----------------------
'---GetAddr clock sense oriented ^>v<
cls
print 999
print 999
print 999
'the two ciphers of colour are
'combined file+column
poke 22528,11
poke 22528+1,12
poke 22528+2,13   
poke 22528+32,21
poke 22528+34,23
poke 22528+64,31
poke 22528+65,32
poke 22528+66,33
'GetAddr clock sense oriented ^>v<
  Sub GetAddr(y, x, buf)
      Dim attraddr as UInteger
      attradr = AttrAddr(y, x)
      POKE buf,peek(attradr-32)
      POKE buf+1,peek(attradr+1)
      POKE buf+2,peek(attradr+32)
      POKE buf+3,peek(attradr-1)
  End Sub
  GetAddr(1, 1, 23400)
Dim f1 As Ubyte
for f1=0 to 3
 print peek (23400+f1)
next f1
pause (0)
'----------------------------------------
'---GetAddrFull clock sense oriented ^>v<
cls
print 999
print 999
print 999
poke 22528,11
poke 22528+1,12
poke 22528+2,13
poke 22528+32,21
poke 22528+34,23
poke 22528+64,31
poke 22528+65,32
poke 22528+66,33
  Sub GetAddrFull(y, x, buf)
      Dim attraddr as UInteger
      attradr = AttrAddr(y, x)
      POKE buf,peek(attradr-32)
      POKE buf+1,peek(attradr-31)
      POKE buf+2,peek(attradr+1)
      POKE buf+3,peek(attradr+33)     
      POKE buf+4,peek(attradr+32)
      POKE buf+5,peek(attradr+31)
      POKE buf+6,peek(attradr-1)
      POKE buf+7,peek(attradr-33)
  End Sub
  GetAddrFull(1, 1, 23400)
Dim f2 As Ubyte
for f2=0 to 7
 print peek (23400+f2)
next f2
pause (0)
'---TILES-----------------------
'---GetAddrTile clock sense oriented ^>v<
cls
print 8888
print 8888
print 8888
print 8888
poke 22528+1,12
poke 22528+2,13
poke 22528+3+32,24
poke 22528+3+64,34
poke 22528+3+95,43
poke 22528+3+94,42
poke 22528+64,31
poke 22528+32,21
  Sub GetAddrTile(y, x, buf)
      Dim attraddr as UInteger
      attradr = AttrAddr(y, x)
      POKE buf,peek(attradr-32)
      POKE buf+1,peek(attradr-31)
      POKE buf+2,peek(attradr+2)
      POKE buf+3,peek(attradr+34)     
      POKE buf+4,peek(attradr+65)
      POKE buf+5,peek(attradr+64)
      POKE buf+6,peek(attradr+31)
      POKE buf+7,peek(attradr-1)
  End Sub
  GetAddrTile(1, 1, 23400)
Dim f3 As Ubyte
for f3=0 to 7
 print peek (23400+f3)
next f3
pause (0)
'---GetAddrTileFull
'---clock sense oriented ^>v<
cls
print 8888
print 8888
print 8888
print 8888
poke 22528,11
poke 22528+1,12
poke 22528+2,13
poke 22528+3,14
poke 22528+3+32,24
poke 22528+3+64,34
poke 22528+3+96,44
poke 22528+3+95,43
poke 22528+3+94,42
poke 22528+3+93,41
poke 22528+64,31
poke 22528+32,21
  Sub GetAddrTileFull(y, x, buf)
      Dim attraddr as UInteger
      attradr = AttrAddr(y, x)
      POKE buf,peek(attradr-32)
      POKE buf+1,peek(attradr-31)
      POKE buf+2,peek(attradr-30)
      POKE buf+3,peek(attradr+2)     
      POKE buf+4,peek(attradr+34)
      POKE buf+5,peek(attradr+34+32)
      POKE buf+6,peek(attradr+34+31)
      POKE buf+7,peek(attradr+34+30)
      POKE buf+8,peek(attradr+34+29)
      POKE buf+9,peek(attradr+2+29)
      POKE buf+10,peek(attradr-1)
      POKE buf+11,peek(attradr-33)
  End Sub
  GetAddrTileFull(1, 1, 23400)
Dim f4 As Ubyte
for f4=0 to 11
 print peek (23400+f4)
next f4
'pause (0)
end

Return to Wishlist

Who is online

Users browsing this forum: No registered users and 0 guests

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin for Free Forums/DivisionCore.

phpBB SEO