flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Interrupts screwin' up? (Lol, sounds like rap)

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
rhyno_dagreat



Joined: 31 Jul 2006
Posts: 487
Location: Maryland, Unol Daleithiau
rhyno_dagreat
Anyways... I'm back to OS devin' after taking a short few month break!

So I finally put in my IDT and ISRs and am trying to run my OS in BOCHs and lo and behold, it only shows the message that my OS is loading in 16-bit mode and not the "Hello World" message in 32-Bit mode.

Here's the code:

INTERRUPTS.INC

Code:
;INTERRUPTS!!! YAY

Reroute_PICs:
        mov al, 11h
        out 20h, al
        out 0A0h, al

        mov al, 20h
        out 21h, al
        mov al, 28h
        out 0A1h, al

        mov al, 04h
        out 21h, al
        mov al, 02h
        out 0A1h, al

        mov al, 01h
        out 21h, al
        out 0A1h, al

        mov al, 0FFh
        out 021h, al
isr0:
        pusha
        push gs
        push fs
        push ds
        push es
        mov ax, 10h
        mov ds, ax
        mov byte [ds:0B8000h], 'E'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], 'r'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], 'r'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], '0'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], '0'
        mov byte [ds:0B8001h], 1Bh
        pop es
        pop ds
        pop fs
        pop gs
        popa
        iret

isr1:
        pusha
        push gs
        push fs
        push ds
        push es
        mov ax, 10h
        mov ds, ax
        mov byte [ds:0B8000h], 'E'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], 'r'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], 'r'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], '0'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], '1'
        mov byte [ds:0B8001h], 1Bh
        pop es
        pop ds
        pop fs
        pop gs
        popa
        iret

isr2:
        pusha
        push gs
        push fs
        push ds
        push es
        mov ax, 10h
        mov ds, ax
        mov byte [ds:0B8000h], 'E'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], 'r'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], 'r'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], '0'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], '2'
        mov byte [ds:0B8001h], 1Bh
        pop es
        pop ds
        pop fs
        pop gs
        popa
        iret

isr3:
        pusha
        push gs
        push fs
        push ds
        push es
        mov ax, 10h
        mov ds, ax
        mov byte [ds:0B8000h], 'E'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], 'r'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], 'r'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], '0'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], '3'
        mov byte [ds:0B8001h], 1Bh
        pop es
        pop ds
        pop fs
        pop gs
        popa
        iret

isr4:
        pusha
        push gs
        push fs
        push ds
        push es
        mov ax, 10h
        mov ds, ax
        mov byte [ds:0B8000h], 'E'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], 'r'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], 'r'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], '0'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], '4'
        mov byte [ds:0B8001h], 1Bh
        pop es
        pop ds
        pop fs
        pop gs
        popa
        iret

isr5:
        pusha
        push gs
        push fs
        push ds
        push es
        mov ax, 10h
        mov ds, ax
        mov byte [ds:0B8000h], 'E'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], 'r'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], 'r'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], '0'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], '5'
        mov byte [ds:0B8001h], 1Bh
        pop es
        pop ds
        pop fs
        pop gs
        popa
        iret

isr6:
        pusha
        push gs
        push fs
        push ds
        push es
        mov ax, 10h
        mov ds, ax
        mov byte [ds:0B8000h], 'E'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], 'r'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], 'r'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], '0'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], '6'
        mov byte [ds:0B8001h], 1Bh
        pop es
        pop ds
        pop fs
        pop gs
        popa
        iret

isr7:
        pusha
        push gs
        push fs
        push ds
        push es
        mov ax, 10h
        mov ds, ax
        mov byte [ds:0B8000h], 'E'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], 'r'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], 'r'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], '0'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], '7'
        mov byte [ds:0B8001h], 1Bh
        pop es
        pop ds
        pop fs
        pop gs
        popa
        iret

isr8:
        pusha
        push gs
        push fs
        push ds
        push es
        mov ax, 10h
        mov ds, ax
        mov byte [ds:0B8000h], 'E'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], 'r'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], 'r'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], '0'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], '8'
        mov byte [ds:0B8001h], 1Bh
        pop es
        pop ds
        pop fs
        pop gs
        popa
        iret

