You are not logged in.


#1 2006-03-01 15:53:34

Nelson@school
Guest

Textmode

How do you guys create "Text Mode Widgets" like I've seen in BOS sometimes and in Dex4U? It would be nice to have when implementing debugging mechanisms into my OS to organize the display. TIA.

 

#2 2006-03-01 19:43:30

Dex4u
Active member
Registered: 2005-02-19
Posts: 132
PM

Re: Textmode

I do not have text widgets as such for Dex4u, but code them as needed.
Example of simple text menu

Code:

;====================================================;
; DrawFile.                                          ;
;====================================================;
DrawFile:
        pushad
        push  es
        mov   ax,8h
        mov   es,ax
        mov   [WinY],4
        cld
 ;----------------------------------------------------;
 ; Draw File Window.                                  ;
 ;----------------------------------------------------;
draw_f:
        mov   esi,WinFile+3
        xor   ecx,ecx
        mov   cl,[WinFile+1]
        xor   ebx,ebx
        mov   bx,12
loopf2:
        mov   edi,0xb8000
        add   edi,[Ytable+ebx+4]
        add   bx,4
        add   edi,4
        push  ecx
        xor   ecx,ecx
        mov   al,[WinFile+2]
        mov   cl,[WinFile]
loopf1:
        movsb
        stosb
        loop  loopf1
        pop   ecx
        loop  loopf2
 ;----------------------------------------------------;
 ; Mark Selection.                                    ;
 ;----------------------------------------------------;
        mov   bx,[WinY]
        shl   bx,2 
        mov   edi,0xb8000
        add   edi,[Ytable+ebx+4]
        add   edi,7
        xor   cx,cx
        mov   cl,[WinFile]
        sub   cl,2
        mov   al,reverse3
rev_f:
        mov   [es:edi],al
        add   edi,2
        loop  rev_f
get_f:
        call  GetKey
;some more code here
      pop   es
      popad
      ret

Some data for the above code:

Code:

WinFile      db 15,8,color2
             db 'ÚÄÄÄÄÄÄÄÄÄÄÄÄÄ¿'
             db '³ Load        ³'
             db '³ Save        ³'
             db '³ Save As     ³'
             db '³ New         ³'
             db '³ OS Shell    ³'
             db '³ Exit        ³'
             db 'ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÙ'


Ytable              dd 0, 160, 320, 480, 640, 800, 960,1120,1280,1440,1600,1760,1920
                    dd 2080,2240,2400,2560,2720,2880,3040,3200,3360,3520,3680,3840
                    dd 4000,4160, 4320, 4480, 4640, 4800, 4960,5120,5280,5440,5600,5760,5920
                    dd 6080,6240,6400,6560,6720,6880,7040,7200,7360,7520,7680,7840

Basically the "WinFile" first 3 bytes are as follows byte 1 = how wide the box is (number of chars), byte 2 = how high the box is (number of chars down), byte 3 = forground & background color.
Once the box is draw, the marked part is draw by changing the forground & background over the maked area, but keeping the chars the same.

If you have any ?, or this is not what you meant, just ask away smile .

Offline

 

#3 2006-03-02 00:08:38

Nelson
Member
Registered: 2005-07-02
Posts: 35
PM

Re: Textmode

Well I wanted to know more about the ASCII characters and how they worked and if there was any listing of them somewhere. Thanks though. smile

Offline

 

#4 2006-03-02 03:25:32

Dex4u
Active member
Registered: 2005-02-19
Posts: 132
PM

Re: Textmode

Heres a link to the char set   http://telecom.tbi.net/asc-ibm.html
me and bubach made a simple demo of how to change these unused chars
to make a logo, but you could just as easy design your own text boxs.
You can get it here:   http://www.dex4u.com/images/logo1.zip

Hope it helps.

Offline

 

#5 2006-03-02 05:01:41

Nelson
Member
Registered: 2005-07-02
Posts: 35
PM

Re: Textmode

Thanks!

Offline

 

 

Board footer

Powered by PunBB
BOS homepage © Copyright 2005 Christoffer Bubach
Strict XHTML and valid CSS.