Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Collision attr routine.
#1
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.
Reply
#2
Why not write a subroutine which pokes these values into printer buffer? Like: POKE buf,peek(attradr-32)TongueOKE buf+1,peek(attradr-1)TongueOKE buf+2,peek(attradr+1)TongueOKE 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!
Reply
#3
Tanks, I was thinking in zx basic. Yours is a good system.
Reply
#4
LCD Wrote:Why not write a subroutine which pokes these values into printer buffer? Like: POKE buf,peek(attradr-32)TongueOKE buf+1,peek(attradr-1)TongueOKE buf+2,peek(attradr+1)TongueOKE 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
Reply
#5
Thanks. Big Grin
Reply
#6
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?
Reply
#7
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) ?
Reply
#8
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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)