Skip to content

[cmds] Enhance ibmpc BASIC to use EGA or VGA graphics mode#2440

Merged
ghaerr merged 4 commits intomasterfrom
ibmbasic
Nov 4, 2025
Merged

[cmds] Enhance ibmpc BASIC to use EGA or VGA graphics mode#2440
ghaerr merged 4 commits intomasterfrom
ibmbasic

Conversation

@ghaerr
Copy link
Copy Markdown
Owner

@ghaerr ghaerr commented Nov 4, 2025

Enhances IBM PC version of ELKS basic to use 16-color EGA 640x350 graphics (when EGAMODE environment variable set), otherwise use VGA 640x480. This allows programs such as elkscmd/basic/test98.bas (originally written for PC-98) to also run on IBM PC BASIC.

The 16 colors are still not compatible between IBM PC and PC98, see screenshots below.

Also replaces host_plot() function with the much smaller draw_line() routine from ELKS Paint, which reduces the size of basic by 1K bytes on disk.

IBM PC basic test98.bas:
IBMPC basic

PC-98 basic test98.bas:
PC98 basic

Note that the PC-98 allows ASCII text to display in graphics mode (see "BASIC" and "260-STOP" in above screenshot), while the IBM PC EGA/VGA does not. There isn't much that can be done about this. Typing ^D to exit basic, or "mode 0" to exit graphics mode, will revert to EGA/VGA text mode.

@ghaerr ghaerr merged commit c95a22a into master Nov 4, 2025
2 checks passed
@ghaerr ghaerr deleted the ibmbasic branch November 4, 2025 04:29
@toncho11
Copy link
Copy Markdown
Contributor

toncho11 commented Nov 4, 2025

So no CGA for IBM PC?

@ghaerr
Copy link
Copy Markdown
Owner Author

ghaerr commented Nov 4, 2025

So no CGA for IBM PC?

I'm thinking of extending the MODE n command to accept a BIOS graphics mode number, with MODE 1 meaning default (EGA or VGA). That would easily allow CGA operation. The bigger problem I've found is that it seems IBM PC CGA, EGA or VGA programs aren't compatible with PC-98, and don't display properly. Not sure what to do about that, and it doesn't help that BASIC uses a flipped Y-coordinate axis.

@toncho11
Copy link
Copy Markdown
Contributor

toncho11 commented Nov 4, 2025

I see - complicated. I am updating here https://github.com/ghaerr/elks/wiki/Coding-games-for-ELKS#3-using-basic - the Basic section when there are new changes,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants