flat assembler
Message board for the users of flat assembler.

flat assembler > DOS > print character in graphic mode?

Author
Thread Post new topic Reply to topic
kty11



Joined: 30 Dec 2012
Posts: 21
Location: south korea
print character in graphic mode?
in text mode, we can use default font to print character
which means, there already is font exist.
if we can access to font,
then why don't we store them
and change to 320x200 graphic mode?
so we can easily put character in graphic mode.
(without re-inventing font)
is it possible?
if so, how can it be done?
I wonder where the font is stored.

_________________
since 1990 November 4th
Post 31 Dec 2012, 01:30
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2910
Location: 0x77760000
Roll your own bit mapper Wink
Post 31 Dec 2012, 03:16
View user's profile Send private message Reply with quote
kty11



Joined: 30 Dec 2012
Posts: 21
Location: south korea
typedef wrote:
Roll your own bit mapper :wink:

could you be more specific?
do you mean that I need make my own font and plot to screen?
I don't fully understand sorry.

_________________
since 1990 November 4th
Post 31 Dec 2012, 09:45
View user's profile Send private message Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1388
Location: Toronto, Canada
Try this link (very good information on MS-DOS):
http://stanislavs.org/helppc/

1. Opem link "Tables and Formats used by DOS & BIOS"
2. Open link "BIOS memory"

At the very end there is an address FFA6:E - this is the area, where
DOS Font is stored as a series of byte masks. Every bit in the byte
depicts a pixel on screen.

I am not sure how many bytes depicts one character - it can be 12 or it can be 8.
To figure that out - dump the contents of the first few bytes (say, 50) in binary
form, you should get something like that (for character 'A'):

01111110
10000001
10000001
10000001
11111111
10000001
10000001
10000001
... and so on...

By looking at the '1' -- you can see where one character ends and next
character begins. Because, 1's represents how pixels on screen will be painted
for that character.
Post 31 Dec 2012, 11:29
View user's profile Send private message Send e-mail Reply with quote
kty11



Joined: 30 Dec 2012
Posts: 21
Location: south korea
AsmGuru62 wrote:
Try this link (very good information on MS-DOS):
http://stanislavs.org/helppc/

1. Opem link "Tables and Formats used by DOS & BIOS"
2. Open link "BIOS memory"

At the very end there is an address FFA6:E - this is the area, where
DOS Font is stored as a series of byte masks. Every bit in the byte
depicts a pixel on screen.

I am not sure how many bytes depicts one character - it can be 12 or it can be 8.
To figure that out - dump the contents of the first few bytes (say, 50) in binary
form, you should get something like that (for character 'A'):

01111110
10000001
10000001
10000001
11111111
10000001
10000001
10000001
... and so on...

By looking at the '1' -- you can see where one character ends and next
character begins. Because, 1's represents how pixels on screen will be painted
for that character.

thank you very much

_________________
since 1990 November 4th
Post 31 Dec 2012, 12:02
View user's profile Send private message Reply with quote
freecrac



Joined: 19 Oct 2011
Posts: 117
Location: Germany Hamburg
RBIL->inter61a.zip->INTERRUP.A
Quote:

