is it hard to change the encoding?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
mohammed
Member
Member
Posts: 93
Joined: Mon Jan 30, 2006 12:00 am
Location: Mansoura, Egypt

is it hard to change the encoding?

Post 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
User avatar
gaf
Member
Member
Posts: 349
Joined: Thu Oct 21, 2004 11:00 pm
Location: Munich, Germany

Post 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
mohammed
Member
Member
Posts: 93
Joined: Mon Jan 30, 2006 12:00 am
Location: Mansoura, Egypt

Post by mohammed »

is there a complete tutorial for changing fonts in ascii .. ?
(i read this article befor asking)
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Post 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 )
Attachments
temp_code.c
my converted code
(48.47 KiB) Downloaded 77 times
mohammed
Member
Member
Posts: 93
Joined: Mon Jan 30, 2006 12:00 am
Location: Mansoura, Egypt

Post 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
User avatar
inflater
Member
Member
Posts: 1309
Joined: Thu Sep 28, 2006 10:32 am
Location: Slovakia
Contact:

Post 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
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English :P)
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post 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.
Attachments
logo1.zip
(5.95 KiB) Downloaded 123 times
mohammed
Member
Member
Posts: 93
Joined: Mon Jan 30, 2006 12:00 am
Location: Mansoura, Egypt

Post 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 :oops:
TheQuux
Member
Member
Posts: 73
Joined: Sun Oct 22, 2006 6:49 pm

Post 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]
Attachments
psf2vga.tar.gz
(3.83 KiB) Downloaded 75 times
Last edited by TheQuux on Mon Jan 01, 2007 8:21 pm, edited 1 time in total.
My project: Xenon
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post 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.
mohammed
Member
Member
Posts: 93
Joined: Mon Jan 30, 2006 12:00 am
Location: Mansoura, Egypt

Post by mohammed »

i don't know what to say :D 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
Post Reply