Real Mode VGA Text?

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.
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Post by pcmattman »

Um... The code you gave me doesn't work in my system. I am not using VESA, I'm using Mode 13 (which is 320x200x1bpp). Your character output functions don't work, unless I have them seperate of my OS and unusable :( .
User avatar
Combuster
Member
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:

Post by Combuster »

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)

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
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

You can also do it like this :

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
But you may not like the look ;).
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Post by pcmattman »

I'll give it a go and post whether or not it worked.
Post Reply