码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2014-12-07 21:48:22      阅读:181      评论:0      收藏:0      [点我收藏+]

标签:blog   io   ar   os   sp   2014   log   ad   as   

;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 

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

标签:blog   io   ar   os   sp   2014   log   ad   as   

原文地址:http://blog.csdn.net/hutao1101175783/article/details/41790427

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!