without bios

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
User avatar
matias_beretta
Member
Member
Posts: 101
Joined: Mon Feb 26, 2007 3:39 pm

without bios

Post 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...
User avatar
XCHG
Member
Member
Posts: 416
Joined: Sat Nov 25, 2006 3:55 am
Location: Wisconsin
Contact:

Post 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.
On the field with sword and shield amidst the din of dying of men's wails. War is waged and the battle will rage until only the righteous prevails.
frank
Member
Member
Posts: 729
Joined: Sat Dec 30, 2006 2:31 pm
Location: East Coast, USA

Post 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:
User avatar
XCHG
Member
Member
Posts: 416
Joined: Sat Nov 25, 2006 3:55 am
Location: Wisconsin
Contact:

Post 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.
On the field with sword and shield amidst the din of dying of men's wails. War is waged and the battle will rage until only the righteous prevails.
Post Reply