isr9:
        pusha
        push gs
        push fs
        push ds
        push es
        mov ax, 10h
        mov ds, ax
        mov byte [ds:0B8000h], 'E'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], 'r'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], 'r'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], '0'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], '9'
        mov byte [ds:0B8001h], 1Bh
        pop es
        pop ds
        pop fs
        pop gs
        popa
        iret

isr10:
        pusha
        push gs
        push fs
        push ds
        push es
        mov ax, 10h
        mov ds, ax
        mov byte [ds:0B8000h], 'E'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], 'r'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], 'r'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], '1'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], '0'
        mov byte [ds:0B8001h], 1Bh
        pop es
        pop ds
        pop fs
        pop gs
        popa
        iret

isr11:
        pusha
        push gs
        push fs
        push ds
        push es
        mov ax, 10h
        mov ds, ax
        mov byte [ds:0B8000h], 'E'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], 'r'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], 'r'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], '1'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], '1'
        mov byte [ds:0B8001h], 1Bh
        pop es
        pop ds
        pop fs
        pop gs
        popa
        iret

isr12:
        pusha
        push gs
        push fs
        push ds
        push es
        mov ax, 10h
        mov ds, ax
        mov byte [ds:0B8000h], 'E'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], 'r'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], 'r'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], '1'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], '2'
        mov byte [ds:0B8001h], 1Bh
        pop es
        pop ds
        pop fs
        pop gs
        popa
        iret

isr13:
        pusha
        push gs
        push fs
        push ds
        push es
        mov ax, 10h
        mov ds, ax
        mov byte [ds:0B8000h], 'E'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], 'r'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], 'r'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], '1'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], '3'
        mov byte [ds:0B8001h], 1Bh
        pop es
        pop ds
        pop fs
        pop gs
        popa
        iret

isr14:
        pusha
        push gs
        push fs
        push ds
        push es
        mov ax, 10h
        mov ds, ax
        mov byte [ds:0B8000h], 'E'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], 'r'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], 'r'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], '1'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], '4'
        mov byte [ds:0B8001h], 1Bh
        pop es
        pop ds
        pop fs
        pop gs
        popa
        iret

isr15:
        pusha
        push gs
        push fs
        push ds
        push es
        mov ax, 10h
        mov ds, ax
        mov byte [ds:0B8000h], 'E'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], 'r'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], 'r'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], '1'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], '5'
        mov byte [ds:0B8001h], 1Bh
        pop es
        pop ds
        pop fs
        pop gs
        popa
        iret

idt_start:

        ;int0
        dw 0x0000
        dw 0x10
        dw 0x8E00
        dw 0x10
        ;int1
        dw 0x0000
        dw 0x10
        dw 0x8E00
        dw 0x10
        ;int2
        dw 0x0000
        dw 0x10
        dw 0xE00
        dw 0x10
        ;int3
        dw 0x0000
        dw 0x10
        dw 0x8E00
        dw 0x10
        ;int4
        dw 0x0000
        dw 0x10
        dw 0x8E00
        dw 0x10
        ;int5
        dw 0x0000
        dw 0x10
        dw 0x8E00
        dw 0x10
        ;int6
        dw 0x0000
        dw 0x10
        dw 0x8E00
        dw 0x10
        ;int7
        dw 0x0000
        dw 0x10
        dw 0x8E00
        dw 0x10
        ;int8
        dw 0x0000
        dw 0x10
        dw 0x8E00
        dw 0x10
        ;int9
        dw 0x0000
        dw 0x10
        dw 0x8E00
        dw 0x10
        ;int10
        dw 0x0000
        dw 0x10
        dw 0x8E00
        dw 0x10
        ;int11
        dw 0x0000
        dw 0x10
        dw 0x8E00
        dw 0x10
        ;int12
        dw 0x0000
        dw 0x10
        dw 0x8E00
        dw 0x10
        ;int13
        dw 0x0000
        dw 0x10
        dw 0x8E00
        dw 0x10
        ;int14
        dw 0x0000
        dw 0x10
        dw 0x8E00
        dw 0x10
        ;int15
        dw 0x0000
        dw 0x10
        dw 0xE00
        dw 0x10
        ;int16
        dw 0x0000
        dw 0x10
        dw 0x8E00
        dw 0x10

idt_end:

idtp:
        dw idt_end - idt_start - 1
        dd idt_start


    


RHYNLOAD.ASM

