首页 > 代码库 > 汇编打印磁盘信息(二进制)

汇编打印磁盘信息(二进制)

;miOS
  
	        ORG     0X7C00  
	          
	        JMP     ENTRY  
	        DB      0x90  
	        DB      "HARIBOTE"        
	        DW      512               
	        DB      1                 
	        DW      1                 
	        DB      2                 
	        DW      224               
	        DW      2880              
	        DB      0xf0              
	        DW      9                 
	        DW      18                
	        DW      2                 
	        DD      0                 
	        DD      2880              
	        DB      0,0,0x29          
	        DD      0xffffffff        
	        DB      "HARIBOTEOS "     
	        DB      "FAT12   "        
	        RESB    18    
  
  
  
ENTRY:        
	        MOV AX,0  
	        MOV     SS,AX  
	        MOV SP,0X7C00  
	        MOV DS,AX  
	        MOV ES,AX         
		

		CALL 	GetDiskParam
		JMP	FIN
  

GetDiskParam:	
		MOV AH,0X08
		INT	0X13

		push	dx
		push	ax
		push	bx
		push	si
		CALL 	SHOW16
		pop	si
		pop	bx
		pop	ax
		pop	dx

		push	dx
		push	ax
		push	bx
		push	si
		CALL	ShowMsg
		pop	si
		pop	bx
		pop	ax
		pop	dx

		MOV 	DX,CX
		push	dx
		push	ax
		push	bx
		push	si
		CALL 	SHOW16
		pop	si
		pop	bx
		pop	ax
		pop	dx

		push	dx
		push	ax
		push	bx
		push	si
		CALL	ShowMsg
		pop	si
		pop	bx
		pop	ax
		pop	dx

		MOV	DX,BX
		push	dx
		push	ax
		push	bx
		push	si
		CALL 	SHOW16
		pop	si
		pop	bx
		pop	ax
		pop	dx
	
		ret

SHOW16:	
		ROL DX,1  
	        MOV AX,DX  
	        AND AX,1  
	        CMP AX,1  
	        JE  AA1  
	        MOV AL,"0"  
	        JMP BB1  
	AA1:    MOV AL,"1"  
	BB1:    MOV AH,0X0E  
	        MOV BX,15  
	        INT 0X10  
	        ADD SI,1  
	        CMP SI,16  
	        JB SHOW16
		ret  

		
ShowMsg:	MOV		SI,MSG	
putloop:
		MOV		AL,[SI]
		ADD		SI,1			
		CMP		AL,0
		JE		EXIST
		MOV		AH,0x0e			
		MOV		BX,15			
		INT		0x10			
		JMP		putloop
	EXIST:	ret
  
FIN:        
		HLT  
	        JMP FIN  

MSG:
		DB		0x0a, 0x0a
		DB		0

MSG2:		
		DB		"Hellow World!"
		DB		0x0a,0x0a
		DB		"Hellow World!"			
		DB		0

  
  
	        RESB    0X7DFE-$  
	        DB  0X55,0XAA 

汇编打印磁盘信息(二进制)