lucienEn Posted January 8 Share Posted January 8 (edited) Hi, I noticed a lot of sample code (including generated code from 2600 builder) ignores the first byte of the data since they use bne to exit the loop. Or instead they wait for 0 in the data block but that's unpredictable length and wastes 1 byte. I found I could just use the start address -1. It works fine so far but any downsides with this below (or use bmi but that's limited to 127 height): ldx #10 Kernel1_Loop sta WSYNC sta HMOVE lda colubk_data-1, x ; this will load data in range colubk_data .. colubk_data+9 sta COLUBK dex bne Kernel1_Loop Lucien Edited January 8 by lucienEn Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted January 8 Share Posted January 8 -1 is fine Quote Link to comment Share on other sites More sharing options...
lucienEn Posted January 8 Author Share Posted January 8 Great, thanks! Quote Link to comment Share on other sites More sharing options...
+splendidnut Posted January 8 Share Posted January 8 Since this is being used in a display kernel, don't forget to watch out for page-crossing issues (extra cycle penalty throwing off timing). Quote Link to comment Share on other sites More sharing options...
lucienEn Posted January 9 Author Share Posted January 9 19 hours ago, splendidnut said: Since this is being used in a display kernel, don't forget to watch out for page-crossing issues (extra cycle penalty throwing off timing). I wonder how this syntax works looking at 2600 builder: if >. != >[.+(playfield_lines)] align 256 endif So maybe the '>' looks at the high byte and compares that to high byte of the playfield lines? What is the [.+?...] meaning? Quote Link to comment Share on other sites More sharing options...
+splendidnut Posted January 9 Share Posted January 9 Here are the meanings behind the symbols: '>' says look at the high byte '.' is the current address in the assembly file '[ ]' work just like parenthesis... they give an alternative due to 6502 assembly typically using ( ) to imply indirect addressing mode when used in an instruction. '[.+(playfield_lines)]' is current address '.' + 'playfield_lines' label address or EQU value I believe I got everything correct, please let me know if I messed up anything. Looking at the example code, it's not entirely clear what playfield_lines refers to. If I had to take a guess, 'playfield_lines' refers to the number of lines in (size of) the data table that immediately follows the if...endif construct. If that is true: - The example code would make sure the table is within a page... and if it crosses a page boundary, it would align it to the next one (force it to start at the beginning of the next one). - You would still need to handle the case of -1... easiest thing would be to put a byte of padding right before the data table (after the if..endif construct) 1 Quote Link to comment Share on other sites More sharing options...
lucienEn Posted January 10 Author Share Posted January 10 (edited) Thanks! Yes that code comes from the 2600 builder web site. I want to use that construct as well for my auto-code generation. Downside is that it might waste a lot of bytes but I think auto-code could adjust for that and group them better. Edited January 10 by lucienEn Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.