Code:
;BOOTSTART
org 7C00h

jmp start

message db 'Loading RhynOS...',13,10,0

start:
        xor ax, ax
        mov ds, ax

        mov si, message
        call bios_print

load_os:
        mov ax, 0060h
        mov es, ax
        mov bx, 0000h
        mov ah, 02h
        mov al, 1
        mov ch, 0
        mov cl, 2
        mov dh, 0
        ;mov dl, 0  ; Not sure if needed, been told that dl already contains the drive that was booted on
        int 13h
        jmp 0060h:0000h

bios_print:
        lodsb
        or al, al
        jz done
        mov ah, 0x0E
        int 0x10
        jmp bios_print

done:
        call load_os

;BOOTEND
        times 510-($-$$) db 0
        dw 0xAA55
    


RHYNOS.ASM



Code:
include 'interrupts.inc'
org 0000h
use16
;cli

mov ax, 0060h
mov ds, ax
add dword [gdt_descriptor+2], 600h

lgdt [gdt_descriptor]

mov eax, cr0
or eax, 1
mov cr0, eax

jmp 08h:clear_pipe

gdt:
dd 0, 0
gdt_code:
db 0FFh, 0FFh, 0, 0, 0, 10011010b, 11001111b, 0
gdt_data:
db 0FFh, 0FFh, 0, 0, 0, 10010010b, 11001111b, 0
gdt_end:

gdt_descriptor:
    dw gdt_end - gdt - 1
    dd gdt

org 0600h+$
use32
clear_pipe:
mov ax, 10h
mov ds, ax
mov ss, ax

mov esp, 090000h

mov byte [ds:0B8000h], 'H'
mov byte [ds:0B8001h], 1Bh
mov byte [ds:0B8002h], 'e'
mov byte [ds:0B8003h], 1Bh
mov byte [ds:0B8004h], 'l'
mov byte [ds:0B8005h], 1Bh
mov byte [ds:0B8006h], 'l'
mov byte [ds:0B8007h], 1Bh
mov byte [ds:0B8008h], 'o'
mov byte [ds:0B8009h], 1Bh
mov byte [ds:0B800Ah], '!'
mov byte [ds:0B800Bh], 1Bh

call Reroute_PICs
lidt [idtp]

infinite_loop:
        jmp infinite_loop

times 210-($-$$) db 0
    


Any help would be greatly appreciated, thanks!
Post 22 Sep 2006, 18:13
View user's profile Send private message Reply with quote
Niels



Joined: 17 Sep 2006
Posts: 255
Niels
Hello rhyno_dagreat,

After loading the bootsector at 0x7c00 RHYNLOAD.ASM, you are loading a sector from disk this I assume is RHYNOS.ASM.

If this is true:

It's more logic setting org 0x0600, but an other problem occurs first, you are including 'interrupts.inc' this means that after jumping from RHYNLOAD.ASM to RHYNOS.ASM, it start to execute 'interrupts.inc' meaning 'already' remapping the pic, and after that executing the isr it gets an iret, that not suppose to happen... Smile
Post 22 Sep 2006, 19:20
View user's profile Send private message Reply with quote
Artlav



Joined: 23 Dec 2004
Posts: 188
Location: Moscow, Russia
Artlav
Alright...
Main problem is that's this is assembler, not HLL. So, you should think in assembler terms.

================================

Let's start from the middle.
Bootloader:
Code:
        mov ax, 0060h 
        mov es, ax 
        mov bx, 0000h 
        mov ah, 02h 
        mov al, 1 
        mov ch, 0 
        mov cl, 2 
        mov dh, 0 
        ;mov dl, 0  ; Not sure if needed, been told that dl already contains the drive that was booted on 
        int 13h 
    


Loads only one sector, while your OS uses 4. That leaves behind the idt and handlers (or most of the code in the original layout).

So, put 4 in the al.

================================

Second, putting
include 'interrupts.inc'
org 0000h
use16

in the beginning makes "Reroute_PICs" your entry point.
Position of the code from the included file will be the position of the include directive, unlike HLL's , position matters in asm.

So, put it(include 'interrupts.inc') in the very end.

-------------------------------------
Then it all goes fine in this file.
-------------------------------------

Now, let's move to the top.
"Reroute_PICs" have no ret at the end, so after it the isr0 code is called, causing TF.

