flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > ISR hook |
Author |
|
mikegonta 25 Sep 2007, 21:31
[ Post removed by author. ]
Last edited by mikegonta on 27 Jan 2009, 22:00; edited 2 times in total |
|||
25 Sep 2007, 21:31 |
|
DustWolf 26 Sep 2007, 18:06
mikegonta wrote:
While I do appreciate the program you have created and am aware that it would help to simplify quite a lot in various cases a lot like mine.... my Kernel does not use file systems, much less FAT12, nor would I like to rely on any other software while testing my basic concepts for implementability. |
|||
26 Sep 2007, 18:06 |
|
mikegonta 27 Sep 2007, 00:39
[ Post removed by author. ]
Last edited by mikegonta on 27 Jan 2009, 22:01; edited 2 times in total |
|||
27 Sep 2007, 00:39 |
|
Dex4u 27 Sep 2007, 03:33
@DustWolf, here are two fasm examples:
16bit real mode example, from MiniDos Code: ;====================================================;; set interrupt vector ;;====================================================;int21_25: cmp al,19h ; No change int 19h (for rebooting) je int21_error ; Jump to int21_error label cli ; Turn off int's xor ah,ah ; 0 AH shl ax,2 ; Mul whats in AX by 4 push si ; Save SI push bx ; Save BX push es ; Save ES mov si,ax ; Move AX into SI xor bx,bx ; 0 BX mov es,bx ; Move BX into ES mov word[es:si],dx ; Move offset address to ES:SI points to. mov bx, ds ; Move DS into BX mov word[es:si+2],bx ; Move segment of address to ES:SI+2 points too. pop es ; Restore ES pop bx ; Restore BX pop si ; Restore SI sti ; Turn int's on jmp int21_exit ; Jump to int21_exit label;====================================================;; Get interrupt vector ;;====================================================;int21_35: push ds ; Save DS push si ; Save SI xor ah,ah ; 0 AH shl ax,2 ; Mul whats in AX by 4 mov si,ax ; Move AX into SI xor bx,bx ; 0 BX mov ds,bx ; DS = 0 mov bx,word[ds:si+2] ; Move the word that DS:SI+2 points to, into BX push bx ; Save BX mov bx,word [ds:si] ; Move the word that DS:SI points to, into BX pop es ; Move what was in the pushed BX into ES pop si ; Restore SI pop ds ; Restore DS jmp int21_exit ; Jump to int21_exit label pmode 32bit example from "TITANSRC" Code: get_int_vector: ; AL = interrupt number movzx eax,al shl eax,3 add eax,10800h ; add address of IDT cli mov cx,word [ds:eax+2] ; get selector mov [esp+18h],cx ; return selector in CX mov dx,word [ds:eax+6] shl edx,16 mov dx,word [ds:eax] mov [esp+14h],edx ; return offset in EDX sti jmp int_ok set_int_vector: ; CX:EDX - interrupt handler movzx eax,al ; AL = interrupt number shl eax,3 add eax,10800h ; add address of IDT cli mov word [ds:eax+2],cx ; store selector mov word [ds:eax],dx ; store offset shr edx,16 mov word [ds:eax+6],dx sti jmp int_ok |
|||
27 Sep 2007, 03:33 |
|
DustWolf 27 Sep 2007, 22:24
Dex4u: Thanks! Could you just also add the code of the 16 bit version where the dx value is derived for the interrupt set? Also I could use some code on how to do an interrupt routine (only basic structure relevant) and continue into another.
mikegonta: I'm not coding in 16 bit mode, my loader is in 16 bit mode. As such it is not relying on anything in it's runtime, only at load-time which can be dismissed. The BIOS extender you are offering, regardless of how valuable it is in most cases, is a hack and thus an undefined variable which will make the results of my idea-exploring harder to interpet. |
|||
27 Sep 2007, 22:24 |
|
Dex4u 28 Sep 2007, 02:36
DustWolf wrote: Dex4u: Thanks! Could you just also add the code of the 16 bit version where the dx value is derived for the interrupt set? Also I could use some code on how to do an interrupt routine (only basic structure relevant) and continue into another. Sure, as MiniDos is a Dos clone, its the same as calling int 21h, function 25h from dos example: Code: xor ax,axmov ds,ax mov ah,25hmov al,9hmov dx,int9hhandlerint 21h;some stuff hereint9hhandler:;some stuff hereiret Note: the above code would be called from a user program. Also the full code to MiniDos is here: http://board.flatassembler.net/topic.php?t=5275 |
|||
28 Sep 2007, 02:36 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.