Jump to content
IGNORED

XB color table access in assembly


Vorticon

Recommended Posts

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... 

Link to comment
Share on other sites

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.

  • Like 4
Link to comment
Share on other sites

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

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...