-------------------------------------
At that point program becomes show-functional.
-------------------------------------

About interrupts - your IDT doesn't seems to have any sense in it, so redo this part, if you want handling int's
Post 22 Sep 2006, 19:23
View user's profile Send private message Visit poster's website Reply with quote
Niels



Joined: 17 Sep 2006
Posts: 255
Niels
Hello rhyno_dagreat,

Just a thought....

You have made a sort of template for the isr's... To me it looks like a very unlogic and slow template. If you want such a template with all push and pops, comment(Wink them, until really needed, meaning let fs be fs if it isn't used in your isr-function.

Niels.
Post 22 Sep 2006, 19:36
View user's profile Send private message Reply with quote
Niels



Joined: 17 Sep 2006
Posts: 255
Niels
Hello rhyno_dagreat,

Artlav is right about the amount of sectors.

One solution is just fill in a large amount of sectors.

An other is, putting this line at the end of RHYNOS.ASM:
times (512*N)-($-$$) db 0

Were N is the amount of sectors to be loaded, when you get an error-message from FASM, you know you gotta raise N and al.
Post 22 Sep 2006, 20:07
View user's profile Send private message Reply with quote
Niels



Joined: 17 Sep 2006
Posts: 255
Niels
For the record: I use "repeat end repeat" instead of "times" but I guess FASM being a good assembler you get the same 'error' when 512*N is lower than 0.
Post 22 Sep 2006, 20:12
View user's profile Send private message Reply with quote
Niels



Joined: 17 Sep 2006
Posts: 255
Niels
What I also 'miss' is CLI before mode-switching and remapping the PIC.
I do see you have commented one out.

Niels.
Post 22 Sep 2006, 20:25
View user's profile Send private message Reply with quote
rhyno_dagreat



Joined: 31 Jul 2006
Posts: 487
Location: Maryland, Unol Daleithiau
rhyno_dagreat
Thank you Niels!, and to Artlav, Спасибо!
The only thing is that I'm still very new to how the IDT works, and I'm using the tutorials at
[url]
http://www.osdever.net/tutorials.php?cat=5&sort=1
[/url]
namely, the three at the bottom. If someone could explain it a bit better, maybe I could write something better, and I'd be greatly appreciative.

Again, thank you! Smile
Post 22 Sep 2006, 21:16
View user's profile Send private message Reply with quote
rhyno_dagreat



Joined: 31 Jul 2006
Posts: 487
Location: Maryland, Unol Daleithiau
rhyno_dagreat
Hey again! It worked in a way. The stuff is coming up, but it's flashing between the text and a group of numbers (not my error message). So I don't know what's up with that. Could it be that I haven't created my code for the A20 line yet? Sorry, still new to OSdev.
Post 23 Sep 2006, 00:23
View user's profile Send private message Reply with quote
Niels



Joined: 17 Sep 2006
Posts: 255
Niels
I don't think the idt is right but didn't check on that, I left most code the way you put it.

Code:

;BOOTSTART
use16
org 7C00h

RHYNOS.ASM      equ     0x0600
BOOTDRIVE       equ     0x05ff

start:
        xor ax, ax
        mov ds, ax
        mov es,ax

        mov byte [BOOTDRIVE],dl

        mov si, message
        call bios_print

load_os:
        mov bx, RHYNOS.ASM
        mov ah, 02h
        mov al, 4
        mov ch, 0
        mov cl, 2
        mov dh, 0
        mov dl, [BOOTDRIVE]
        int 13h
        ; There should be a check here, before continue

        cli
        call Reroute_PICs

        jmp 0:0x0600

bios_print:
        lodsb
        or al, al
        jz done
        mov ah, 0x0E
        int 0x10
        jmp bios_print
        done:
ret

Reroute_PICs:
        mov al, 11h
        out 20h, al
        out 0A0h, al

        mov al, 20h
        out 21h, al
        mov al, 28h
        out 0A1h, al

        mov al, 04h
        out 21h, al
        mov al, 02h
        out 0A1h, al

        mov al, 01h
        out 21h, al
        out 0A1h, al

        mov al, 0FFh
        out 021h, al
ret


;DATA
message db 'Loading RhynOS...',13,10,0

;BOOTEND
        times 510-($-$$) db 0
        dw 0xAA55

include 'RHYNOS.ASM'
    



