flat assembler
Message board for the users of flat assembler.
Index
> DOS > Int handler install problem. Help! |
Author |
|
revolution 28 May 2008, 11:12
I don't see where you initialise the DS segment register?
|
|||
28 May 2008, 11:12 |
|
FASMresearcher 28 May 2008, 11:24
The ds initialisation I just passed...
I make it on this manaer: Code: ... mov ss, ax mov sp, main ;ss:sp=9000:7E00 mov es, ax ;es=9000 mov si, sp ;si=7E00 mov di, sp ;di=7E00 mov cx, main_length ;Full length. rep movsb ;Copy from 0000:7E00 to 9000:7E00. sti cli mov ax, 09000h mov ds, ax ;ds=9000 push ds sti |
|||
28 May 2008, 11:24 |
|
revolution 28 May 2008, 11:33
You may need to initialise DS for the copy routine also just to make sure you are not too dependant on old and possibly unknown values.
|
|||
28 May 2008, 11:33 |
|
FASMresearcher 28 May 2008, 11:59
Hmm... In other words You propouse the something like about this:
Code: ;Move itself to other place cli push cs pop ds mov ax, 09000h mov ss, ax mov sp, main ;ss:sp=9000:7E00 mov es, ax ;es=9000 mov si, sp ;si=7E00 mov di, sp ;di=7E00 mov cx, main_length ;Full length. rep movsb ;Copy from 0000:7E00 to 9000:7E00. sti ;Sets the cs and ds. cli push cs pop ds sti I understand you correctly? But the SetInerrupt routine itself does not have your doubts? |
|||
28 May 2008, 11:59 |
|
revolution 28 May 2008, 12:12
SetInterrupt routine is using DS to store the old and new int13 values, but you didn't properly define DS. Presumably you want DS to be 0x9000 during the execution of anything accessing the int13 stuff.
You need to go through all of your code line by line and determine what value of DS you need at that point. Then make sure that you have set DS to the required value somewhere beforehand. Standard procedure with 16bit code. The code above is not correct. You set DS twice but the second time it is the same value again so is useless. One assumes you want DS=0x9000 after the rep movsb. BTW: You don't need to disable interrupts when changing DS. |
|||
28 May 2008, 12:12 |
|
DJ Mauretto 28 May 2008, 12:26
Code: ;Interrupt handler installation. call SetInterrupt ;<<<<< Stop in this place... ( ;Jump to the original MBR. jmp 0000:7C00h Did you mean Code: ;Interrupt handler installation. push 9000H pop ds call SetInterrupt ;<<<<< Stop in this place... ( ;Jump to the original MBR. jmp 0000:7C00h Code: Original_13: cli pusha mov ax, [OldInt13Offset] mov [.Old13O], ax mov ax, [OldInt13Segment] mov [.Old13S], ax popa ;sti ; when processor switch to any INT clear INT FLAG pushf db 9Ah ; call far .Old13O dw 0h .Old13S dw 0h ret _________________ Nil Volentibus Arduum |
|||
28 May 2008, 12:26 |
|
FASMresearcher 28 May 2008, 12:31
Ok, cli/sti don't need for ds.
Yes, I want ds=9000h and set it value directly. Then why an initial code Code: cli mov ax, 09000h mov ds, ax ;ds=9000 push ds sti is incorrect? Identical value of the segment I use in the SetInterrupt directly too. ??? |
|||
28 May 2008, 12:31 |
|
FASMresearcher 28 May 2008, 13:58
Did you mean
Code: ;Interrupt handler installation. push 9000H pop ds call SetInterrupt ;<<<<< Stop in this place... ( ;Jump to the original MBR. jmp 0000:7C00h Yes. |
|||
28 May 2008, 13:58 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.