Page 1 of 1

when and where to create stack

Posted: Tue Jun 10, 2003 11:00 pm
by akash
I am trying to develope small os.
i can load my kernel.
i can print single characters with 10h.
but when i call function and pass pointers for printing string
it is not working.

please help

RE:when and where to create stack

Posted: Tue Jun 10, 2003 11:00 pm
by Adek336
hm another stack question

anyways, how bad does it do? is it possible to call a function and get back from it? perhaps you've got to set up [org] correctly, and test if DS is correct (I think for you it is DS = CS). You say it is a small kernel, can you post it?

Adrian

RE:when and where to create stack

Posted: Fri Jun 13, 2003 11:00 pm
by akash
Thank you Adek336 for your help.
I got it solved by foll code
before my main in kernel.
If you feel stack is less or can create problems
please let me know




[BITS 16]
group DGROUP _TEXT _DATA _BSS _STACK

extern _main
; ****************************CODE-Segment*********************************
segment _TEXT class=CODE
..start:
main:                mov ax, cs
                     mov ds, ax
                     mov es, ax
                     cli
                     mov ss, ax
                     mov sp, StackEnd
                     sti

                     call _main

.hang:               jmp .hang

; ****************************DATA-Segment*********************************
segment _DATA class=DATA

; ****************************BSS-Segment**********************************
segment _BSS class=BSS

; ****************************STACK-Segment********************************
segment _STACK class=STACK
                     resw 256
StackEnd: