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

About this user

Piotr

« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS 

Converting diskette LBA to CHS

// description of your code here

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

   1  
   2  ;-----------------------------------------------------------------------------;
   3  ;		DISKETTE_LBA_TO_CHS(AX LBA) CL Head, CH Cylinder, DH Sector   ;
   4  ;-----------------------------------------------------------------------------;
   5  diskette_lba_to_chs:
   6  	xor dx, dx
   7  	mov bx, 18
   8          div bx
   9  	push dx				; = Stack(1)			
  10  	mov dx, ax
  11          shr ax, 2
  12  	mov cl, al
  13  	mov ch, dl
  14  	pop dx				; = Stack(0)
  15  	inc dl
  16  	mov dh, dl
  17  	ret

[ASM]Write String only using BIOS

First, set starting address of text into DS:SI registers. Procedure writes text until null-character is met.
   1  
   2  ;-----------------------------------------------------------------------------;
   3  ;		WRITE_STRING(DS:SI Text)                                      ;
   4  ;-----------------------------------------------------------------------------;
   5  ;	Writes string from DS:SI until character #0 is met		      ;
   6  Write_String:		
   7  	mov ah, 0xE	
   8  	xor bh, bh	
   9  	mov bl, 0x7
  10  .nextchar	
  11  	lodsb		
  12  	or al,al
  13  	jz .return
  14  	int 10h	
  15  	jmp .nextchar
  16  .return		
  17  	ret	
  18  
« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS