The following warnings occurred:
Warning [2] Undefined array key 0 - Line: 1677 - File: showthread.php PHP 8.2.31 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/showthread.php 1677 errorHandler->error_callback
/showthread.php 916 buildtree




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PutTile16x16 Pixels + Attributes
#1
This will put Tiles of 2x2 characters with attributes on screen, and is not restricted to use a particular number of tiles, as it uses a memory pointer to the adress of tile in memory, and it is almost fast enough for games (until someone will write a ASM version)
Note: Lines(23) is used for screen adress calculation. I used only 24 bytes for this table (without bAND function I need a Table for this). not using a array but InLine ASM DEFB data can save 3 bytes.
POKE and PEEK UINTEGER use two-Byte transfer, so this is much faster than transfer of a single byte.
Screen adress calculation is splited (so variable A had to be created) because of a calculation problem. Usualy I would write these lines:
Code:
a=peek(@lines+y+3) scr=(a<<5)+x+16384
as:
Code:
scr=peek(@lines+y+3)<<5+x+16384
but it does not work (yet)
also if y is not uinteger but ubyte type, scr value is calculated wrong, so even if y is in range of ubyte, do not change it as binary shifts on Ubyte also results in a ubyte.

Code:
Dim lines(23) As uByte => { _ 0,1,2,3,4,5,6,7,64,65,66,67,68,69,70,71,128,129,130,131,132,133,134,135 } sub puttile(x as Uinteger,y as Uinteger,adr as Uinteger) dim scr as Uinteger dim a as Uinteger a=peek(@lines+y+3) scr=(a<<5)+x+16384 poke Uinteger scr,peek(Uinteger,adr) poke Uinteger scr+256,peek(Uinteger,adr+2) poke Uinteger scr+512,peek(Uinteger,adr+4) poke Uinteger scr+768,peek(Uinteger,adr+6) poke Uinteger scr+1024,peek(Uinteger,adr+8) poke Uinteger scr+1280,peek(Uinteger,adr+10) poke Uinteger scr+1536,peek(Uinteger,adr+12) poke Uinteger scr+1792,peek(Uinteger,adr+14) poke Uinteger 22528+x+(y<<5),peek(Uinteger,adr+32) a=peek(@lines+y+4) scr=(a<<5)+x+16384 poke Uinteger scr,peek(Uinteger,adr+16) poke Uinteger scr+256,peek(Uinteger,adr+18) poke Uinteger scr+512,peek(Uinteger,adr+20) poke Uinteger scr+768,peek(Uinteger,adr+22) poke Uinteger scr+1024,peek(Uinteger,adr+24) poke Uinteger scr+1280,peek(Uinteger,adr+26) poke Uinteger scr+1536,peek(Uinteger,adr+28) poke Uinteger scr+1792,peek(Uinteger,adr+30) poke Uinteger 22560+x+(y<<5),peek(Uinteger,adr+34) End sub dim x,y as ubyte dim adr as Uinteger adr=0 for y=0 to 11 for x=0 to 15 puttile(x<<1,y<<1,adr) 'adr=adr+36 next x next y end
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)