鱼C论坛

 找回密码
 立即注册
查看: 2414|回复: 1

[汇编作业] 实验14访问CMOS RAM

[复制链接]
发表于 2017-6-7 15:01:22 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
本帖最后由 kyowjw01 于 2017-6-7 15:03 编辑

assume cs:code
code segment
start:
;***********世纪***************
                mov al,1Ch        ;在这儿赋值32h就是世纪。1Ch代表Supervisor Password
                out 70h,al        ;向地址端口70h写入要访问的单元的地址al
                in al,71h                ;从数据端口71h中取得指定单元中的数据al
               
                mov ah,al
                mov cl,4
                shr ah,cl
                and al,0fh
               
                add ax,3030h
               
                mov cl,1010b
                mov bx,0b800h
                mov es,bx
                mov byte ptr es:[160*12+0*2+0],20h
                mov byte ptr es:[160*12+0*2+1],cl
                mov byte ptr es:[160*12+1*2],ah
                mov byte ptr es:[160*12+1*2+1],cl
                mov byte ptr es:[160*12+1*2+2],al
                mov byte ptr es:[160*12+1*2+3],cl
       
;***********年***************
                mov al,1Dh        ;在这儿赋值9h就是年份。1Dh代表Supervisor Password
                out 70h,al        ;向地址端口70h写入要访问的单元的地址al
                in al,71h                ;从数据端口71h中取得指定单元中的数据al
               
                mov ah,al
                mov cl,4
                shr ah,cl
                and al,0fh
               
                add ax,3030h
               
                mov cl,1010b
                mov bx,0b800h
                mov es,bx
                mov byte ptr es:[160*12+1*2+4],ah
                mov byte ptr es:[160*12+1*2+5],cl
                mov byte ptr es:[160*12+1*2+6],al
                mov byte ptr es:[160*12+1*2+7],cl

;***********月***************
                mov al,8h
                out 70h,al        ;向地址端口70h写入要访问的单元的地址al
                in al,71h                ;从数据端口71h中取得指定单元中的数据al
               
                mov ah,al
                mov cl,4
                shr ah,cl
                and al,0fh
               
                add ax,3030h
               
                mov cl,1110b
                mov bx,0b800h
                mov es,bx
                mov byte ptr es:[160*12+1*2+8],20h
                mov byte ptr es:[160*12+1*2+9],cl
                mov byte ptr es:[160*12+1*2+10],ah
                mov byte ptr es:[160*12+1*2+11],cl
                mov byte ptr es:[160*12+1*2+12],al
                mov byte ptr es:[160*12+1*2+13],cl
               
;***********日***************
                mov al,7h
                out 70h,al        ;向地址端口70h写入要访问的单元的地址al
                in al,71h                ;从数据端口71h中取得指定单元中的数据al
               
                mov ah,al
                mov cl,4
                shr ah,cl
                and al,0fh
               
                add ax,3030h
               
                mov cl,1110b
                mov bx,0b800h
                mov es,bx
                mov byte ptr es:[160*12+1*2+14],20h
                mov byte ptr es:[160*12+1*2+15],cl
                mov byte ptr es:[160*12+1*2+16],ah
                mov byte ptr es:[160*12+1*2+17],cl
                mov byte ptr es:[160*12+1*2+18],al
                mov byte ptr es:[160*12+1*2+19],cl
               
;***********时***************
                mov al,4h
                out 70h,al        ;向地址端口70h写入要访问的单元的地址al
                in al,71h                ;从数据端口71h中取得指定单元中的数据al
               
                mov ah,al
                mov cl,4
                shr ah,cl
                and al,0fh
               
                add ax,3030h
               
                mov cl,1011b
                mov bx,0b800h
                mov es,bx
                mov byte ptr es:[160*12+1*2+20],20h
                mov byte ptr es:[160*12+1*2+21],cl
                mov byte ptr es:[160*12+1*2+22],ah
                mov byte ptr es:[160*12+1*2+23],cl
                mov byte ptr es:[160*12+1*2+24],al
                mov byte ptr es:[160*12+1*2+25],cl       
               
;***********分***************
                mov al,2h
                out 70h,al        ;向地址端口70h写入要访问的单元的地址al
                in al,71h                ;从数据端口71h中取得指定单元中的数据al
               
                mov ah,al
                mov cl,4
                shr ah,cl
                and al,0fh
               
                add ax,3030h
               
                mov cl,1011b
                mov bx,0b800h
                mov es,bx
                mov byte ptr es:[160*12+1*2+26],3Ah
                mov byte ptr es:[160*12+1*2+27],cl
                mov byte ptr es:[160*12+1*2+28],ah
                mov byte ptr es:[160*12+1*2+29],cl
                mov byte ptr es:[160*12+1*2+30],al
                mov byte ptr es:[160*12+1*2+31],cl       
               
;***********秒***************
                mov al,0h
                out 70h,al        ;向地址端口70h写入要访问的单元的地址al
                in al,71h                ;从数据端口71h中取得指定单元中的数据al
               
                mov ah,al
                mov cl,4
                shr ah,cl
                and al,0fh
               
                add ax,3030h
               
                mov cl,1011b
                mov bx,0b800h
                mov es,bx
                mov byte ptr es:[160*12+1*2+32],3Ah
                mov byte ptr es:[160*12+1*2+33],cl
                mov byte ptr es:[160*12+1*2+34],ah
                mov byte ptr es:[160*12+1*2+35],cl
                mov byte ptr es:[160*12+1*2+36],al
                mov byte ptr es:[160*12+1*2+37],cl       
               
               
                mov ax,4c00h
                int 21h
code ends
end start
               
关于实验14,我采用的是最无脑的办法完成的。大神看了估计会喷血。
我想问的问题是,访问CMOS RAM的1CH 1DH(Supervisor Password)和 60H 61H(User Password)为什么都是0000?我该如何查看实际的Password?
如图所示
微信图片_20170607145724.png
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2017-6-9 13:47:23 | 显示全部楼层
觉得要沉了。我还是继续看下面的章节吧。
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-10-6 12:19

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表