NintendoAge http://nintendoage.com/forum/ -Sqooner Background Horizontal Scrolling Buffer http://nintendoage.com/forum/messageview.cfm?catid=22&threadid=31898 2015-05-22T16:25:14 -05.00 bigjt_2 26
.Sprite0_testtwo
bit $2002
bvc .Sprite0_testtwo

I can't move the screen, the level loads but the first tile in the metatile isn't displayed, and random garbage keeps going into the stack.

I re-wrote the engine so that it was formatted in a way I like. I've thoroughly compared my code to the original code several times and I didn't find any mistakes on my part so I'm either doing something wrong with the sprite0hit, or the offscreen_buffer_tables.i needs to be changed. If someone could help me, I'd greatly appreciate it. ]]>
Background Horizontal Scrolling Buffer http://nintendoage.com/forum/messageview.cfm?catid=22&threadid=31898 2015-05-21T09:53:58 -05.00 bigjt_2 26 Originally posted by: user

Originally posted by: GreenMonkey

Could someone explain the Offscreen_buffer_tables.i to me? When I try and implement my own metatiles, and leave the file alone, it causes the assembler to freak out and throw a bunch of errors.

Not sure this is what you are looking for, but maybe this could help:

 http://www.nintendoage.com/forum/...

Cheers!


It may not have anything to do with the buffer file, but I've been attempting to modify the engine to work with my graphics. I replaced the Mario chr file with my own chr file, and reprogrammed my own metatiles and levels, but when I assemble the program it says it doesn't recognize any of the variables (leftright, sleeping, soft_2000, etc. And even all the .word's and .db's, they all say something like "UNDEFINED". I don't know why this is but I thought it may have something to do with the buffer file since that's the only thing I didn't change, and I don't really know how it works. ]]>
Background Horizontal Scrolling Buffer http://nintendoage.com/forum/messageview.cfm?catid=22&threadid=31898 2015-05-20T20:08:54 -05.00 bigjt_2 26 Originally posted by: GreenMonkey

Could someone explain the Offscreen_buffer_tables.i to me? When I try and implement my own metatiles, and leave the file alone, it causes the assembler to freak out and throw a bunch of errors.
Not sure this is what you are looking for, but maybe this could help:

 http://www.nintendoage.com/forum/messageview.cfm?catid=22&threadid=36958

Cheers! ]]>
Background Horizontal Scrolling Buffer http://nintendoage.com/forum/messageview.cfm?catid=22&threadid=31898 2015-05-20T20:03:43 -05.00 bigjt_2 26 Background Horizontal Scrolling Buffer http://nintendoage.com/forum/messageview.cfm?catid=22&threadid=31898 2010-04-27T12:56:07 -05.00 bigjt_2 26
For whatever reason I couldn't implement the concept of capping the buffer to keep it from drawing every frame.  At first I thought I got it, but then when I started trying to do it in code I just couldn't get it.  What I settled on was a quick test in the main asm called drawTest that basically tests if the player moves and then sets a flag so that the code in the game loop loads up the buffer and the appropriate loading subs in the NMI section run.  I'm not sure if that's a huge improvement.  Now it only draws if the player moves, but it's still drawing quite a bit.  Tried working with it so it only drew if the player moved more than eight pixels right or left, but that led to some bugs.

Still, a lot of fat was trimmed thanks to everyone's input, so I appreciate it.
]]>
Background Horizontal Scrolling Buffer http://nintendoage.com/forum/messageview.cfm?catid=22&threadid=31898 2010-04-23T12:23:16 -05.00 bigjt_2 26 Originally posted by: bigjt_2

You never know when my company and its clients will get annoying and actually expect me to be productive, though. ;-)I know how you feel.  What a bunch of bastards. 


]]>
Background Horizontal Scrolling Buffer http://nintendoage.com/forum/messageview.cfm?catid=22&threadid=31898 2010-04-23T11:35:22 -05.00 bigjt_2 26 Background Horizontal Scrolling Buffer http://nintendoage.com/forum/messageview.cfm?catid=22&threadid=31898 2010-04-23T07:38:49 -05.00 bigjt_2 26 Background Horizontal Scrolling Buffer http://nintendoage.com/forum/messageview.cfm?catid=22&threadid=31898 2010-04-23T02:48:27 -05.00 bigjt_2 26 Originally posted by: bigjt_2

Number two took me a minute but I started plugging in the numbers to my programming calc and see how it works now. I haven't played around too much yet with using flag bits instead of flag bytes, but am gradually seeing how they work. Basically what it seems I need to do is add a BIT test in the part where it's reading from background.i and use an AND to read from bit 7. If bit 7 is one, jump to RLE, if it's 0, write the matatile into RAM and jump to next byte. That's pretty cool! Obviously this means you can't have any more than 128 metatiles on any one list, because after $7F (decimal 127) the test bit for RLE would always be set and you'd always jump to RLE. How do you usually get around this? Actually, have you ever needed to in the first place? Upon thinking about it it seems that's a lot of metatiles, but then this demo is pretty simple and it uses 25, so I'm guessing the number can add up pretty quick. Do you simply jump to different metatile indexes if the number gets too high?

It's worthwhile to learn bit testing. It can save you a lot of space.  To do it, you use AND.  AND works like this on a bit level:

0 AND 0 = 0
1 AND 0 = 0
0 AND 1 = 0
1 AND 1 = 1

To bit test, you use AND to clear all of the bits except the one you are checking.  If the result is 0, your bit was off.  If the result is non-zero, your bit is on.  To check bit7 you'd AND with #%10000000.  To check bit0 you'd AND with #%00000001.  For bit4:

lda some_number
and #%00010000  ;check bit4
bne bit_was_on    ;if non-zero, the bit was on (1 AND 1 gives you a 1, everything else is 0'ed)

so if you had an RLE flag in bit 7:

    lda [ptr], y   ;read a byte from buffer
    and #%10000000  ;check bit7
    bne @rle         ;if non-zero, we have rle
...;snip
@rle:
   lda [ptr], y  ;re-read byte
   and #%01111111 ;cut off the rle bit to get the metatile #.

And yes, stealing a bit would limit you to 127 (128?) metatiles.  You could have different sets for different levels to get around this though.
]]>
Background Horizontal Scrolling Buffer http://nintendoage.com/forum/messageview.cfm?catid=22&threadid=31898 2010-04-22T16:40:17 -05.00 bigjt_2 26
Your code is looking pretty good. ]]>