News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

An Extra expirience question

Started by Rockphorr, April 10, 2006, 06:26:50 AM

Previous topic - Next topic

Rockphorr

Hi,
I try to write hot reboot program.
So I try load and run boot sector to load dos over already loaded dos.
But after start my program halts PC.
What must I do to offload DOS ?

;=======[ SEGMENT ]===============================
OS_sector_1\
SEGMENT AT 7C0h ; 0000h:7C00h

sector_1\
DB 512 DUP (?)

OS_sector_1\
ENDS

;=======[ SEGMENT ]===============================
OS_boot\
SEGMENT AT 0
ORG 7C00h

Boot_start\
LABEL FAR

OS_boot\
ENDS

;=======[ SEGMENT ]===============================

LBR_CODE\
SEGMENT PARA PUBLIC 'CODE'
start:
mov AX,CS
mov DS,AX
mov AX,OS_sector_1
mov ES,AX
int 19h

mov AL,'C'
sub AL,'A'
mov CX,-1
lea BX,INT25h_data
int 25h

xor AX,AX
mov DS,AX
mov ES,AX

mov BX,0400h
cli
mov SS,AX
mov SP,BX
sti

jmp Boot_start

mov AH,4Ch
int 21h


INT25h_data label byte
DWORD 0h
WORD 1h
DWORD Boot_start
LBR_CODE\
ENDS

;=======[ SEGMENT ]===============================
LBR_STACK\
SEGMENT PARA STACK 'STACK'

BYTE 512 dup (?)

LBR_STACK\
ENDS

END start
Strike while the iron is hot - Бей утюгом, пока он горячий

MichaelW

As part of its initialization process DOS hooks some of the interrupt vectors. For most of these vectors DOS will at some point call the previous handler. If the previous handler is in the BIOS then no problem, but if the previous handler is in the previously loaded DOS, then in most cases the handler will be effectively calling it self. The solution is to restore the affected interrupt vectors to what they were when the BIOS booted DOS. The only really portable method of doing this that I know of is to restart the BIOS.


eschew obfuscation

Rockphorr

Quote from: MichaelW on April 10, 2006, 07:20:40 AM
As part of its initialization process DOS hooks some of the interrupt vectors. For most of these vectors DOS will at some point call the previous handler. If the previous handler is in the BIOS then no problem, but if the previous handler is in the previously loaded DOS, then in most cases the handler will be effectively calling it self. The solution is to restore the affected interrupt vectors to what they were when the BIOS booted DOS. The only really portable method of doing this that I know of is to restart the BIOS.



Thanx, and do You know numbers of these int handlers?
Strike while the iron is hot - Бей утюгом, пока он горячий

MichaelW

Which interrupt vectors DOS hooks probably depends on the version of DOS and how it is configured. I think the BIOS probably initializes all of the interrupt vectors, but as far as I know the vectors from 80h to FFh are not normally used. The BIOS on one of my systems sets the vectors from 00h to 5Fh, and from 68h to 77h, to handers in the BIOS (or in the VGA BIOS for 10h, 1Fh, 43h, and 6Dh), and sets the remaining vectors to 0000:0000. There are published "Compatibility Tables" that specify the standard entry points for most of the BIOS functions, but the tables do not include all of the entry points, and I think recent systems commonly deviate from the standards. For a specific system running a specific version of DOS and with a specific configuration (BIOS and DOS), you could determine which vectors needed to be restored, but I doubt that you could depend on this to work for other systems.

eschew obfuscation