Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Converting diskette LBA to CHS (See related posts)

// description of your code here

Put LBA address in AX and get your results in CL, CH and DH.

;-----------------------------------------------------------------------------;
;		DISKETTE_LBA_TO_CHS(AX LBA) CL Head, CH Cylinder, DH Sector   ;
;-----------------------------------------------------------------------------;
diskette_lba_to_chs:
	xor dx, dx
	mov bx, 18
        div bx
	push dx				; = Stack(1)			
	mov dx, ax
        shr ax, 2
	mov cl, al
	mov ch, dl
	pop dx				; = Stack(0)
	inc dl
	mov dh, dl
	ret

You need to create an account or log in to post comments to this site.


Click here to browse all 5141 code snippets

Related Posts