KevKelley Posted August 11, 2021 Share Posted August 11, 2021 I was trying something out and didn't quite get the results I was thinking would happen so I wanted to get a better understanding as to why. My program's space is limited. I am trying to finish things up but I have the following space remaining in each of the banks: 1 bytes of ROM space left in bank 1 41 bytes of ROM space left in bank 2 6 bytes of ROM space left in bank 3 6 bytes of ROM space left in bank 4 I had thought that instead of using the drawing the entire playfield like this: playfield: X....X....X....X....X....XXX...X X....X....X....X....X....XXX...X ................................ ................................ .........XX.XXX.XXX.XX..XXX.XXX. ..XXXXXXX...X...X.X.X.X..X..X... .XX.X.X.X...X...XXX.XX...X...XX. .X.X.X.XX...XXX.X.X.X.X..X..XXX. ..XXXXXX........................ ...XXXX..XXXXXXXXXXXXXXXXXXXXXX. ..XX..XX........................ end I could only use certain playfield variables and rewrite a couple of lines and save some space by doing this: var16=%00000000 :var17=%01110110 :var18=%11101100 :var19=%01110111 var20=%00111111 :var21=%00010001 :var22=%10101010 :var23=%00010010 var24=%01101010 :var25=%00010001 :var26=%11101100 :var27=%01100010 var28=%01010101 :var29=%01110001 :var30=%10101010 :var31=%01110010 var32=%00111111 :var33=%00000000 :var34=%00000000 :var35=%00000000 var36=%00011110 :var37=%11111110 :var38=%11111111 :var39=%01111111 var40=%00110011 :var41=%00000000 :var42=%00000000 :var43=%00000000 I had used playfield variables in my game when I needed to change just a small portion of the screen like maybe a couple pixels so I thought this could be an easy way to save space but when I tried to compile I got an error message that listed the remaining bytes as such: segment: 3fd4 eqm vs current org: 3ffd 1 bytes of ROM space left in bank 1 41 bytes of ROM space left in bank 2 -41 bytes of ROM space left in bank 3 The code I was changing was in bank 3 but my question is why would drawing 7 lines of the playfield using playfield variable use more space then drawing the entire thing with "x"s and "."s? Also, when I tried instead using a data table instead I saved space but I couldn't figure out how to read the data, and if that would be a better solution? Quote Link to comment https://forums.atariage.com/topic/323788-playfield-variables-vs-playfield-and-data-table/ Share on other sites More sharing options...
+Random Terrain Posted August 11, 2021 Share Posted August 11, 2021 Have you tried sticking the test code here: https://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html#memory 1 Quote Link to comment https://forums.atariage.com/topic/323788-playfield-variables-vs-playfield-and-data-table/#findComment-4882948 Share on other sites More sharing options...
KevKelley Posted August 11, 2021 Author Share Posted August 11, 2021 12 minutes ago, Random Terrain said: Have you tried sticking the test code here: https://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html#memory Thanks. I never noticed this before on your page so I just tried it and the results are the same: Routine 1: 57 (playfield) Routine 2: 144 (playfield variables) Routine 3: 47 (data table) I had thought that if I just used a couple playfield variables I would have used much less. The results were surprising. Basically, in my code I had the screens change but I was thinking that since half of the screen stays the same I could save space by just redrawing half the screen so I was wondering about the workings of the code to understand the differences. 1 Quote Link to comment https://forums.atariage.com/topic/323788-playfield-variables-vs-playfield-and-data-table/#findComment-4882954 Share on other sites More sharing options...
+Karl G Posted August 11, 2021 Share Posted August 11, 2021 Normally bB will read playfield data into RAM using a loop, so relatively little code needed to do so. In your case, you have less data, but more space is taken up by your code to populate it into RAM. Quote Link to comment https://forums.atariage.com/topic/323788-playfield-variables-vs-playfield-and-data-table/#findComment-4883120 Share on other sites More sharing options...
+Karl G Posted August 11, 2021 Share Posted August 11, 2021 Also, try something like this to see if it helps (untested): for temp5 = 0 to 27 var17[temp5] = my_screen[temp5] next data my_screen %00000000, %01110110, %11101100, %01110111 %00111111, %00010001, %10101010, %00010010 %01101010, %00010001, %11101100, %01100010 %01010101, %01110001, %10101010, %01110010 %00111111, %00000000, %00000000, %00000000 %00011110, %11111110, %11111111, %01111111 %00110011, %00000000, %00000000, %00000000 end Edit: Also, don't forget that the bit order is reversed for the odd-numbered variables, assuming you haven't already taken that into account in your data. Quote Link to comment https://forums.atariage.com/topic/323788-playfield-variables-vs-playfield-and-data-table/#findComment-4883134 Share on other sites More sharing options...
+Karl G Posted August 11, 2021 Share Posted August 11, 2021 Also - I believe bB sticks playfield data in the last bank regardless of where you define it. If you instead populate from a regular data table like in my example, it would take up space wherever you define it instead. Quote Link to comment https://forums.atariage.com/topic/323788-playfield-variables-vs-playfield-and-data-table/#findComment-4883466 Share on other sites More sharing options...
KevKelley Posted August 11, 2021 Author Share Posted August 11, 2021 I had thought about setting a temp variable and doing it that way but I don't think I have any left. Thanks for the answer. It is interesting to hear the going on under the hood. I had a similar question last year as I was working on Crossdock but that was when I switch from using pfpixel to the playfield variables so I just assumed the difference would be great. Thank you for your response but I will definitely play around with this in the future. I was looking for creative ways to try and save space in my program (or future programs). Quote Link to comment https://forums.atariage.com/topic/323788-playfield-variables-vs-playfield-and-data-table/#findComment-4883473 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.