|
主题 : : 实验14:访问CMOSRAM [已解决] |
回复[ 3次 ]
点击[ 1089次 ] | |
|
|
|
|
[帖 主] [ 发表时间:2010-06-22 21:57 ] | |
荣誉值:268
信誉值:12
注册日期:2010-06-18 22:19 |
assume cs:code
data segment
str db 0,0,'/',0,0,'/',0,0,' ',0,0,':',0,0,':',0,0,'$'
var db 9,8,7,4,2,0
code segment
BtoA: push bx
push cx
mov ah,0
mov bl,16
div bl
add al,30h
add ah,30h
pop cx
pop bx
ret
start: mov ax,data
mov ds,ax
mov di,offset str
mov bx,offset var
mov cx,6
lp:
mov al,[bx]
out 70h,al
in al,71h
call BtoA
;
mov byte ptr [di],al
mov byte ptr [di+1],ah
inc bx
add di,3
dec cx
jnz lp
;
mov dx,offset str
mov ah,09h
int 21h
;
mov ah,4ch
int 21h
code ends
end start
d:\asm>
d:\asm>lab14
10/06/22 22:04:36
d:\asm> | | |
|
|
|
|
[第1楼] [ 回复时间:2010-06-23 09:33 ] | |
荣誉值:268
信誉值:12
注册日期:2010-06-18 22:19 |
修正一下, 精简了些,BtoA里的push cx和pop cx多余,
===========================================================
d:\asm>type lab14.asm
assume cs:code
data segment
str db 0,0,'/',0,0,'/',0,0,' ',0,0,':',0,0,':',0,0,'$'
var db 9,8,7,4,2,0
code segment
BtoA: push bx
mov ah,0
mov bl,16
div bl
add al,30h
add ah,30h
pop bx
ret
;
start: mov ax,data
mov ds,ax
mov di,offset str
mov bx,offset var
mov cx,6
lp:
mov al,[bx]
out 70h,al
in al,71h
call BtoA
;
mov [di],al
mov [di+1],ah
inc bx
add di,3
loop lp
;
mov dx,offset str
mov ah,09h
int 21h
;
mov ah,4ch
int 21h
code ends
end start
d:\asm> | | |
|