Без int 13h программа не продолжает работу

; ==================================================================
; NASM source code.
; Final two bytes being the boot signature (AA55h). Note that in FAT12,
; a cluster is the same as a sector: 512 bytes.
; ==================================================================

    BITS 16

    org 7C00h

    jmp short bootloader_start  ; Jump past disk description section
    nop                         ; Pad out before disk description

; ------------------------------------------------------------------
; Bios parameter block BPB
; Disk description table, to make it a valid floppy
; Note: some of these values are hard-coded in the source!
; Values are those used by IBM for 1.44 MB, 3.5" diskette

OEMLabel            db "MSDOS622"   ; seg000:0003 Disk label
BytesPerSector      dw 512          ; seg000:000B Bytes per sector 200h
SectorsPerCluster   db 1            ; seg000:000D Sectors per cluster
ReservedForBoot     dw 1            ; seg000:000E Reserved sectors for boot record
NumberOfFats        db 2            ; seg000:0010 Number of copies of the FAT
RootDirEntries      dw 224          ; seg000:0011 Number of entries in root dir e0h
                                    ; (224 * 32 = 7168 = 14 sectors to read)
LogicalSectors      dw 2880         ; seg000:0013 Number of logical sectors b40h
MediumByte          db 0F0h         ; seg000:0015 Medium descriptor byte
SectorsPerFat       dw 9            ; seg000:0016 Sectors per FAT
SectorsPerTrack     dw 18           ; seg000:0018 Sectors per track (36/cylinder) 12h
Sides               dw 2            ; seg000:001A Number of sides/heads
HiddenSectors       dd 0            ; seg000:001C Number of hidden sectors
LargeSectors        dd 0            ; seg000:0020 Number of LBA sectors i.e. 32 bit                                         ; version of number of sectors
DriveNo             db 0            ; seg000:0024 Drive No: 0 for A: floppy, 80h for HDD
CurrentHead         db 0            ; seg000:0025 Current Head
Signature           db 41           ; seg000:0026 Drive signature: 41d 29h for floppy
VolumeID            dd 00000000h    ; seg000:0027 Volume ID: any number
VolumeLabel         db "MSDOS622   "; seg000:002B Volume Label: any 11 chars
FileSystem          db "FAT12   "   ; seg000:0036 File system type: don't change!

; ------------------------------------------------------------------
; Main bootloader code

CurTrk      EQU bootloader_start+ 0 
CurSec      EQU bootloader_start+ 2

bootloader_start:
    cli             ; Disable interrupts while changing stack
    xor AX,AX
    mov SS,AX       ;Work in stack just below this routine
    mov SP,7C00h
    
    sti             ; Interrupts OK now

    push    ss
    pop     es
    
    push    ES
    pop DS                          ; DS = ES = code = 0.

    ;------------------------------
    
    ;начало секции 1

    mov BX, 500h        ; sector to go in at 00500h

    mov al, 1           ; disk read 1 sector

    mov AH, 2h          ;=2
    mov DX, 0   ;[CurTrk]
    mov CL,6
    shl DH,CL
    or  DH,  2  ;[CurSec]
    mov CX,DX
    xchg    CH,CL
    mov DL, 0
    mov DH, 1   ;curr head
    int 13h 

    ;конец секции 1

    ;------------------------------

    mov ax, 33
    mov dx, 0

    mov BX,700h     ;offset of ibmbio(IBMLOAD) to be loaded.
    mov CX,3    ;# of sectors to read.

Do_While:
    push    AX
    push    DX
    push    CX
    call    DoDiv           ; DX:AX = sector number.

    mov al, 1           ; Read 1 sector at a time.
                    ; This is to handle a case of media
                    ; when the first sector of IBMLOAD is the
                    ; the last sector in a track.
    call    DoCall          ; Read the sector.
    pop CX
    pop DX
    pop AX

    add AX,1            ; Next sector number.
    adc DX,0
    add BX,[BytesPerSector] ; Adjust buffer address.
    loop    Do_While


DISKOK:
    mov CH,[MediumByte]
    mov DL,0
    mov BX,33       ; Get bios sector in bx BiosLow = 21h 33d
    mov AX,0        ; Value is 0h
    jmp 70h:0               ; CRANK UP THE DOS

; ------------------------------------------------------------------
; BOOTLOADER SUBROUTINES

DoDiv:
    cmp DX,[SectorsPerTrack]        ; To prevent overflow!!!
    jae DivOverFlow     ; Compare high word with the divisor.
    div word [SectorsPerTrack]      ; AX = Total tracks, DX = sector number
    inc DL          ; We assume SecPerTrack < 255 & DH=0
                    ; curSec is 1-based.
    mov [CurSec], DL        ; Save it
    xor DX,DX
    div word [Sides]
    mov [CurrentHead],DL        ;Also, NumHeads < 255.
    mov [CurTrk],AX
    clc
    ret

DivOverFlow:
    stc

EndWR:
    ret

;------------------------------

; Issue one read request. ES:BX have the transfer address,
; AL is the number of sectors.

DoCall:
    mov AH, 2h          ;=2
    mov DX,[CurTrk]
    mov CL,6
    shl DH,CL
    or  DH,[CurSec]
    mov CX,DX
    xchg    CH,CL
    mov DL, [DriveNo]
    mov DH, [CurrentHead]
    int 13h
    ret

; ------------------------------------------------------------------
; STRINGS AND VARIABLES

    Bio db "IO      SYS"
    Dos db "MSDOS   SYS"

    ;SysMsg db "Non-System disk or disk error",0Dh,0Ah,"Replace and press any key when ;ready",0Dh,0Ah,0

    SysMsg  db "Non-System disk or disk error",0Dh,0Ah, 0 

; ------------------------------------------------------------------
; END OF BOOT SECTOR

    times 510-($-$$) db 0   ; Pad remainder of boot sector with zeros
    dw 0AA55h       ; Boot signature (DO NOT CHANGE!)


Я отметил коментарием "начало секция 1" и "конец секция 1" - так вот если эту секцию кода убрать - загрузчик зависает. Если оставить эту секцию кода- загружается без проблем. В чем тут может быть дело? Это сокращенный код boot sector - а. Сократил до минимума.


Ответы (0 шт):