Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.msdos.programmer > #955
| From | "Bill Buckels" <bbuckels@mts.net> |
|---|---|
| Newsgroups | comp.os.msdos.programmer |
| Subject | Re: MS-DOS direct screen output - native and in a window |
| Date | 2013-08-29 07:23 -0500 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <kvneg6$405$1@speranza.aioe.org> (permalink) |
| References | <kvn372$vnt$1@dont-email.me> <kvn9ie$m50$1@speranza.aioe.org> |
"Bill Buckels" <bbuckels@mts.net> wrote:
>> "James Harris" <james.harris.1@gmail.com> wrote:
>> Basic question: Is there a "good" way for DOS direct screen writes to be
>> handled?
> I generally used the BIOS calls to set-up my screen mode controls, both
> graphics and text, but wrote directly to the screen.
Since this is a programming group, I will provide you with a short example.
I assume you know about programming and about the PC's memory layout and
BIOS and MS-DOS. Keep in mind that this has nothing to do with Windows.
Simple user commands like the mode command in windows predate Windows to
MS-DOS. This is not about user commands. This is about programming in MS-DOS
using BIOS calls. For help with Windows type HELP in Windows.
You can download some examples with compiler from my Aztec C website's
compiler page:
Aztec C86 for the 8086
Version 4.2b
9/29/89
Rebundled for Windows XP
http://www.aztecmuseum.ca/AztecC86.zip
The code is from a text screen demo in that bundle called batch.exe.
Typically when one used a bsaved text screen as a background in text screen
memory the text cursor needed to be turned off, and turned back on again
afterwards. One always defaulted to monochrome screen memory address and
checked for color adapter in the bios.
One always used int16h for keypresses and hilighted menus were generally
arrow keyed controlled which always took special handling because of the
first null byte for the extended keys.
You will note that I use two different methods to make my BIOS assembly
level calls. All the good compilers of the day provided a REGS interface,
and the good ones also provided inline assembly.
The screen arrays are simple PCX style encoded text screens.
Bill
x-- snip --x
/* reference */
unsigned char BATCH000[], BATCH001[],BATCH002[],BATCH003[],BATCH004[];
struct regs{
int AX;
int BX;
int CX;
int DX;
int SI;
int DI;
int DS;
int ES;
}inregs,outregs;
#define SCREENSIZE 4000
unsigned int SCREENSEG= 0xb000;
#define TERMINATOR 1
void showpic(int argc, unsigned char *argv)
{
unsigned int byteoff=0,secondoff=1,packet;
unsigned char byte,bytecount;
int wordcount,target;
unsigned char *databuf;
unsigned int segregs[4];
target = argc-TERMINATOR;
databuf = malloc(SCREENSIZE);
wordcount=0;
do{ bytecount=1; /* start with a seed count */
byte=argv[wordcount];
wordcount++;
/* check to see if its raw */
if(0xC0 == (0xC0 &byte)){ /* if its not, run encoded */
bytecount= 0x3f &byte;
byte=argv[wordcount];
wordcount++;
}
for(packet=0;packet<bytecount;packet++){
if(byteoff<SCREENSIZE){
databuf[byteoff]=byte;
byteoff+=2;
}
else{
databuf[secondoff]=byte;
secondoff+=2;
}
}
}while(wordcount<target);
#define dseg 2
/* returns base of dgroup */
segread(&segregs);
movblock(*((unsigned int*)&databuf),segregs[dseg],
0x0000,SCREENSEG,SCREENSIZE);
free(databuf);
}
unsigned int catch()
{
inregs.AX = 0x0000;
inregs.DX = 0x0000;
sysint(0x16,&inregs,&outregs);
return outregs.AX&0x00ff;
}
main()
{
int i;
sysint(0x11,&inregs,&outregs); /* get equipment list from the bios */
/* get display type (bits 4 and 5 of ax) */
if ((outregs.AX & 0x30) < 0x30)SCREENSEG=0xb800;
/* clearscreen and turn cursor off */
#asm
mov ah,6
mov al,0
mov cx,0
mov dh,24
mov dl,79
mov bh,0
int 10h
xor ax,ax
mov ah,1
mov cx,2000h
int 10h
#endasm
/* allow a keypress to advance */
/* allow escape to exit */
for(i=0;i<5;i++)
{
switch(i)
{
case 0:showpic(sizeof(BATCH000),BATCH000);break;
case 1:showpic(sizeof(BATCH001),BATCH001);break;
case 2:showpic(sizeof(BATCH002),BATCH002);break;
case 3:showpic(sizeof(BATCH003),BATCH003);break;
case 4:showpic(sizeof(BATCH004),BATCH004);break;
}
if(catch()==27)i+=5;
}
/* clear screen and turn cursor on */
#asm
mov ah,6
mov al,0
mov cx,0
mov dh,24
mov dl,79
mov bh,0eh
int 10h
xor ax,ax
mov ah,1
mov cx,0607h
int 10h
#endasm
exit(0);
}
Back to comp.os.msdos.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
MS-DOS direct screen output - native and in a window "James Harris" <james.harris.1@gmail.com> - 2013-08-29 10:10 +0100
Re: MS-DOS direct screen output - native and in a window "R.Wieser" <address@not.available> - 2013-08-29 12:58 +0200
Re: MS-DOS direct screen output - native and in a window "Bill Buckels" <bbuckels@mts.net> - 2013-08-29 05:59 -0500
Re: MS-DOS direct screen output - native and in a window "Bill Buckels" <bbuckels@mts.net> - 2013-08-29 07:23 -0500
Re: MS-DOS direct screen output - native and in a window "Bill Buckels" <bbuckels@mts.net> - 2013-08-29 08:35 -0500
Re: MS-DOS direct screen output - native and in a window "Ed" <invalid@invalid.com> - 2013-09-28 20:34 +1000
Re: MS-DOS direct screen output - native and in a window pete@nospam.demon.co.uk - 2013-09-29 06:45 +0000
Re: MS-DOS direct screen output - native and in a window "Ed" <invalid@invalid.com> - 2013-09-29 19:33 +1000
Re: MS-DOS direct screen output - native and in a window "James Harris" <james.harris.1@gmail.com> - 2013-09-29 16:06 +0100
Re: MS-DOS direct screen output - native and in a window "Ed" <invalid@invalid.com> - 2013-10-01 11:28 +1000
csiph-web