+Vorticon Posted January 23, 2022 Share Posted January 23, 2022 Hi. I'm trying to set up the color table of an XB program from an assembly subprogram in low memory and it's not working. I'd like to confirm a few facts: The color table is at >800 and is 32 bytes long The color bytes are set up as foreground in most significant nibble and background in the least significant nibble The color numbers are those used by assembly and not XB Color set #1 (starting with character # 32) is at >804 in the color table If all the above are correct, then I am stumped... Quote Link to comment Share on other sites More sharing options...
senior_falcon Posted January 24, 2022 Share Posted January 24, 2022 You have forgotten the offset. Colors for characters from 32 to 39 are at >0810. 2 1 Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted January 24, 2022 Author Share Posted January 24, 2022 32 minutes ago, senior_falcon said: You have forgotten the offset. Colors for characters from 32 to 39 are at >0810. That worked! I thought the >60 offset only applied to the screen table. Thank you! 1 Quote Link to comment Share on other sites More sharing options...
senior_falcon Posted January 24, 2022 Share Posted January 24, 2022 The classic99 debugger can be a real help in cases like this. Usually I don't try to compute out what byte to change. This program: 10 CALL COLOR(3,16,16) 20 GOTO 20 changes character set 3. using the debugger I can see that >0812 is set to FF, so I know that is the byte that controlls character set 3 and can use that in my program. This way, there is no chance of those pesky arithmetic errors that bedevil me so. 4 Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted January 24, 2022 Share Posted January 24, 2022 19 hours ago, Vorticon said: I thought the >60 offset only applied to the screen table. Actually, the Screen Image Table, Character Pattern Table, and Sprite Pattern Table all start at VRAM >0000 in Extended Basic. Character and sprite patterns occurring at >0000 – >03EF (>0000 – >02FF [actual Screen Image Table], >0300 – >036F [Sprite Attribute Table], and >0370 – >03EF [XB System Area]) cannot be defined without interfering with the other functions of those areas. That is the area for characters with ASCII values from 0 – 125, >00 – >7D. To be able to define a character pattern for the XB character with the lowest ASCII value (the cursor character [ASCII 30, >1E]), the pattern must start no lower than >03F0, the address of the pattern for ASCII 126, >7E. The difference is 96, >60, which is the offset that ALC routines called from XB must respect to get proper display of desired characters. I say all of the above because the color table (32 bytes) at >0800 defines foreground/background colors for 32 character sets of 8 characters each from ASCII 0 – 255. The XB character offset forces the cursor character (ASCII 30, now 126) and edge character (ASCII 31, now 127) into 0-based character set 15 (VRAM address in Color Table: >080F) and, as Harry (@senior_falcon) pointed out, character set 16 for ASCII 32 – 39 (now 128 – 135) (VRAM address in Color Table: >0810). Of course, XB numbers these two character sets as “0” and “1”. To round things out, the reason for the upper limit of ASCII 143 (actually, 239) for characters and sprites is that the pattern for ASCII 144 (actually, 240) starts at VRAM >0780, the address of the Sprite Motion Table. ...lee 2 1 Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted January 25, 2022 Author Share Posted January 25, 2022 Thanks Lee. This is as comprehensive an explanation as I have ever seen of XB's character offset. It's going into my archives 3 Quote Link to comment Share on other sites More sharing options...
+TheBF Posted January 25, 2022 Share Posted January 25, 2022 What we all think when Lee speaks. 1 3 Quote Link to comment Share on other sites More sharing options...
GDMike Posted January 25, 2022 Share Posted January 25, 2022 Shoot, I find myself almost bowing, saluting, hats off to Lee! Roll out the red mouse pad! 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.