It is currently Mon Dec 18, 2017 2:10 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 18 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Fri Jan 20, 2017 1:36 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5899
Location: Canada
There are no constants in psychopathicteen's code (a constant would be preceded by an #).

tokumaru's binary number annotation is trying to illustrate an example of how it works step by step, filling in the various variables with an example as he would have generated them (which is different from how you have generated them in your program, but not in an important way)


Top
 Profile  
 
PostPosted: Fri Jan 20, 2017 2:32 am 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10172
Location: Rio de Janeiro - Brazil
rainwarrior wrote:
tokumaru's binary number annotation is trying to illustrate an example of how it works step by step, filling in the various variables with an example as he would have generated them

Exactly, it was just a test to see if the trick really worked, so I picked some arbitrary values for the variables.

As for shifting or not shifting the metatile's attribute data, that comes down to how you store it in the ROM. Many engines will dedicate only 2 bits for defining a metatile's palette index, but I personally prefer to store 4 copies of the same palette index in a byte, so I don't need to spend any time shifting (or deciding how many times to shift) those 2 bits into the correct place. ROM is not so scarce these days, I think I can afford 6 redundant bits per metatile if that will simplify and speed up attribute processing.


Top
 Profile  
 
PostPosted: Fri Jan 20, 2017 5:17 pm 
Offline
User avatar

Joined: Fri Feb 27, 2009 2:35 pm
Posts: 215
Location: Fort Wayne, Indiana
I set aside a whole byte for attributes too. Makes filling the attributes for scrolling really easy:
Code:
  ; top left corner of attribute byte
  lda (LeftPointer),y
  tax
  lda MetatilePalettes,x
  and #%00000011
  sta Temp

  ; top right corner of attribute byte
  lda (RightPointer),y
  tax
  lda MetatilePalettes,x
  and #%00001100
  ora Temp
  sta Temp
  iny

  ; bottom left corner of attribute byte
  lda (LeftPointer),y
  tax
  lda MetatilePalettes,x
  and #%00110000
  ora Temp
  sta Temp

  ; bottom right corner of attribute byte
  lda (RightPointer),y
  tax
  lda MetatilePalettes,x
  and #%11000000
  ora Temp
  iny


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ]  Go to page Previous  1, 2

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group