Page 1 of 1

Problem making interrupts in real mode

Posted: Wed Sep 17, 2003 11:00 pm
by bubach
I have a problem with my OS interrupts. When i just used a bootsector (for my hello world os), it worked fine.. I used the source in Daniel Marjamäki´s minios to make my interrupts. the code looked like this:

; Some constants:
stackseg      equ    0x0000        ; SS:SP = 0000:FFFF
stackofs      equ    0xFFFF        ;
progseg       equ    0x1000        ; Put user programs at 1000:0000
progofs       equ    0x0000        ;


[ORG 7C00h]


; Bootstrap stuff
       jmp    0:start              ; Setup the segment registers
start:                             ; CS=0, DS=0, ES=0
       mov    ax, cs               ;
       mov    ds, ax               ;
       mov    es, ax               ;

       cli                         ; Setup the stack
       mov    ax, stackseg         ;
       mov    ss, ax               ;
       mov    sp, stackofs         ;
       sti                         ;


; Kernel stuff
       mov    [es:80h], word INT20 ; Create a system call
       mov    [es:82h], word 0     ;

...... ; some code.    at the end of the bootsector file:

INT20:
       cmp    ah, 0         ; 0 = terminate
       je     near terminate

       cmp    ah, 1         ; 1 = print
       je     print

       cmp    ah, 2         ; 2 = input
       je     input

       iret

.......



after that i changed so the bootsector support fat12 and load my .BIN file.
i tested to use the same interrupt code in my kernel, but it dos not work..
i think that it is becasue ES don´t have the same value in this bootsector code as in my kernel.
Can i write something that would work instead of "[es:80h]" and "[es:82h]"?

/Christoffer