Pregunta

My simple code:

  [ORG 0x7C00]
  MOV       AH,0x02     ;Using the function of reading floppy
  MOV       AL,0x01     ;The number of sectors to be read is 1.
  MOV       CH,0x00     ;Only read 0 track
  MOV       CL,0x03     ;Only read the third sector
  MOV       DH,0x00     ;Only read the 0 head
  MOV       DL,0x00     ;Using driver 0
  INT       13H

  JMP $ ;Just for loop forever


  TIMES 510 - ($ - $$) db 0 ;This is for 1 sector(512 bytes)
  DW 0xAA55 ;This is for the end of boot sector

After I run by bochsdbg.

It shows:

  (0) Breakpoint 1, 0x00007c00 in ?? ()
  Next at t=12943079
  (0) [0x00007c00] 0000:7c00 (unk. ctxt): mov ah, 0x02              ; b402
  <bochs:3> c
  00012943849i[FDD  ] read() on floppy image returns 0
  00012989063i[CPU0 ] LOCK prefix unallowed (op1=0x53, attr=0x0, mod=0x0, nnn=0)

I think INT 13 should return error status with CF=1 not stop by that error message.

What's happened? How to fixed it?

Thank you~

¿Fue útil?

Solución

Your problem is probably caused by your code crashing and/or executing "unknown" code (e.g. data that happens to look like an invalid instruction).

To fix the problem you need to fix the bugs in your code. The most likely bug is not telling the BIOS where to load the sector (ES:BX should contain the address you want the BIOS to load the sector), and because you don't set ES:BX before using the "load sector/s" BIOS function you probably trash something important (like your own code or stack, or maybe the IVT).

Other bugs include not setting up a valid stack and not checking for errors (and not retrying); but these bugs are much less likely to cause your current problem.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top