breakintoprogram/agon-vdp

GET$(x, y) returns a SPACE character for many characters which are not SPACE characters

Closed this issue · 3 comments

The GET$(x,y) function in Agon BASIC does not always return the actual ASCII character currently being displayed on the text screen at position (X,Y). Oftentimes it returns the space character (ASCII 32) instead.

Attached is a .BAS program which demonstrates the issue.
TESTGETDOLLAR.zip

Attached is another Agon Basic program which demonstrates another perspective of the issue.

TESTGETDOLLAR2.zip

After doing some experimentation, I discovered that GET$(x, y) will work reliably when the ASCII value of the displayed character is less than 127 and its color is WHITE (7).

Another AgonLight developer pointed me to the implementation of get_screen_char(x, y) in the VDP source code:

char get_screen_char(int px, int py) {

So the implementation compares pixels to the foreground color (which in my testing was WHITE, so that explains that). The implementation also does not compare character bitmaps for ASCII characters 128 through 256.

Can the implementation of get_screen_char(x, y) in the VDP be improved to handle any foreground color and all of the first 256 8-bit characters in the font?