+atari2600land Posted January 4, 2020 Share Posted January 4, 2020 Hello. I have a little problem I hope you guys could solve. I put a copyright symbol in as a MOB. And to print it, I did print at 154 color $1202, "\319 2020" Which is all well and good, but perhaps I don't want the space in between the copyright symbol and the year. You'd think there would be a way to do that, but I can't think of anything that would work. 1 Quote Link to comment Share on other sites More sharing options...
intvnut Posted January 4, 2020 Share Posted January 4, 2020 Did you mean as a GRAM tile, not MOB? (MOB = Sprite) In any case, it feels like IntyBASIC should stop parsing the \ escape after 3 digits, but trying it just now, it appears it doesn't. In the meantime, you could just do: #backtab(154) = $1202 + 319*8 print at 155 color $1202, "2020" Quote Link to comment Share on other sites More sharing options...
ChildOfCv Posted January 4, 2020 Share Posted January 4, 2020 5 hours ago, atari2600land said: Hello. I have a little problem I hope you guys could solve. I put a copyright symbol in as a MOB. And to print it, I did print at 154 color $1202, "\319 2020" Which is all well and good, but perhaps I don't want the space in between the copyright symbol and the year. You'd think there would be a way to do that, but I can't think of anything that would work. Perhaps a workaround might be: print at 154 color $1202, "\319\ 2020" Quote Link to comment Share on other sites More sharing options...
+atari2600land Posted January 4, 2020 Author Share Posted January 4, 2020 Yes, I meant GRAM tile. INTVnut's workaround works. Quote Link to comment Share on other sites More sharing options...
carlsson Posted January 4, 2020 Share Posted January 4, 2020 (edited) Remember that PRINT can take multiple arguments so in this case the easy and obvious solution is: PRINT AT 154 COLOR $1202,"\319","2020" In a similar way, you can do this without breaking it into three parts: PRINT AT 62,"PLAYER 1: ",<2>sc(0)," PTS" PRINT AT 82,"PLAYER 2: ",<2>sc(1)," PTS" Edited January 4, 2020 by carlsson 1 Quote Link to comment Share on other sites More sharing options...
intvnut Posted January 5, 2020 Share Posted January 5, 2020 6 hours ago, carlsson said: Remember that PRINT can take multiple arguments so in this case the easy and obvious solution is: PRINT AT 154 COLOR $1202,"\319","2020" Strangely, that results in more expensive code in IntyBASIC 1.4.1, as it saves and reloads the _screen pointer unnecessarily, and has to separately XOR in _color. My way: ;[3] #backtab(154) = $1202 + 319*8 SRCFILE "copr.bas",3 MVII #7162,R0 MVO R0,Q2+154 ;[4] print at 155 color $1202, "2020" SRCFILE "copr.bas",4 MVII #667,R0 MVO R0,_screen MVII #4610,R0 MVO R0,_color MVI _screen,R4 MVII #144,R0 XOR _color,R0 MVO@ R0,R4 XORI #16,R0 MVO@ R0,R4 XORI #16,R0 MVO@ R0,R4 XORI #16,R0 MVO@ R0,R4 MVO R4,_screen Your way: SRCFILE "copr.bas",5 ;[6] PRINT AT 154 COLOR $1202,"\319","2020" SRCFILE "copr.bas",6 MVII #666,R0 MVO R0,_screen MVII #4610,R0 MVO R0,_color MVI _screen,R4 MVII #2552,R0 XOR _color,R0 MVO@ R0,R4 MVO R4,_screen MVI _screen,R4 MVII #144,R0 XOR _color,R0 MVO@ R0,R4 XORI #16,R0 MVO@ R0,R4 XORI #16,R0 MVO@ R0,R4 XORI #16,R0 MVO@ R0,R4 MVO R4,_screen Your way is definitely cleaner, though. I suppose this is yet another opportunity for nanochess to optimize. 1 Quote Link to comment Share on other sites More sharing options...
Kiwi Posted January 5, 2020 Share Posted January 5, 2020 You can just do this, print at 154 color $1202, "\319\18\16\18\16" I get the backtab numbers from http://knox.ac.free.fr/inty_workshop/ I haven't tested this. Another way is a data table and a looped poke. Quote Link to comment Share on other sites More sharing options...
carlsson Posted January 5, 2020 Share Posted January 5, 2020 (edited) It is quickly turning into obfuscated code if one needs to know the character table in GROM, in particular as it is not ASCII compatible. But yes, a POKE loop is even more efficient if you want: FOR i=0 TO 4:#backtab(154+i) = $1202 + text(i)*8:NEXT ... text: DATA 319,18,16,18,16 Edited January 5, 2020 by carlsson 1 Quote Link to comment Share on other sites More sharing options...
intvnut Posted January 6, 2020 Share Posted January 6, 2020 On 1/5/2020 at 4:02 AM, carlsson said: It is quickly turning into obfuscated code if one needs to know the character table in GROM, in particular as it is not ASCII compatible. But yes, a POKE loop is even more efficient if you want: FOR i=0 TO 4:#backtab(154+i) = $1202 + text(i)*8:NEXT ... text: DATA 319,18,16,18,16 That's smaller in size, but I am pretty sure it's not faster speed-wise. And, of course, there's packed character strings if you have a lot of text to deal with. The GROM is mostly ASCII shifted down my $20, so it's somewhat ASCII compatible, much like PETSCII. If you really want the smallest, fastest code, you probably end up with something like this: #backtab(154) = $1202 + 319*8 #backtab(155) = $1202 + 18*8 #backtab(157) = $1202 + 18*8 #backtab(156) = $1202 + 16*8 #backtab(158) = $1202 + 16*8 Notice the ordering. IntyBASIC takes advantage of the repeated value: MVII #7162,R0 MVO R0,Q2+154 MVII #4754,R0 MVO R0,Q2+155 MVO R0,Q2+157 MVII #4738,R0 MVO R0,Q2+156 MVO R0,Q2+158 1 Quote Link to comment Share on other sites More sharing options...
intvnut Posted January 6, 2020 Share Posted January 6, 2020 1 hour ago, intvnut said: If you really want the smallest, fastest code, you probably end up with something like this: #backtab(154) = $1202 + 319*8 #backtab(155) = $1202 + 18*8 #backtab(157) = $1202 + 18*8 #backtab(156) = $1202 + 16*8 #backtab(158) = $1202 + 16*8 I suppose you could even make that almost readable with a couple macros like so: DEF FN backtab_tile(color, tile) = color + (tile) * 8 DEF FN backtab_char(color, char) = color + (char - $20) * 8 #backtab(154) = backtab_tile($1202, 319) #backtab(155) = backtab_char($1202, "2") #backtab(157) = backtab_char($1202, "2") #backtab(156) = backtab_char($1202, "0") #backtab(158) = backtab_char($1202, "0") 1 Quote Link to comment Share on other sites More sharing options...
Zendocon Posted January 7, 2020 Share Posted January 7, 2020 I had actually asked @nanochess about this, particularly because "\\" wasn't implemented as an escape code to display a single backslash character. In RobotFindsKitten, I ended up using "\60" which is the GROM character code for backslash. But then I asked what would happen if I wanted to display "\1" because "\601" would give us garbage. He said in the next release he would implement a limit of three digits, so "\0601" would give us what we wanted in this case. I hope that helps. 1 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.