When i get those functions working i will upload it so that u can see (correct and comment) what i have done.

/ Christoffer
Answer these questions and I'll rewrite/optimize your code:bubach wrote: i did some more cleaning in the code yesterday, here it is.
can somebody show me there (asm) functions for getcursorxy and/or print_char, so i can compare?
Sorry - I didn't realize it was still buggybubach wrote: Oh, i don?t care that much about optimization. The reason i "cleaned" it up was becasue the code looked like **** with for example both tabbing and spaces mixed.
The problem is that it doesn?t work. I think that is the getcursorxy and/or print_char function that is buggy.
Code: Select all
; Print char. IN: bl = char, bh = attrib
;----------------------------------------
print_char: pushad
push es
push ebx
call getcursorxy
cmp dh, 80
jb .l1
inc dl
xor dh, dh
.l1:
cmp dl, 25
jb .l2
call scroll_up
.l2:
call getcursor
movzx eax, bx
pop ebx
mov [es:(eax*2 + 0xb8000)], bx
pop es
popad
ret
Code: Select all
; Print char. IN: bl = char, bh = attrib
;----------------------------------------
print_char:
pushad
push es
push ebx
call getcursorxy
cmp dl, 25
jb .l1
cmp dh, 80
jb .l1
call scroll_up
.l1:
call getcursor
call inccursor
movzx eax, bx
pop ebx
mov [es:(eax*2 + 0xb8000)], bx
pop es
popad
ret
Code: Select all
; Display a asciiz message on the screen.
; Input: SI = Message, AL = COLOR.
;--------------------------------------------
print:
pushad
mov bh, al
.DisplayChar:
lodsb
or al, al
jz .Done
cmp al, 0x0D
je .Enter
cmp al, 0x0A
je .DisplayChar
mov bl, al
call print_char
jmp .DisplayChar
.Enter:
call getcursorxy
mov dh, 0x00
inc dl
call setcursorxy
jmp .DisplayChar
.Done:
popad
ret
Code: Select all
; Display a asciiz message on the screen.
; Input: SI = Message, AL = COLOR.
;--------------------------------------------
print:
pushad
mov bh, al
.DisplayChar:
lodsb
or al, al
jz .Done
mov bl, al
call print_char
jmp .DisplayChar
.Done:
popad
ret
how do i fix this?Candy wrote: and your stack pointer & gdt are:so that is WAY over the limit. It ends up at a 81ae which is a LOT more than 0x17.Code: Select all
esp:0x9ffc3 gdtr:base=0x88e4, limit=0x17
PS: your stack pointer is unaligned. Align it.
but how do i fix this?Candy wrote: You don't set the org for your kernel properly!
The call to your string printing function disassembles as:Your string is at 0x00100005. You currently try to print the interrupt vector table.Code: Select all
(0).[572064] [0x00100230] 0008:00100230 (unk. ctxt): mov ESI, 00000015 ; be15000000 (0).[572064] [0x00100235] 0008:00100235 (unk. ctxt): mov AL, 0e ; b00e (0).[572064] [0x00100237] 0008:00100237 (unk. ctxt): call 001000cd ; e891feffff