Code:
use16
org 0x0600
cli

lgdt [gdt_descriptor]

mov eax, cr0
inc eax
mov cr0, eax

mov ax, 10h
mov ds, ax
mov es, ax
mov ss, ax

mov esp, 090000h

jmp 0x08:clear_pipe

gdt:
dd 0, 0
gdt_code:
db 0FFh, 0FFh, 0, 0, 0, 10011010b, 11001111b, 0
gdt_data:
db 0FFh, 0FFh, 0, 0, 0, 10010010b, 11001111b, 0
gdt_end:

gdt_descriptor:
    dw gdt_end - gdt - 1
    dd gdt


use32
clear_pipe:


mov byte [0B8000h], 'H'
mov byte [0B8001h], 1Bh
mov byte [0B8002h], 'e'
mov byte [0B8003h], 1Bh
mov byte [0B8004h], 'l'
mov byte [0B8005h], 1Bh
mov byte [0B8006h], 'l'
mov byte [0B8007h], 1Bh
mov byte [0B8008h], 'o'
mov byte [0B8009h], 1Bh
mov byte [0B800Ah], '!'
mov byte [0B800Bh], 1Bh

lidt [idtp]
;sti

infinite_loop:
        jmp $

include 'interrupts.inc'

    



Code:

;INTERRUPTS!!! YAY
isr0:
        mov byte [ds:0B8000h], 'E'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], 'r'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], 'r'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], '0'
        mov byte [ds:0B8001h], 1Bh
        mov byte [ds:0B8000h], '0'
        mov byte [ds:0B8001h], 1Bh

   iret



idt_start:

        ;int0
        dw 0x0000
        dw 0x10
        dw 0x8E00
        dw 0x10
        ;int1
        dw 0x0000
        dw 0x10
        dw 0x8E00
        dw 0x10
        ;int2
        dw 0x0000
        dw 0x10
        dw 0xE00
        dw 0x10
        ;int3
        dw 0x0000
        dw 0x10
        dw 0x8E00
        dw 0x10
        ;int4
        dw 0x0000
        dw 0x10
        dw 0x8E00
        dw 0x10
        ;int5
        dw 0x0000
        dw 0x10
        dw 0x8E00
        dw 0x10
        ;int6
        dw 0x0000
        dw 0x10
        dw 0x8E00
        dw 0x10
        ;int7
        dw 0x0000
        dw 0x10
        dw 0x8E00
        dw 0x10
        ;int8
        dw 0x0000
        dw 0x10
        dw 0x8E00
        dw 0x10
        ;int9
        dw 0x0000
        dw 0x10
        dw 0x8E00
        dw 0x10
        ;int10
        dw 0x0000
        dw 0x10
        dw 0x8E00
        dw 0x10
        ;int11
        dw 0x0000
        dw 0x10
        dw 0x8E00
        dw 0x10
        ;int12
        dw 0x0000
        dw 0x10
        dw 0x8E00
        dw 0x10
        ;int13
        dw 0x0000
        dw 0x10
        dw 0x8E00
        dw 0x10
        ;int14
        dw 0x0000
        dw 0x10
        dw 0x8E00
        dw 0x10
        ;int15
        dw 0x0000
        dw 0x10
        dw 0xE00
        dw 0x10
        ;int16
        dw 0x0000
        dw 0x10
        dw 0x8E00
        dw 0x10

idt_end:

idtp:
        dw idt_end - idt_start - 1
        dd idt_start

    
Post 23 Sep 2006, 11:09
View user's profile Send private message Reply with quote
Niels



Joined: 17 Sep 2006
Posts: 255
Niels
fasm RHYNLOAD.ASM RHYNLOAD.BIN

Will get you to jmp $

The second CLI is not needed. I commented the STI, before enabling the idt must be correct.
Post 23 Sep 2006, 11:16
View user's profile Send private message Reply with quote
Niels



Joined: 17 Sep 2006
Posts: 255
Niels
In this particular case: A tutorial should explain to you, what you couldn't extract from the (Intel/AMD) manual.
Post 23 Sep 2006, 11:58
View user's profile Send private message Reply with quote
Niels



Joined: 17 Sep 2006
Posts: 255
Niels
To give you the idea:

