commanderx16 / x16-rom

Other
153 stars 44 forks source link

[BASIC] fail graphics commands in non graphics mode (#342) #351

Closed Jaxartes closed 2 years ago

Jaxartes commented 2 years ago

with a new error message for it, "?NOT GRAPHICS MODE". This changes the commands PSET, LINE, RECT, FRAME, and CHAR.

The old behavior was: PSET, LINE, RECT, and FRAME would crash to monitor, if graphics mode had never been entered. (CHAR didn't.) If graphics mode had been entered and exited, they appeared to do nothing.

This fix does impose a performance penalty, calling "screen_mode" with each operation. The attached test program gfx-speed-2.bas.txt showed a performance penalty of 40.5 microseconds per command -- 6.2% of the time for PSET (the fastest of the commands).

Some alternative ways of finding out the screen mode didn't turn out well.

mist64 commented 2 years ago

Thanks!