me239
Joined: 06 Jan 2011
Posts: 200
|
Hey guys, here is a small ascii table for SVGA 640*480*256 mode. Here is how you use this library:
1) Put the following in your data
printf = library+2
set_vesa = library
library:
file 'ascii.sys'
2) Here are the inputs: DI = offset for text, AH = color, SI = NULL-terminated string
And that's it! This library is very limited, but it is simple to add your own characters.
code: save as ascii.sys
org 0
format binary as 'sys'
jmp set_vesa
jmp printf
set_vesa:
push ax bx
mov ax, 4f02h
mov bx, 100h
int 10h
pop bx ax
ret
printf:
call begin
begin:
pop bp
sub bp, begin
mov word[bp+cursor], di
mov byte[bp+color], ah
printf2:
lodsb
cmp al, 0
jz printf_done
cmp al, 61h
jb printf_ok
sub al, 20h
printf_ok:
push si
cmp al, '!'
jnz @f
lea si, [bp+asciiexclamation]
jmp printf_cdone
@@:
cmp al, '~'
jnz @f
lea si, [bp+asciitilda]
jmp printf_cdone
@@:
cmp al, ':'
jnz @f
lea si, [bp+asciicolon]
jmp printf_cdone
@@:
cmp al, ';'
jnz @f
lea si, [bp+asciisemicolon]
jmp printf_cdone
@@:
cmp al, '+'
jnz @f
lea si, [bp+asciiplus]
jmp printf_cdone
@@:
cmp al, '='
jnz @f
lea si, [bp+asciiequal]
jmp printf_cdone
@@:
cmp al, '-'
jnz @f
lea si, [bp+asciiminus]
jmp printf_cdone
@@:
cmp al, '_'
jnz @f
lea si, [bp+asciiunder]
jmp printf_cdone
@@:
cmp al, '`'
jnz @f
lea si, [bp+asciiapost]
jmp printf_cdone
@@:
cmp al, '('
jnz @f
lea si, [bp+asciiparenth1]
jmp printf_cdone
@@:
cmp al, ')'
jnz @f
lea si, [bp+asciiparenth2]
jmp printf_cdone
@@:
cmp al, '*'
jnz @f
lea si, [bp+asciistar]
jmp printf_cdone
@@:
cmp al, '&'
jnz @f
lea si, [bp+asciiand]
jmp printf_cdone
@@:
cmp al, '^'
jnz @f
lea si, [bp+asciipower]
jmp printf_cdone
@@:
cmp al, '%'
jnz @f
lea si, [bp+asciipercent]
jmp printf_cdone
@@:
cmp al, '@'
jnz @f
lea si, [bp+asciiat]
jmp printf_cdone
@@:
cmp al, 31h
jnz @f
lea si, [bp+asciione]
jmp printf_cdone
@@:
cmp al, 32h
jnz @f
lea si, [bp+asciitwo]
jmp printf_cdone
@@:
cmp al, 33h
jnz @f
lea si, [bp+asciithree]
jmp printf_cdone
@@:
cmp al, 34h
jnz @f
lea si, [bp+asciifour]
jmp printf_cdone
@@:
cmp al, 35h
jnz @f
lea si, [bp+asciifive]
jmp printf_cdone
@@:
cmp al, 36h
jnz @f
lea si, [bp+asciisix]
jmp printf_cdone
@@:
cmp al, 37h
jnz @f
lea si, [bp+asciiseven]
jmp printf_cdone
@@:
cmp al, 38h
jnz @f
lea si, [bp+asciieight]
jmp printf_cdone
@@:
cmp al, 39h
jnz @f
lea si, [bp+asciinine]
jmp printf_cdone
@@:
cmp al, 30h
jnz @f
lea si, [bp+asciizero]
jmp printf_cdone
@@:
cmp al, 20h
jnz @f
lea si, [bp+asciispace]
jmp printf_cdone
@@:
cmp al, 24h
jnz @f
lea si, [bp+asciidollar]
jmp printf_cdone
@@:
cmp al, 41h
jnz @f
lea si, [bp+asciia]
jmp printf_cdone
@@:
cmp al, 42h
jnz @f
lea si, [bp+asciib]
jmp printf_cdone
@@:
cmp al, 43h
jnz @f
lea si, [bp+asciic]
jmp printf_cdone
@@:
cmp al, 44h
jnz @f
lea si, [bp+asciid]
jmp printf_cdone
@@:
cmp al, 45h
jnz @f
lea si, [bp+asciie]
jmp printf_cdone
@@:
cmp al, 46h
jnz @f
lea si, [bp+asciif]
jmp printf_cdone
@@:
cmp al, 47h
jnz @f
lea si, [bp+asciig]
jmp printf_cdone
@@:
cmp al, 48h
jnz @f
lea si, [bp+asciih]
jmp printf_cdone
@@:
cmp al, 49h
jnz @f
lea si, [bp+asciii]
jmp printf_cdone
@@:
cmp al, 4ah
jnz @f
lea si, [bp+asciij]
jmp printf_cdone
@@:
cmp al, 4bh
jnz @f
lea si, [bp+asciik]
jmp printf_cdone
@@:
cmp al, 4ch
jnz @f
lea si, [bp+asciil]
jmp printf_cdone
@@:
cmp al, 4dh
jnz @f
lea si, [bp+asciim]
jmp printf_cdone
@@:
cmp al, 4eh
jnz @f
lea si, [bp+asciin]
jmp printf_cdone
@@:
cmp al, 4fh
jnz @f
lea si, [bp+asciio]
jmp printf_cdone
@@:
cmp al, 50h
jnz @f
lea si, [bp+asciip]
jmp printf_cdone
@@:
cmp al, 51h
jnz @f
lea si, [bp+asciiq]
jmp printf_cdone
@@:
cmp al, 52h
jnz @f
lea si, [bp+asciir]
jmp printf_cdone
@@:
cmp al, 53h
jnz @f
lea si, [bp+asciis]
jmp printf_cdone
@@:
cmp al, 54h
jnz @f
lea si, [bp+asciit]
jmp printf_cdone
@@:
cmp al, 55h
jnz @f
lea si, [bp+asciiu]
jmp printf_cdone
@@:
cmp al, 56h
jnz @f
lea si, [bp+asciiv]
jmp printf_cdone
@@:
cmp al, 57h
jnz @f
lea si, [bp+asciiw]
jmp printf_cdone
@@:
cmp al, 58h
jnz @f
lea si, [bp+asciix]
jmp printf_cdone
@@:
cmp al, 59h
jnz @f
lea si, [bp+asciiy]
jmp printf_cdone
@@:
cmp al, 5ah
jnz @f
lea si, [bp+asciiz]
jmp printf_cdone
@@:
cmp al, '/'
jnz @f
lea si, [bp+asciislash]
jmp printf_cdone
@@:
cmp al, '#'
jnz @f
lea si, [bp+asciipound]
jmp printf_cdone
@@:
cmp al, '<'
jnz @f
lea si, [bp+asciicarrot]
jmp printf_cdone
@@:
cmp al, '>'
jnz @f
lea si, [bp+asciicarrot2]
jmp printf_cdone
@@:
printf_cdone:
call printchar
pop si
jmp printf2
printf_done:
ret
printchar:
mov di, word[bp+cursor]
mov cx, word[si]
add si, 2
push cx di
push 0a000h
pop es
@@:
mov ch, 0
lodsb
cmp al,0
jz printchar_notzero
mov al, byte[bp+color]
printchar_notzero:
stosb
inc word[bp+count]
loop @b
pop di cx
dec ch
jz char_done
add di, 640d
push cx di
jmp @b
char_done:
mov byte[bp+comp], cl
mov cx, word[bp+comp]
add word[bp+cursor], cx
ret
count dw 0
comp dw 0
cursor dw 0
color db 07h
asciia:
db 6, 5
db 0,0,1,1,0,0
db 0,1,0,0,1,0
db 0,1,1,1,1,0
db 0,1,0,0,1,0
db 0,1,0,0,1,0
asciib:
db 6,5
db 0,1,1,1,0,0
db 0,1,0,0,1,0
db 0,1,1,1,1,0
db 0,1,0,0,1,0
db 0,1,1,1,0,0
asciic:
db 6,5
db 0,1,1,1,0,0
db 0,1,0,0,0,0
db 0,1,0,0,0,0
db 0,1,0,0,0,0
db 0,1,1,1,0,0
asciid:
db 6,5
db 0,1,1,1,0,0
db 0,1,0,0,1,0
db 0,1,0,0,1,0
db 0,1,0,0,1,0
db 0,1,1,1,0,0
asciie:
db 6,5
db 0,1,1,1,1,0
db 0,1,0,0,0,0
db 0,1,1,1,1,0
db 0,1,0,0,0,0
db 0,1,1,1,1,0
asciif:
db 6,5
db 0,1,1,1,1,0
db 0,1,0,0,0,0
db 0,1,1,1,1,0
db 0,1,0,0,0,0
db 0,1,0,0,0,0
asciig:
db 6,5
db 0,1,1,1,1,0
db 0,1,0,0,0,0
db 0,1,0,1,1,0
db 0,1,0,0,1,0
db 0,1,1,1,1,0
asciih:
db 6,5
db 0,1,0,0,1,0
db 0,1,0,0,1,0
db 0,1,1,1,1,0
db 0,1,0,0,1,0
db 0,1,0,0,1,0
asciii:
db 6,5
db 0,1,1,1,0,0
db 0,0,1,0,0,0
db 0,0,1,0,0,0
db 0,0,1,0,0,0
db 0,1,1,1,0,0
asciij:
db 6,5
db 0,0,1,1,1,0
db 0,0,0,1,0,0
db 0,0,0,1,0,0
db 0,1,0,1,0,0
db 0,1,1,1,0,0
asciik:
db 6,5
db 0,1,0,0,1,0
db 0,1,0,1,0,0
db 0,1,1,0,0,0
db 0,1,0,1,0,0
db 0,1,0,0,1,0
asciil:
db 6,5
db 0,1,0,0,0,0
db 0,1,0,0,0,0
db 0,1,0,0,0,0
db 0,1,0,0,0,0
db 0,1,1,1,1,0
asciim:
db 6,5
db 0,1,0,0,1,0
db 0,1,1,1,1,0
db 0,1,0,0,1,0
db 0,1,0,0,1,0
db 0,1,0,0,1,0
asciin:
db 6,5
db 0,1,0,0,1,0
db 0,1,1,0,1,0
db 0,1,0,1,1,0
db 0,1,0,0,1,0
db 0,1,0,0,1,0
asciio:
db 6,5
db 0,0,1,1,0,0
db 0,1,0,0,1,0
db 0,1,0,0,1,0
db 0,1,0,0,1,0
db 0,0,1,1,0,0
asciip:
db 6,5
db 0,1,1,1,1,0
db 0,1,0,0,1,0
db 0,1,1,1,1,0
db 0,1,0,0,0,0
db 0,1,0,0,0,0
asciiq:
db 6,5
db 0,0,1,1,0,0
db 0,1,0,0,1,0
db 0,1,0,0,1,0
db 0,1,0,1,1,0
db 0,0,1,1,1,1
asciir:
db 6,5
db 0,1,1,1,1,0
db 0,1,0,0,1,0
db 0,1,1,1,1,0
db 0,1,0,1,0,0
db 0,1,0,0,1,0
asciis:
db 6,5
db 0,1,1,1,1,0
db 0,1,0,0,0,0
db 0,1,1,1,1,0
db 0,0,0,0,1,0
db 0,1,1,1,1,0
asciit:
db 6,5
db 0,1,1,1,0,0
db 0,0,1,0,0,0
db 0,0,1,0,0,0
db 0,0,1,0,0,0
db 0,0,1,0,0,0
asciiu:
db 6,5
db 0,1,0,0,1,0
db 0,1,0,0,1,0
db 0,1,0,0,1,0
db 0,1,0,0,1,0
db 0,0,1,1,0,0
asciiv:
db 6,5
db 0,1,0,0,1,0
db 0,1,0,0,1,0
db 0,1,0,0,1,0
db 0,0,1,1,0,0
db 0,0,1,1,0,0
asciiw:
db 6,5
db 0,1,0,0,1,0
db 0,1,0,0,1,0
db 0,1,0,0,1,0
db 0,1,1,1,1,0
db 0,1,0,0,1,0
asciix:
db 6,5
db 0,1,0,0,1,0
db 0,1,0,0,1,0
db 0,0,1,1,0,0
db 0,1,0,0,1,0
db 0,1,0,0,1,0
asciiy:
db 6,5
db 0,1,0,0,1,0
db 0,1,0,0,1,0
db 0,0,1,1,0,0
db 0,0,1,0,0,0
db 0,1,0,0,0,0
asciiz:
db 6,5
db 0,1,1,1,1,0
db 0,0,0,1,0,0
db 0,0,1,0,0,0
db 0,1,0,0,0,0
db 0,1,1,1,1,0
asciione:
db 6,5
db 0,0,1,1,0,0
db 0,0,1,1,0,0
db 0,0,1,1,0,0
db 0,0,1,1,0,0
db 0,0,1,1,0,0
asciitwo:
db 6,5
db 0,1,1,1,1,0
db 0,0,0,0,1,0
db 0,1,1,1,1,0
db 0,1,0,0,0,0
db 0,1,1,1,1,0
asciithree:
db 6,5
db 0,1,1,1,1,0
db 0,0,0,0,1,0
db 0,1,1,1,1,0
db 0,0,0,0,1,0
db 0,1,1,1,1,0
asciifour:
db 6,5
db 0,1,1,1,1,0
db 0,1,0,0,1,0
db 0,1,1,1,1,0
db 0,0,0,0,1,0
db 0,0,0,0,1,0
asciifive:
db 6,5
db 0,1,1,1,1,0
db 0,1,0,0,0,0
db 0,1,1,1,1,0
db 0,0,0,0,1,0
db 0,1,1,1,1,0
asciisix:
db 6,5
db 0,1,0,0,0,0
db 0,1,0,0,0,0
db 0,1,1,1,1,0
db 0,1,0,0,1,0
db 0,1,1,1,1,0
asciiseven:
db 6,5
db 0,1,1,1,1,0
db 0,0,0,0,1,0
db 0,0,0,0,1,0
db 0,0,0,0,1,0
db 0,0,0,0,1,0
asciieight:
db 6,5
db 0,1,1,1,1,0
db 0,1,0,0,1,0
db 0,1,1,1,1,0
db 0,1,0,0,1,0
db 0,1,1,1,1,0
asciinine:
db 6,5
db 0,1,1,1,1,0
db 0,1,0,0,1,0
db 0,1,1,1,1,0
db 0,0,0,0,1,0
db 0,0,0,0,1,0
asciizero:
db 6,5
db 0,0,1,1,0,0
db 0,1,0,0,1,0
db 0,1,0,0,1,0
db 0,1,0,0,1,0
db 0,0,1,1,0,0
asciislash:
db 6,5
db 0,0,0,0,1,0
db 0,0,0,1,1,0
db 0,0,1,1,0,0
db 0,1,1,0,0,0
db 0,1,0,0,0,0
asciiexclamation:
db 6,5
db 0,0,1,1,0,0
db 0,0,1,1,0,0
db 0,0,1,1,0,0
db 0,0,0,0,0,0
db 0,0,1,1,0,0
asciispace:
db 6,5
db 0,0,0,0,0,0
db 0,0,0,0,0,0
db 0,0,0,0,0,0
db 0,0,0,0,0,0
db 0,0,0,0,0,0
asciicolon:
db 6,5
db 0,0,1,1,0,0
db 0,0,1,1,0,0
db 0,0,0,0,0,0
db 0,0,1,1,0,0
db 0,0,1,1,0,0
asciisemicolon:
db 6,5
db 0,0,1,1,0,0
db 0,0,1,1,0,0
db 0,0,0,0,0,0
db 0,0,1,1,0,0
db 0,0,0,1,0,0
asciiapost:
db 6,5
db 1,1,0,0,0,0
db 0,1,1,0,0,0
db 0,0,0,0,0,0
db 0,0,0,0,0,0
db 0,0,0,0,0,0
asciiminus:
db 6,5
db 0,0,0,0,0,0
db 0,0,0,0,0,0
db 0,1,1,1,1,0
db 0,0,0,0,0,0
db 0,0,0,0,0,0
asciiunder:
db 6,5
db 0,0,0,0,0,0
db 0,0,0,0,0,0
db 0,0,0,0,0,0
db 0,0,0,0,0,0
db 0,1,1,1,1,0
asciiequal:
db 6,5
db 0,0,0,0,0,0
db 0,1,1,1,1,0
db 0,0,0,0,0,0
db 0,1,1,1,1,0
db 0,0,0,0,0,0
asciiplus:
db 6,5
db 0,0,1,0,0,0
db 0,0,1,0,0,0
db 1,1,1,1,1,0
db 0,0,1,0,0,0
db 0,0,1,0,0,0
asciitilda:
db 6,5
db 0,0,0,0,0,0
db 0,1,1,0,1,1
db 1,0,1,1,0,0
db 0,0,0,0,0,0
db 0,0,0,0,0,0
asciipower:
db 6,5
db 0,0,1,1,0,0
db 0,1,1,1,1,0
db 0,1,0,0,1,0
db 0,0,0,0,0,0
db 0,0,0,0,0,0
asciistar:
db 6,5
db 0,1,0,0,1,0
db 0,1,1,1,1,0
db 0,1,1,1,1,0
db 0,1,0,0,1,0
db 0,0,0,0,0,0
asciiand:
db 6,5
db 0,0,1,1,1,0
db 0,1,0,0,0,0
db 0,1,1,0,1,0
db 0,1,0,1,0,0
db 0,1,1,1,1,0
asciiparenth1:
db 6,5
db 0,0,1,1,0,0
db 0,1,1,0,0,0
db 0,1,1,0,0,0
db 0,1,1,1,0,0
db 0,0,1,1,0,0
asciiparenth2:
db 6,5
db 0,0,1,1,0,0
db 0,0,0,1,1,0
db 0,0,0,1,1,0
db 0,0,0,1,1,0
db 0,0,1,1,0,0
asciipercent:
db 6,5
db 0,1,1,0,1,0
db 0,1,1,1,1,0
db 0,0,1,1,0,0
db 0,1,1,1,1,0
db 0,1,0,1,1,0
asciidollar:
db 6,5
db 0,1,1,1,1,0
db 0,1,0,1,0,0
db 0,1,1,1,1,0
db 0,0,0,1,1,0
db 0,1,1,1,1,0
asciiat:
db 6,5
db 0,0,1,1,0,0
db 0,1,0,1,1,0
db 0,1,1,0,1,0
db 0,1,0,1,0,0
db 0,0,1,1,0,0
asciipound:
db 6,5
db 0,0,1,0,1,0
db 1,1,1,1,1,1
db 0,1,0,0,1,0
db 1,1,1,1,1,1
db 0,1,0,1,0,0
asciicarrot:
db 6,5
db 0,0,0,1,1,0
db 0,0,1,1,0,0
db 0,1,1,0,0,0
db 0,0,1,1,0,0
db 0,0,0,1,1,0
asciicarrot2:
db 6,5
db 0,1,1,0,0,0
db 0,0,1,1,0,0
db 0,0,0,1,1,0
db 0,0,1,1,0,0
db 0,1,1,0,0,0
example program using library
org 100h
start:
call set_vesa
mov si, msg
mov ah, 7
xor di, di
call printf
int 20h
msg db "123", 0
set_vesa = library
printf = library+2
library:
file 'ascii.sys'
|