;int0
dw isr0 ; Start-address of interrupt, first 16 bits
dw 0x10 ; Segment which hold the isr-code
; 5432109876543210 ; bit15 = Present, bit11 = 16/32-bit, bit10 = part of typecode, bit9 = part of typecode
dw 1000111000000000b
dw 0 ; Since the start-address of int0 is not more than 16-bit, we won't be needing the 2nd offset (16-31) other than to be 0.

Intel page.192
Post 23 Sep 2006, 12:57
View user's profile Send private message Reply with quote
Niels



Joined: 17 Sep 2006
Posts: 255
Niels
As we are just signals, let my carrier be wise.

Amen.
Post 23 Sep 2006, 13:46
View user's profile Send private message Reply with quote
rhyno_dagreat



Joined: 31 Jul 2006
Posts: 487
Location: Maryland, Unol Daleithiau
rhyno_dagreat
Neils, thank you for all the help, but Artlav put something in his previous post that I missed completely.

Quote:

Now, let's move to the top.
"Reroute_PICs" have no ret at the end, so after it the isr0 code is called, causing TF.


That's what the problem was. The Reroute_PICs didn't do a return so it continued on into ISR0 making the emulator constantly Triple-Fault and reboot.
Embarassed Talk about embarrassment!
Anyways, sorry man!

On a slightly different note though, is it possible to use stosb or lodsb to put my strings of characters into Video Memory instead of typing everything out?
Post 23 Sep 2006, 21:49
View user's profile Send private message Reply with quote
rhyno_dagreat



Joined: 31 Jul 2006
Posts: 487
Location: Maryland, Unol Daleithiau
rhyno_dagreat
Okay, I tried to put an error in the code on purpose to test it (A divide by zero), and all that happens is my emulator triplefaults and reboots constantly.
Basically I don't think the IDT is being read from. Could anyone help with that?

Also, in NASM you can do [section .text] and [section .data]. Is there an equivalent to that in FASM?

Thanks!

EDIT: I just realized that the IDT is being read from, but the IDT isn't recognizing the ISRs because I didn't put in them as the start address, like Neils told me to. Unfortunately, the first ISR isn't coming up, and cli'ing and hlt'ing like I want it to, and it's still triple-faulting and resetting constantly.
Post 23 Sep 2006, 22:53
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
If you look at your
Code:
        ;int0 
        dw 0x0000 
        dw 0x10  <******* this should be code *****
        dw 0x8E00 
        dw 0x10 
        ;int1 
    

You are using data
Maybe try something lik this:
Code:
        ;int0
        dw int0
        dw 0x8  
        dw 0x8E00 
        dw 0x10 
        ;int1 
    
Post 23 Sep 2006, 23:48
View user's profile Send private message Reply with quote
rhyno_dagreat



Joined: 31 Jul 2006
Posts: 487
Location: Maryland, Unol Daleithiau
rhyno_dagreat
IT WORKS DEX! THANKS!!! Very Happy But... Okay, I'm still very new to OSDevin' in ASM, and I pulled most of that code from tutorials and help along the way, all in mostly a learning expericence, and just to clarify: You figured out the code segment because that's where the jump to from 16bit mode occured, right? The jump I'm talking about is the:
Code:
jmp 08h:clear_pipe
    


Where 08h is the code SEGMENT and clear_pipe is the OFFSET, correct?
If I'm way off, I'd be happy for some assistance with this.
Also, I'm wondering why I need to do that far jump to access PMode instead of just going through things linearly (Y'see, the tutorial I used to learn this wasn't the best in the world, it had good code though which is why I chose it, also it was a rare tutorial in the fact that it didn't use GRUB to act as a bootloader).

Anyways, thanks for the help!
Post 24 Sep 2006, 00:19
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
If you go here: http://my.execpc.com/CE/AC/geezer/os/
get: Intel 386 Programmer's Reference Manual
and also get these 12 tuts
Protected-mode demo code

There is enough info to get you started.
Good luck .
Post 24 Sep 2006, 01:24
View user's profile Send private message Reply with quote
rhyno_dagreat



Joined: 31 Jul 2006
Posts: 487
Location: Maryland, Unol Daleithiau
rhyno_dagreat
Thanks again Dex. BTW, I tried your OS, and may I say it's pretty freakin' awesome man. Smile Keep up the good work!
Post 24 Sep 2006, 02:04
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.