Real Mode VGA Text?
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
well, first of all, its 320x200x8bpp (bpp = BITS per pixel). And i think you have enough information by now to write your own routines for the job.
Still, you can try this (untested)
Still, you can try this (untested)
Code: Select all
; SI -> address of font in DS (8 bytes of data)
; DI -> address in video memory (in ES) to start writing
; destroyed: ax, cx, dx, si, di
printchar:
mov cl, 8 ; 8 character rows
loop1:
lodsb ; load font data
mov dl, al ; move data
mov ch, 8 ; second counter in ch
loop2:
shr dx, 1 ; pop a bit into CF
sbb al, al ; load al with 0 on background, ff on foreground
and al, 15 ; use color #15 for foreground
stosb ; poke a byte to video memory
dec ch ; decrement second counter
jnz loop2 ; loop if more
add di, (320 - 8) ; go to the next scanline
dec cl ; decrement first counter
jnz loop1 ; continue with next scanline if not done
ret
You can also do it like this :
But you may not like the look .
Code: Select all
org 100h ; com file
mov ax,0013h ;set graphic mode 13h
int 10h
mov ah,13h ; request display string
mov al,00 ; set sub function
mov bx,0x0064 ; set attribute and page number
mov cx,12 ; number of letters
mov dl,1 ; screen colum
mov dh,2 ; screen row
mov bp,string ; address vof string es:bp
int 10h ; call int
xor ax,ax ; wait for keypress
int 16h
mov ax,0003h ; set text mode
int 10h
ret ; return
string: db "Hello world!" ;string