Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

reading a sector from floppy Disk.

Status
Not open for further replies.

sagar474

Full Member level 5
Joined
Oct 18, 2009
Messages
286
Helped
5
Reputation
10
Reaction score
5
Trophy points
1,318
Location
India,kakinada
Activity points
3,122
this code when executed should print "A"

Code:
BITS 16
start:
   mov ax, 07C0h                  ; Set data segment to where we're loaded
   mov ds, ax                  ;
   mov ax,9000h                  ;initlise the stack
   mov ss,ax                  ;
   mov sp,100h                  ;

call read_sector;


read_sector:
.Reset:
   mov      ah, 0               ; reset floppy disk function
   mov      dl, 0               ; drive 0 is floppy drive
   int      0x13               ; call BIOS
   jc      .Reset               ; If Carry Flag (CF) is set, there was an error. Try resetting again

   mov      ax, 0x1000            ; we are going to read sector to into address 0x1000:0
   mov      es, ax
   xor      bx, bx

.Read:
   mov      ah, 0x02            ; function 2
   mov      al, 1               ; read 1 sector
   mov      ch, 1               ; we are reading the second sector past us, so its still on track 1
   mov      cl, 2               ; sector to read (The second sector)
   mov      dh, 0               ; head number
   mov      dl, 0               ; drive number. Remember Drive 0 is floppy drive.
   int      0x13               ; call BIOS - Read the sector
   jc      .Read               ; Error, so try again

   jmp      0x1000:0x0            ; jump to execute the sector!
;---------------------------------------------------------------------------------------

times 510-($-$$) db 0   ; Pad remainder of boot sector with 0s
   dw 0xAA55      ; The standard PC boot signature
mov al,41h;
mov ah,0eh;
int 10h;
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top