您的位置:首页 > 其它

U盘启动并读取dx寄存器的值

2016-11-13 16:35 197 查看
;miOS
ORG     0X7C00
JMP ENTRY
NOP

;文件系统设置
;BIOS PARAMETER BLOCK
DB "MSDOS5.0"		;OEM
DW 512				;Bytes_per_sector
DB 32				;Sectors_per_cluster
DW 38				;Reserved_sectors
DB 2				;Number_of_FATs
DW 0				;Root_entries
DW 0				;Sectors_small
DB 0XF8				;Media_descriptor
DW 0                                ;Sectors_per_FAT_small
DW 63				;Sectors_per_track
DW 255				;Heads
DD 0				;Hidden_sectors
DD 65536000				;Sectors

;FAT32 SECTION
DD 15993				;Sectors_per_FAT
DW 0				;Extended_flags
DW 0				;Version
DD 2				;Root_dir_1st_cluster
DW 1				;FSInfo_sector
DW 6				;Backup_boot_sector
RESB 12
DB 0				;BIOS_drive
DB 0
DB 0X29				;Ext_boot_signature
DB 0X07				;Volume_serial_number
DB 0XD1
DB 0X99
DB 0X00
DB "HU-OS      "			;Volume_label
DB "FAT32-HU"			;File_system

ENTRY:
MOV AX,0
MOV SS,AX
MOV SP,0X7C00
MOV DS,AX
MOV ES,AX
MOV SI,0

CALL    GetDiskParam
JMP FIN

GetDiskParam:
MOV AH,0X08
INT 0X13

push    dx
push    ax
push    bx
push    si
PUSH 	SI
CALL    SHOW16
pop si
pop bx
pop ax
pop dx
ret

SHOW16:
ROL DX,1
push ax
MOV AX,DX
AND AX,1
CMP AX,1
JE  AA1
MOV AL,0x30
JMP BB1
AA1:    MOV AL,0x31
BB1:    MOV AH,0X0E
MOV BX,15
INT 0X10
pop ax
ADD ax,1
CMP ax,16
JB SHOW16
ret

ShowMsg:    MOV     SI,MSG2
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	"0"
db	"1"
DB      "1Hellow World!"
DB      0x0a,0x0a
DB      "Hellow World!"
DB      0

RESB 510-($-$$)
DB  0X55,0XAA
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: