Page 1 of 1
is it hard to change the encoding?
Posted: Sat Dec 30, 2006 2:58 pm
by mohammed
hi
how can i use another encoding rather ASCII..what is the hardest way ?
to redraw the ASCII or to use anthore encoding like unicode to support many languages.. actualy i want to support arabic
hay..i searched in unicode.org but i ask her about some one tried or tutorials to read it
Posted: Sat Dec 30, 2006 3:57 pm
by gaf
Hello,
While the standard letters can be exchanged with another font, you might run into problems if the letters are too long or curvy as the resolution is very low. A solution might be to switch to a graphic mode and rander the letters directly. Maybe
this thread is of any help ?
regards,
gaf
Posted: Sat Dec 30, 2006 6:30 pm
by mohammed
is there a complete tutorial for changing fonts in ascii .. ?
(i read this article befor asking)
Posted: Sat Dec 30, 2006 9:01 pm
by earlz
this thing by John Fine allows you to change video modes and fonts
the actual source code is
http://my.execpc.com/~geezer/osd/graphics/modes.c
this code is for DOS
attached is my code that I adapted to be OS independent and run in my 32bit OS
also in my code is some simple code for changing the video mode and setting the font(size) accordingly
(look for the /*PAY ATTENTION HERE )
Posted: Sun Dec 31, 2006 5:49 am
by mohammed
thanks
but what i want to do is convert the letters this letter A is the ascii encoding
00111100
01000010
01000010
01111110
......
i want to make it
00000000
00000000
00000000
00000000
....
i will make an array then........what ?in assembly ?
shall i mov it to the miscellanous graphic register or what ?
i saw this
Code: Select all
;----------------------------------------------------;
; Resizes text. ;
;----------------------------------------------------;
TextReSize:
pusha
mov ax,1112h ; Set 80x50 mode
? ? ?mov bl,0
?? int 10h
call ReProgamFonts
popa
ret
;----------------------------------------------------;
; Reprogram fonts. ;
;----------------------------------------------------;
ReProgamFonts:
push es
mov ax,ds
mov es,ax
mov bp,DexFont ;<this points to your fonts
mov cx,00FFh
xor dx,dx
mov bx,0800h
mov ax,1100h
int 10h ; ReProgams Fonts
pop es
ret
but i didn't undersatnd the "dexfont" that pionts to the font ? what is the font ? arrays of every letter ?plz complete the code to change one letter then i will complete changing the rest of the letters
Posted: Sun Dec 31, 2006 6:30 am
by inflater
Well, I use this for loading fonts on my real mode 16-bit OS:
From masm32 package, I convert the .FNT file with BINTODB. The result is a huge DB array.
I load fonts with this function (actually it is a Pascal ASM):
Code: Select all
procedure set_font(const font); assembler;
asm
push bp
les bp,font
mov ax,1100h
mov cx,100h
mov bx,1000h
xor dx,dx
int 10h
pop bp
end;
and it works, if the font is loaded for
If you want to create your own font, search Google.
inflater
Posted: Sun Dec 31, 2006 8:54 am
by Dex
mohammed wrote:thanks
but what i want to do is convert the letters this letter A is the ascii encoding
00111100
01000010
01000010
01111110
......
i want to make it
00000000
00000000
00000000
00000000
....
i will make an array then........what ?in assembly ?
shall i mov it to the miscellanous graphic register or what ?
i saw this
Code: Select all
;----------------------------------------------------;
; Resizes text. ;
;----------------------------------------------------;
TextReSize:
pusha
mov ax,1112h ; Set 80x50 mode
? ? ?mov bl,0
?? int 10h
call ReProgamFonts
popa
ret
;----------------------------------------------------;
; Reprogram fonts. ;
;----------------------------------------------------;
ReProgamFonts:
push es
mov ax,ds
mov es,ax
mov bp,DexFont ;<this points to your fonts
mov cx,00FFh
xor dx,dx
mov bx,0800h
mov ax,1100h
int 10h ; ReProgams Fonts
pop es
ret
but i didn't undersatnd the "dexfont" that pionts to the font ? what is the font ? arrays of every letter ?plz complete the code to change one letter then i will complete changing the rest of the letters
The DexFont points to a array of Dex fonts
this is a full ascii set, here is a demo to make a logo with unused fonts, but to change from one font to another is the same.
In a nutshell you go to the font number * font size and change the 0 &1 like you posted.
NOTE: The above also changes the text size from normal 80x25 to 80x50.
Posted: Sun Dec 31, 2006 11:57 am
by mohammed
thank you..
what we need from this code is this
Code: Select all
REPROGRAMFONT:
push es
mov ax,ds
mov es,ax
mov bp,V2OSFONT
mov cx,00FFh
xor dx, dx
mov bx, 0800h
mov ax, 1100h
int 10h ; REPROGRAM FONT
pop es
ret
the V2OSFONT is here
Code: Select all
V2OSFONT DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 07EH, 081H
DB 0A5H, 081H, 0BDH, 099H, 081H, 07EH, 07EH, 0FFH, 0DBH, 0FFH
be patient sir
what these nubers refer to ? the code of every character?is it a Hexadecimal reprentation of the binary "our 011111110" ?
if i want to change a specific letter how can i do this ?
i made this
Code: Select all
org 100h
use16
jmp start
%INCLUDE "v2osfont.inc"
start:
push es
mov ax,ds
mov es,ax
mov bp,V2OSFONT
mov cx,00FFh
xor dx, dx
mov bx, 0800h
mov ax, 1100h
int 10h
pop es
mov ah,099H
mov al,'a'
int 10h
but it didn't made any thing !!
if i have a pound for ever "?" i will be a millioner
give me one example for one letter
Posted: Sun Dec 31, 2006 1:14 pm
by TheQuux
If you have access to a Unix-like enviroment, you can use my psf2raw tool, based on one of the psftools. It turns a Linux psf (or psfu) font into an 8k file that can be loaded directly into VGA memory...
The tarball is attached. If you don't have psftools, it's available at
http://www.seasip.info/Unix/PSF/
Anyhow, you use it like:
psf2vga -pad <psffile> <output file>
Actually, without the -pad option, I believe that you end up with direct input to Dex's code; it can be included with "incbin" in nasm.
Finally, a multitude of font editors for psf fonts do exist... e.g. try "fonty"
[edit]Attached tarball[/edit]
Posted: Mon Jan 01, 2007 12:27 pm
by Dex
This is the bit you need:
Code: Select all
REPROGRAMFONT:
push es
mov ax,ds
mov es,ax
mov bp,V2OSFONT
mov cx,00FFh
xor dx, dx
mov bx, 0800h
mov ax, 1100h
int 10h ; REPROGRAM FONT
pop es
ret
To change font you do this, first look at the start of the v2osfont.inc
Code: Select all
V2OSFONT DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 07EH, 081H
DB 0A5H, 081H, 0BDH, 099H, 081H, 07EH, 07EH, 0FFH, 0DBH, 0FFH
Now forget the first 8 byte (as they are only 0) so start at byte 9 and convert the following 8 bytes to bin eg:
01111110
10000001
10100101
10000001
10111101
10011001
10000001
01111110
You should get this
http://www.dex4u.com/fonts/char.png
now all you need do is change the bits to make a differant font.
Now these fonts are 8 bytes in size so you convert the ascii number in dec and * it by 8 to find were the 8 byte fonts are in the inc.
eg: the above ascii char is 01.
You may beable to change just one char by that int, but i have not used it.
Posted: Mon Jan 01, 2007 4:13 pm
by mohammed
i don't know what to say
it worked
thank you !
font.asm:
Code: Select all
org 100h
use16
jmp start
%INCLUDE "myfont.inc"
start:
call REPROGRAMFONT
mov ah,0eh
mov al,01h
int 10h
REPROGRAMFONT:
push es
mov ax,ds
mov es,ax
mov bp,V2OSFONT
mov cx,00FFh
xor dx, dx
mov bx, 0800h
mov ax, 1100h
int 10h ; REPROGRAM FONT
pop es
ret
myfont.inc:
Code: Select all
V2OSFONT DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 01111110b, 10000001b
DB 10100101b, 10111101b ,10011001b,10000001b,01111110b