flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Displaying Text In Video Mode?

Author
Thread Post new topic Reply to topic
Dark Dude



Joined: 21 Jul 2007
Posts: 6
Dark Dude
Ok, so how would one go about displaying text in video mode?

As in like... Say I drew a window, and wanted to put a character string into the top bar of the window, how would I go about this?

It's stumped me for a while =\
Post 07 Mar 2008, 22:43
View user's profile Send private message Reply with quote
System86



Joined: 15 Aug 2007
Posts: 77
System86
If in text mode, write the characters into the text buffer (0xB800 for most text modes, 0xB000 for monochrome modes). If in graphics mode, you have to set the pixels to represent the character yourself. If you want windows, you have to keep track of the window coordinates and put the text into the write window by finding the coordinates of the window and writing the text using those coordinates.
Post 07 Mar 2008, 22:50
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4237
Location: 2018
edfed
you have many methods to put chars in graph modes.

the simpler is to build a bitmap or image font, with fixed or variable size, and then, you can dispaly chars in graph mode.

or you can build a vector font, same as the previous, but with good zoom capabilities.

there are topics on this just there. not so far.

if you are a beginner in low level asm coding, you should at least build one font and method alone. it is a good exercice.
Post 07 Mar 2008, 23:10
View user's profile Send private message Visit poster's website Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1901
DOS386
> Ok, so how would one go about displaying text in video mode?

As said, convert the font into pixels yourself Wink

You can read the 8x8 or 8x16 font from the BIOS (do NOT use the 8x14 font this way) or use your own font.

> or you can build a vector font
> if you are a beginner in low

Then you should NOT attempt to deal with "vector" fonts, but put up with a bitmap based one Wink
Post 08 Mar 2008, 00:35
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4237
Location: 2018
edfed
a way to build a bitmap font with fasm:

Code:
font:
...
.A:
db 00000000b
db 00011000b
db 00110100b
db 01100010b
db 11000001b
db 11111111b
db 11000001b
db 11000000b
db 11100000b
db 00000000b
.b:
...
    


and for vetor fonts, it is very more complex:
Code:
font:
dd ....,.A,.B,...
.A:
db @f-$-1
;;;  X+,   Y+,  trace?
db 0,10,0
db 0,-5,1
db 2,-2,1
db 1,0,1
db 2,2,1
db 0,5,1
db 0,-3,0
db -5,0,1
@@:
;;; x+,y+
db 7,0
    


i don't know how to represent a vectorial font, the one with bezier curves.. it is too much hard.
Post 08 Mar 2008, 00:48
View user's profile Send private message Visit poster's website Reply with quote
Dark Dude



Joined: 21 Jul 2007
Posts: 6
Dark Dude
Ah, thanks a lot, that's answered my question, and edfed showed me even more than I needed, thanks for that also ^^
Post 08 Mar 2008, 01:35
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
Here's one of my pmode vesa demos, that also demos vesa fonts.
http://www.dex4u.com/demos/VesaTxtDemo.zip
Post 08 Mar 2008, 04:16
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
Post 08 Mar 2008, 11:21
View user's profile Send private message Visit poster's website Reply with quote
Daedalus



Joined: 25 Mar 2007
Posts: 52
Daedalus
Maybe a bit unorthodox and not good, but when you're in mode 13h, output to the screen should still work as normal. At least it does here, hahaha. It's a bit bigger, but it works.
Post 08 Mar 2008, 20:59
View user's profile Send private message MSN Messenger Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4237
Location: 2018
edfed
yes you can outup string with bios and dos interrupts. but in pure asm, you should build your own text render function.
pseudo
Code:
;to diplay a A, Green (2) on Blue (1).
mov fs,0b800h ;; text segment
di = (x + y*80)*2
mov byte[fs:di],'A'
mov byte [fs:di+1],21h
pseudo    



for vesa, it's exactlly the same as mode 13h, just byte_per_pixel and byte_per_scan_line change, and it is not easy with real mode.

you need to be able to write in all memory.
Post 08 Mar 2008, 21:03
View user's profile Send private message Visit poster's website 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-2020, Tomasz Grysztar.

Powered by rwasa.