Problem of using video bios call

I have write a simple program to have a light green colored full screen
display by using _intr_v86.
However , the program doesn’t work and make the computer hang , what I had
done wrong?
I had tried for long time to debug it , thank you very much.

#include “header.h”
#include <sys/neutrino.h>
#include <sys/syspage.h>
#include <hw/inout.h>
#include <x86/v86.h>

struct _v86reg reg;

main(){
int i,j;
j=320*200;
ThreadCtl(_NTO_TCTL_IO, 0);
memset(&reg,0,sizeof(reg));
reg.ds=0;
reg.es=0;
reg.fs=0;
reg.gs=0;
reg.eax=0x0013; //set vga in 256-color mode
_intr_v86(0x10,&reg,NULL,0);
for(i=0;i<j;i++){
out8(offsetof(struct _v86_memory,adaptor)+i,0xa); //0xa is light green
}
sleep(3);
return 1;
}

waity <waity@hongkong.com> wrote:

I have write a simple program to have a light green colored full screen
display by using _intr_v86.
However , the program doesn’t work and make the computer hang , what I had
done wrong?
I had tried for long time to debug it , thank you very much.

The problem is that QNX runs in 32-bit protected mode. In general, this
means that the BIOS is not callable.

Most people doing graphics work use Photon – the GUI that we ship.

-David

#include “header.h”
#include <sys/neutrino.h
#include <sys/syspage.h
#include <hw/inout.h
#include <x86/v86.h

struct _v86reg reg;

main(){
int i,j;
j=320*200;
ThreadCtl(_NTO_TCTL_IO, 0);
memset(&reg,0,sizeof(reg));
reg.ds=0;
reg.es=0;
reg.fs=0;
reg.gs=0;
reg.eax=0x0013; //set vga in 256-color mode
_intr_v86(0x10,&reg,NULL,0);
for(i=0;i<j;i++){
out8(offsetof(struct _v86_memory,adaptor)+i,0xa); //0xa is light green
}
sleep(3);
return 1;
}


QNX Training Services
dagibbs@qnx.com

Is it possible to run QNX in real mode?
Thx.

“David Gibbs” <dagibbs@qnx.com> ¼¶¼g©ó¶l¥ó news:9ofovo$i6k$1@nntp.qnx.com

waity <> waity@hongkong.com> > wrote:
I have write a simple program to have a light green colored full screen
display by using _intr_v86.
However , the program doesn’t work and make the computer hang , what I
had
done wrong?
I had tried for long time to debug it , thank you very much.

The problem is that QNX runs in 32-bit protected mode. In general, this
means that the BIOS is not callable.

Most people doing graphics work use Photon – the GUI that we ship.

-David

#include “header.h”
#include <sys/neutrino.h
#include <sys/syspage.h
#include <hw/inout.h
#include <x86/v86.h

struct _v86reg reg;

main(){
int i,j;
j=320*200;
ThreadCtl(_NTO_TCTL_IO, 0);
memset(&reg,0,sizeof(reg));
reg.ds=0;
reg.es=0;
reg.fs=0;
reg.gs=0;
reg.eax=0x0013; //set vga in 256-color mode
_intr_v86(0x10,&reg,NULL,0);
for(i=0;i<j;i++){
out8(offsetof(struct _v86_memory,adaptor)+i,0xa); //0xa is light
green
}
sleep(3);
return 1;
}



\

QNX Training Services
dagibbs@qnx.com

Yes, if you get QNX version 2. Otherwise no.

“waity” <waity@hongkong.com> wrote in message
news:9ofpk2$jv8$1@inn.qnx.com

Is it possible to run QNX in real mode?
Thx.

waity <waity@hongkong.com> wrote:

I have write a simple program to have a light green colored full screen
display by using _intr_v86.
However , the program doesn’t work and make the computer hang , what I had
done wrong?

The out8’s are killing you. You need to memory-map the VGA frame buffer.

Try this program:

#include <stddef.h>
#include <errno.h>
#include <sys/mman.h>
#include <sys/mman.h>
#include <x86/v86.h>

struct _v86reg reg;

main()
{
int i = 0;
char buf[4];
char *p;

if ((p = (unsigned char *)mmap_device_memory(NULL, 0x10000,
PROT_READ | PROT_WRITE, 0, 0xa0000)) != MAP_FAILED)

reg.eax = 0x13;
if (_intr_v86(0x10, &reg, buf, strlen(buf)) < 0) {
perror(“v86”);
exit(1);
}

memset(p, 10, 320*200);
}

waity <waity@hongkong.com> wrote:

Is it possible to run QNX in real mode?

Not since QNX2, in the '80s.

-David


QNX Training Services
dagibbs@qnx.com

I will try it , thank you very much .
“David Donohoe” <ddonohoe@qnx.com> ¼¶¼g©ó¶l¥ó
news:9ofsu0$kh9$1@nntp.qnx.com

waity <> waity@hongkong.com> > wrote:
I have write a simple program to have a light green colored full screen
display by using _intr_v86.
However , the program doesn’t work and make the computer hang , what I
had
done wrong?

The out8’s are killing you. You need to memory-map the VGA frame buffer.

Try this program:

#include <stddef.h
#include <errno.h
#include <sys/mman.h
#include <sys/mman.h
#include <x86/v86.h

struct _v86reg reg;

main()
{
int i = 0;
char buf[4];
char *p;

if ((p = (unsigned char *)mmap_device_memory(NULL, 0x10000,
PROT_READ | PROT_WRITE, 0, 0xa0000)) != MAP_FAILED)

reg.eax = 0x13;
if (_intr_v86(0x10, &reg, buf, strlen(buf)) < 0) {
perror(“v86”);
exit(1);
}

memset(p, 10, 320*200);
}