creating our own text editor..some help plzzz

Status
Not open for further replies.

a_k_s_h_a_y

Dreaming
Joined
May 22, 2007
Messages
2,494
guys am creating a text editor !! and now first thing that i am trying to do is write characters into the video buffer which starts at 0XB000000L (obvioulsy colour monitor) !!

first thing i will implement is type and save feature only that too with fixed name....u see am a C newb..

i try to write into video buffer but nothing is displayed the cursor is properly moved coz the second part of the prog works !!
can u tell me where the error ??
here is the code

Code:
#include <stdio.h>
#include <dos.h>

main(void)
{
    char *vram_start=(char)0xb8000000l;
    char *v;
    char a[100],scan,ascii;
    int i,j,x=0,y=0;
    union REGS ii,oo;
    v=vram_start+x*160+y*2;
    while(1)
    {
        while(!kbhit());
        ii.h.ah=0;
        int86(22,&ii,&oo);
        scan=oo.h.ah;
        *v=scan;
        v++;
        ascii=oo.h.al;
        *v=150;
        *v=ascii;
        v++;
        *v=152;
        x++;
        ii.h.ah=2;
        ii.h.dh=y;
        ii.h.dl=x;
        ii.h.bh=0;
        int86(0x10,&ii,&oo);
    }
}
the cursor properly moves the next position on screen but no char printed which i hit on keyboard !!
plzz help..thank u !

also plzz explain the concept of video buffer and the scan code of keys and ascii code of keys in detail also what is scan code of various keys..and wht about ascii code of F1 ?? ( i did write a prog to print ascii codes...but there obs u cant know which is the one for F1.. )
 
Last edited:

Pathik

Google Bot
Joined
Aug 28, 2005
Messages
9,684
^^ dunno much about C but if u want to make GUi apps then better use java or visual c# .net
 
OP
a_k_s_h_a_y

a_k_s_h_a_y

Dreaming
Joined
May 22, 2007
Messages
2,494
no no its dos text editor ! later make it windows text editor !
i heard that all system software better written in C....is this true ??
i even read that OS is written in C so this text editor also better in C na !
 

Pathik

Google Bot
Joined
Aug 28, 2005
Messages
9,684
I dont think that a text editor ll ever interact much with the system..
 

swatkat

Technomancer
Joined
Mar 12, 2004
Messages
2,030
Hi,
If you are using NT based OS (NT,2000,XP and above), it's not possible to directly access hardware buffers from User Mode. Moreover, NT based systems don't even have "real" DOS. Accessing hardware is done through drivers in these OSes.
So, to display characters or doing other stuff in Command Line, you need to use console APIs, or standard CRT functions. More info about console APIs:
*msdn2.microsoft.com/en-us/library/ms682010.aspx
*msdn2.microsoft.com/en-us/library/ms686971.aspx
*msdn2.microsoft.com/en-us/library/ms682073.aspx
 
OP
a_k_s_h_a_y

a_k_s_h_a_y

Dreaming
Joined
May 22, 2007
Messages
2,494
^^^ hey thanks a lot yaar...there is lot to read in that website

our HOD told we hv to sue ISR no 22 and get the job done.....i just wanted some one tell error in my prog.....coz my friend wrote almost something same and it worked for him....got to ask him for wht's the correct way !!
 
Status
Not open for further replies.
Top