--------V-101130-----------------------------
INT 10 - VIDEO - GET FONT INFORMATION (EGA, MCGA, VGA)
AX = 1130h
BH = pointer specifier
00h INT 1Fh pointer
01h INT 43h pointer
02h ROM 8x14 character font pointer
03h ROM 8x8 double dot font pointer
04h ROM 8x8 double dot font (high 128 characters)
05h ROM alpha alternate (9 by 14) pointer (EGA,VGA)
06h ROM 8x16 font (MCGA, VGA)
07h ROM alternate 9x16 font (VGA only) (see #00021)
11h (UltraVision v2+) 8x20 font (VGA) or 8x19 font (autosync EGA)
12h (UltraVision v2+) 8x10 font (VGA) or 8x11 font (autosync EGA)
Return: ES:BP = specified pointer
CX = bytes/character of on-screen font (not the requested font!)
DL = highest character row on screen
Note: for UltraVision v2+, the 9xN alternate fonts follow the corresponding
8xN font at ES:BP+256N
BUG: the IBM EGA and some other EGA cards return in DL the number of rows on
screen rather than the highest row number (which is one less).
SeeAlso: AX=1100h,AX=1103h,AX=1120h,INT 1F"SYSTEM DATA",INT 43"VIDEO DATA"

Format of alternate font table [array]:
Offset Size Description (Table 00021)
00h BYTE character to be replaced (00h = end of table)
01h N BYTEs graphics data for character, one byte per scan line

RBIL->inter61b.zip->INTERRUP.E
Quote:

--------B-1F---------------------------------
INT 1F - SYSTEM DATA - 8x8 GRAPHICS FONT
Desc: this vector points at 1024 bytes of graphics data, 8 bytes for each
character 80h-FFh
Notes: graphics data for characters 00h-7Fh stored at F000h:FA6Eh in 100%
compatible BIOSes
Under PhysTechSoft's PTS ROM-DOS this table is fictitious.
SeeAlso: INT 10/AX=5000h,INT 43

Ralf Browns x86/MSDOS Interrupt List (RBIL)
http://www.pobox.com/~ralf
http://www.pobox.com/~ralf/files.html
ftp://ftp.cs.cmu.edu/afs/cs.cmu.edu/user/ralf/pub/

Dirk
Post 07 Jan 2013, 11:16
View user's profile Send private message Send e-mail Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
you can use fonts in graphic mode without writing your own
Example:
Code:
;**************************************
; First written for tasm
; Converted for fasm
; Assemble with fasm
; C:\fasm FirstOS.asm FirstOS.com
;**************************************
org     100h                            ; code starts at offset 100h
        use16                           ; use 16-bit code
        jmp   start
CR              EQU     13
LF              EQU     10
EOS             EQU     0
; *** Macros ***
;-------------------------------------------
; Fade the text in and out
;-------------------------------------------
Macro   Text_Stuff
{
        mov     dx,3C8h
        mov     al,100                  ; Color reg 100
        out     dx,al
        inc     dx                      ; DX = Color data
        xor     al,al
        out     dx,al                   ; R = 0
        mov     ah,Byte[ds:Text_Color]
        mov     al,ah
        shr     al,2                    ; Color / 4
        out     dx,al                   ; G
        mov     al,ah
        out     dx,al                   ; B

        cmp     Byte[ds:Fade_Dir],1
        je      @@800

; Fade up (INC)
        inc     al
        cmp     al,62
        jne     @@990
        inc     Byte[ds:Fade_Dir]      ; Set fade down flag (1)
        jmp     @@990


; Fade down (DEC)
@@800:  sub     al,2
        jnz     @@990
        dec     Byte[ds:Fade_Dir]

@@990:  mov     Byte[ds:Text_Color],al
}
;-------------------------------------------
; Draw the frame buffer to the screen
;-------------------------------------------
Macro   Draw_Flame
{
        mov     al,Byte[ds:Y_Len]
        cmp     al,94
        je      @@105
        inc     al
        cmp     al,1
        mov     Byte[ds:Y_Len],al
        jge     @@105
        jmp     Return


@@105:  cmp     Word[ds:Flame_Ofs],320 * (200-94) + 4
        je      @@205
        sub     Word[ds:Flame_Ofs],320

@@205:  mov     Word[ds:Temp],Frame + 104
        mov     di,Word[ds:Flame_Ofs]
        mov     bl,Byte[ds:Y_Len]
        xor     eax,eax

Line_Loop:
        mov     cx,3                    ; Draw 3 copies

@@305:  push    cx
        mov     si,Word[ds:Temp]       ; Display First image
        mov     cx,104/4
        rep     movsd
        pop     cx
        loop    @@305

        xor     eax,eax
        stosd
        stosd
        add     Word[ds:Temp],104      ; Next line
        dec     bl
        jnz     Line_Loop
Return:
}
;-------------------------------------------
; Calculate the next frame buffer
;-------------------------------------------
Macro   Calc_Flame
{
        mov     si,Frame + 104 - 3
        mov     cx,104 * (94+9-2)

@@101:  mov     al,Byte[ds:si+2*104]   ; Each point is set as the average of
        mov     bl,Byte[ds:si]         ; four pixels to the left below it.
        add     ax,bx
        mov     bl,Byte[ds:si+1]
        sub     ax,3
        add     ax,bx
        mov     bl,Byte[ds:si+104]
        add     ax,bx

        sar     ax,2
        jge     @@201
        xor     ax,ax

@@201:  mov     Byte[ds:si-104 + 3],al
        inc     si
        loop    @@101


; Setup botom line with random numbers
        mov     si,Frame+104*(94+9-2)
        mov     cx,104
        xor     dx,dx

@@301:  call    Random
        or      ax,ax
        js      @@401
        call    Random

@@401:  sub     al,35  
        mov     Byte[ds:si+104+3],al
        and     al,07fh
        mov     Byte[ds:si],al
        add     si,2
        loop    @@301
}
;------------------------------
; Wait for the start of VR
;------------------------------
Macro   Wait_VR
{
        mov     dx,3DAh
@@100:  in      al,dx
        test    al,8
        je      @@100
@@110:  in      al,dx
        test    al,8
        jne     @@110
}
;************************
; Main loop starts here *
;************************

start:  push    cs                      ; DS = ES = Data in code seg
        pop     ds
        push    cs
        pop     es
        mov     ax,13h                  ; 320 X 200 , 256 colors
        int     10h
        cld


; Clear variables
        mov     di,Frame
        mov     cx,(104*104*2) / 4
        xor     eax,eax
        rep     stosd


; Create fire palette
        mov     di,Palette
        xor     al,al

        mov     cx,6                    ; Black to blue  (CH = ZERO!)
        mov     bx,0102h
        mov     dx,0002h
        call    Make_Pal


; Darkblue to midblue
        mov     cl,10
        xor     ah,ah                   ; I = 0

@@10:   stosb                           ; R
        stosb                           ; G
        mov     bl,14
        sub     bl,ah                   ; B = 14 - I
        mov     Byte [ds:di],bl         ; Store I (B)
        inc     di
        inc     ah                      ; I = I+1
        loop    @@10
        
        
        mov     cl,24                   ; Midblue to brightblue
        mov     bx,182Fh
        mov     dx,0010h
        call    Make_Pal


        mov     cl,32                   ; Brightblue to lightblue/cyan
        mov     bx,101Fh
        mov     dx,0100h
        call    Make_Pal


; Setup palette
        mov     si,Palette
        mov     cl,72*3
        mov     dx,3C8h
        xor     al,al
        out     dx,al
        inc     dx
        rep     outsb


; Write string
        mov     ax,1300h
        mov     bx,0064h
        mov     cl,Byte[ds:Len_String]
        mov     dl,Byte[ds:String_Start]
        mov     dh,0Ah
        mov     bp,String
        int     10h

        push    0A000h                  ; ES = Video RAM
        pop     es

        mov   cx,350 ;1000                   ; time lenth
Main_Loop:
        push  cx
        Wait_VR
        Text_Stuff
        Draw_Flame
        Calc_Flame
        pop  cx
        dec  cx
        cmp  cx,0
        jne  Main_Loop
 
; Exit        
        mov     ax,03h                  ; Set text mode
        int     10h
        mov     ax,04C00h
        int     21h


;------------------------------
; Make one shade
;------------------------------
; In :  CX = Number of colors
;       BL = *
;       BH = /
;       DH = 0 or 1
;       AL Must be zero
;------------------------------
Make_Pal:
        xor     ah,ah                   ; AH = I

@@10a:  push    ax
        stosb                           ; Red
        stosb                           ; Green
        mov     al,ah                   ; AL = I
        mul     bl                      ; AX = AL * BL (I*BL)
        div     bh                      ; AL = AX / BH (I/BH)
        add     al,dl                   ; AL = I + DL

        or      dh,dh
        jz      @@20
        dec     di                      ; Write Green innsted
        stosb
        mov     al,63                   ; B = 63

@@20:   stosb
        pop     ax
        inc     ah                      ; I = I+1 
        loop    @@10a

        ret

;------------------------------
; AX = "Random" number
;------------------------------
Random:
        mov     ax,Word[ds:Seed]
        imul    ax,8905h
        inc     ax
        mov     Word[ds:Seed],ax

        ret


;------------------------------
; Boot program data
;------------------------------
      
Seed            dw      4321h           ; Random seed
Flame_Ofs       dw      320*200 + 4


String           db       '         WELCOME TO MiniDOS!          '
                       
Len_String      dw      38
String_Start    db      1


; The rest of memory is unused so we can use it for our buffers
Frame           =       $               ; 104*(94+9) Words
Temp            =       $ + (104*103)*2 ; Word
Y_Len           =       Temp + 2        ; Byte
Text_Color      =       Y_Len + 1       ; Byte
Fade_Dir        =       Text_Color + 1  ; Byte
Palette         =       Fade_Dir + 1    ; 72 * 3 Bytes
;------------------------------
; Boot program End
;------------------------------
                                                         
    
Post 11 Jan 2013, 12:56
View user's profile Send private message Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1388
Location: Toronto, Canada
@kty11: I wrote some code for this. Will post within next day or two.
Basically, it is a font creation program in 320x200x256.
Post 11 Jan 2013, 13:19
View user's profile Send private message Send e-mail Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2018, Tomasz Grysztar.

Powered by rwasa.