Page 1 of 1

without bios

Posted: Wed Sep 12, 2007 6:28 pm
by matias_beretta
Hello, I know I had already posted something like this, but I can't understand why this isn't working.

;HERE I USE CELDA VARIABLE TO SAVE THE CURRENT MEMORY POSITION, BUT IT DOESN'T WORK

putchar:
push 0b800h
pop es
mov di, [.celda]
mov [es:di], al
inc di
mov byte [es:di], 7
inc di
add word [.celda], 2
ret
.celda:
dw 0

;THIS IS THE SAME BUT FOR STRINGS

putstring:
mov al, [si]
inc si
cmp al, 0
je .end
call putchar
jmp putstring
.end:
ret

;THIS DOESN'T WORK ALSO

getchar:
in al, 96
cmp al, 0
je getchar
ret

Well, I hope you answer soon.

Mati Argentina...

Posted: Thu Sep 13, 2007 7:13 pm
by XCHG
The concept is really simple! The video memory of 80*25 text mode is located in the physical address of 0x000B8000. This is 0x0000:0xB800 in real mode. Since we have 80 horizontal and 25 characters, with each character equipped with one attribute byte, we will have 2000*2 = 4000 bytes of video memory. Byte#0 is the first character while Byte#1 is the first character's attribute. Byte#2 is the second character while Byte#3 is the second character's attribute and so on.

Posted: Thu Sep 13, 2007 8:06 pm
by frank
XCHG wrote:The concept is really simple! The video memory of 80*25 text mode is located in the physical address of 0x000B8000. This is 0x0000:0xB800 in real mode. Since we have 80 horizontal and 25 characters, with each character equipped with one attribute byte, we will have 2000*2 = 4000 bytes of video memory. Byte#0 is the first character while Byte#1 is the first character's attribute. Byte#2 is the second character while Byte#3 is the second character's attribute and so on.
Sorry to correct you but it is 0xB800:0000 in real mode. At least I am pretty sure. :wink:

Posted: Thu Sep 13, 2007 8:48 pm
by XCHG
Yeah. Thank you for the correction. It's been a while since I have coded anything in real mode. 0xB800:0x0000 it is.