wequal的一个CMOS程式:
NAME get_cmos_data_2002_9_5
.model small
.data
head DB '************* THE FOLLOWING IS CMOS DATA! *************** '
len_head equ $-head
data db '---- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F --- '
PExit db 'PRESS ANYKEY TO EXIT ! '
len_exit equ $-PExit
buffer DB '00H: ',48 DUP(0), ' 0FH ',0dh,0ah
DB '10H: ',48 DUP(0), ' 1FH ',0dh,0ah
DB '20H: ',48 DUP(0), ' 2FH ',0dh,0ah
DB '30H: ',48 DUP(0), ' 3FH ',0dh,0ah
DB '40H: ',48 DUP(0), ' 4FH ',0dh,0ah
DB '50H: ',48 DUP(0), ' 5FH ',0dh,0ah
DB '60H: ',48 DUP(0), ' 6FH ',0dh,0ah
DB '70H: ',48 DUP(0), ' 7FH ',0dh,0ah,0dh,0ah, ' ... Total 128 bytes '
DB 0dh,0ah,0dh,0ah
DB ' 2002/08/20 ',0dh,0ah
DB ' design by wequal '
len equ $-buffer
.code
.386
.startup
pusha ; set keyboard interrupt
mov ax,seg anykey_exit
mov ds,ax
mov dx,offset anykey_exit
mov al,9
mov ah,25h
int 21h
popa
mov cx,1000h
mov ah,1h
int 10h
mov bp,seg head ;print string
mov es,bp
mov bp,offset head
mov cx,len_head
mov dx,0200h
mov bl,0f5h
mov al,0
mov ah,13h
int 10h
mov bp,offset data ;print string
mov dx,0300h
mov bl,28h
int 10h
mov bp,offset PExit ;print string
mov cx,len_exit
mov dx,0
mov bl,84h
int 10h
_rep : MOV DX,0 ; set entry port
mov si,8 ; set loop param
MOV DI,OFFSET (buffer+5)
_call: CALL outdata
add di,11
dec si
cmp si,0
jnz _call
mov bp,seg buffer ;print all string and data
mov es,bp
mov bp,offset buffer
mov cx,len
mov dx,0400h
mov bl,0ah
mov al,0
mov ah,13h
int 10h
jmp _rep
;********** get data and translate into ASCII ***********
outdata PROC
MOV CX,16
again: MOV AL,DL
OUT 70h,AL
IN AL,71h ;get CMOS data
MOV BL,AL
SHR AL,4 ;get high 4 bit
CMP AL,9 ;hex translate into ASCII
JLE decim1
ADD AL,7
decim1:ADD AL,30h
MOV [DI],AL
AND BL,0fh ;get low 4 bit
CMP BL,9
JLE decim2
ADD BL,7
decim2:ADD BL,30h
INC DI
MOV [DI],BL
INC DI
MOV [DI],BYTE PTR 20h
INC DI
INC DL
LOOP again
RET
outdata ENDP
;**;********************************************************
anykey_exit:
MOV AX,4c00h
INT 21h
.exit
end
要改写把IN 改成OUT 就可以实现!
一个CMOS程式
最新推荐文章于 2024-10-27 00:10:07 发布