A lot of people have written VGA text mode emulators for various projects, when true VGA text mode wasn't really accessible anymore.
Obviously there's the one in the linux kernel (fbcon), and the ones in DOSEMU and DOSBOX. There's also one for Schism Tracker, one for OpenCubicPlayer, one for Adlib Tracker 2, one for MegaZeux ...
PC compatible text modes
Re: PC compatible text modes
A VGA text mode emulator is probably simpler than, say, the PPU part of an NES or Game Boy emulator.
Re: PC compatible text modes
Dosbox is used today to distribute commercial games from the ms-dos era so I wouldn't call it a nesticle experience.
It all depends of your goals: if you want to program like in the dos days to learn how it was done then dosbox will be the easiest solution. Dosbox runs on windows, linux, mac, bsd etc. Freedos.. Well.. You may not be able to make the sound work with new hardware unfortunately. That will be the first issue encountered.
If your goal is just to have a text based ui and be multiplatform then it will get a lot more complicated.
Before choosing a platform I think you will need to clarify your goals first.
It all depends of your goals: if you want to program like in the dos days to learn how it was done then dosbox will be the easiest solution. Dosbox runs on windows, linux, mac, bsd etc. Freedos.. Well.. You may not be able to make the sound work with new hardware unfortunately. That will be the first issue encountered.
If your goal is just to have a text based ui and be multiplatform then it will get a lot more complicated.
Before choosing a platform I think you will need to clarify your goals first.
Re: PC compatible text modes
One thing that having emulation of the text mode is useful for is if the program will be ported to computers that are not even a PC, and/or porting to a windowed system. If your program is written for DOS, then you can use Dosbox to emulate it (as well as other features such as FM synth) on many kinds of computers.
Also, I was designing a new kind of computer system design and one of the things that the video processor was designed to do is to be able to emulate a PC text mode by using a display list similar to the following (this one does not implement the cursor, but adding a sprite with the impostor and occult bits set, and the logic necessary to activate it, could be used to add the cursor):
And if you can find the PC CGA schematics then look since possibly you might find something of interst to you (I don't know).
Also, I was designing a new kind of computer system design and one of the things that the video processor was designed to do is to be able to emulate a PC text mode by using a display list similar to the following (this one does not implement the cursor, but adding a sprite with the impostor and occult bits set, and the logic necessary to activate it, could be used to add the cursor):
Code: Select all
; Set mode (could be omitted if programmed during initialization)
L0 LDA #$20
SAR #MODE
; Do text blinking
LDA V1
<CMC
ADC #0
CMP #60
>LDA #0
STA V1
; Initialize playfield address
LDA #$80
STA V2+0
SAR #PFAH
LDA #$00
STA V2+1
SAR #PFAL
; Initialize character page address
LDA #$40
STA V3
; Do processing for next scanline
L1 LDA V1
CMP #30
LDA V3
SAR #CHRP+0
SAR #CHRP+2
<LDA #$48
SAR #CHRP+1
SAR #CHRP+3
WAI -
LDA V3
CMP #$47
>LDA #$3E
ADC #1
STA V3
CMP #$41
<JMP L1
; Advance playfield address
LDA V2+1
ADC #79
STA V2+1
SAR #PFAL
LDA V2+0
ADC #0
STA V2+0
SAR #PFAH
; Next
JMP L1
; Variables (they could be inlined for improved speed)
V1 DATA 59 ; Blinking time
V2 SPACE 2 ; Playfield address
V3 SPACE 1 ; Character page address
(Free Hero Mesh - FOSS puzzle game engine)
Re: PC compatible text modes
I guess I could always shape the code so that it can be compiled either as a genuine DOS application and be run in either DosBox or FreeDOS (or both), or make it a graphical applicaiton using an existing VGA simulator so that it can be run natively without those programs. Yet it's still strangely complicated to have to go through all this to simply build a semi-graphical application.
Re: PC compatible text modes
If a library for doing this would be written (with x86-specific code when compiling for DOS), then it can be use for multiple purposes in this way, for any program that would use this.Bregalad wrote:I guess I could always shape the code so that it can be compiled either as a genuine DOS application and be run in either DosBox or FreeDOS (or both), or make it a graphical applicaiton using an existing VGA simulator so that it can be run natively without those programs. Yet it's still strangely complicated to have to go through all this to simply build a semi-graphical application.
(Free Hero Mesh - FOSS puzzle game engine)