| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Asm in Os/2 (Direct Screen writes) |
PR> Can somebody give me a short example in asm, c, or c++
PR> of a direct screen write? just the letter 'A' at
PR> b800:0000 would be lovely... please don't mock me with
User programs (ie: everything but device drivers) can not access a specific
physical memory address. You'll never be able to write directly to
b000/b800.
The Vio api provides a function (VioGetPhysBuf) that manufactures a
selector (a "protected mode segment" register) that you can use
instead. Your program, of course, can only use this selector in full
screen (locked) sessions; because I this I STONGLY discourage you from
using it.
Use the Logical Video Buffer instread (VioGetBuf/VioShowBuf), or better
yet, forget about poking character/attribute pairs into a buffer and use
functions like VioWrtCharStr() instead.
For docs in Vio, look for PRCP.INF (prcp.zip) on this and other fine os/2 bbs's.
Here's an LVB sample I wrote for someone else:
// compiled with ibm cset++ v2:
// icc /W2 /Wall /O /Oi /Rn /Sse /G4 vio.c
#define INCL_NOPMAPI
#define INCL_VIO
#include
#include
#include
int main(void)
{
ULONG ulLVB = 0;
PVOID16 p16;
USHORT usLen = 0;
char *pb;
VioScrollUp(0, 0, 0xffff, 0xffff, 0xffff, " \x7", 0); // cls
VioGetBuf(&ulLVB, &usLen, 0);
/* VioGetBuf, being a 16bit OS/2 1.x function, returns a seg:off
* pointer. Force 'p16' to point to it, then get the compiler
* to thunk it to a 0:32 pointer.
*/
p16 = (PVOID16)ulLVB; // no thunk.
pb = (char *)p16; // thunk.
VioSetCurPos(0, 0, 0); // so printf is at top
printf("lvb16=%p, lvb32 = %p, len = %d\n", p16, pb, usLen);
pb += 160; // skip the first line, where our printf() is.
memset(pb, 'A', (size_t)usLen - 160);
VioShowBuf(160, (USHORT)(usLen - 160), 0);
return 0;
}
/*
* Note: It is almost always better not to use
* VioGetBuf/VioGetPhysBuf. Use VioWrt....() instead. The trick is not
* to call VioWrt...() for each character; buffer each line (or more).
*/
--- Maximus/2 2.02p1
* Origin: Sol 3/Toronto (905)858-8488 (1:259/414)SEEN-BY: 105/42 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407 SEEN-BY: 712/515 628 704 713/888 800/1 7877/2809 @PATH: 259/414 400 99 250/702 3615/50 396/1 270/101 105/103 42 712/515 @PATH: 711/808 809 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.