- [fenglixin70953] assume cs:code ;实验14,显示当前日期,时间 code segment 09/28 09:54
- [fenglixin70953] assume cs:code data segment db '1975','1976 09/16 17:38
- [fenglixin70953] 看了论坛的贴子,终于会了 assume cs:code code segment 05/06 18:41
- [游客] 谢谢楼上改下面这样可以成功,但用直接定址表如何实现拷贝后子程序中sub标号的定位呢。没想出来。 a 05/04 13:55
- [游客] 中断例程中的的call自己例程中子程序,应该是用jmp基于偏移变量跳转,而不能单纯的call,因为子 05/03 18:48
- [游客] table dw sub1,sub2,sub3,sub4 ------- 定址表应该用偏移距离 05/03 18:43
- [fenglixin70953] s: mov dl,0 mov cx,49 s5: pus 04/28 11:01
- [hychewei] 看不懂!!能讲讲不?还有为什么没有那么伪代码? 04/23 22:23
- [fenglixin70953] 呵 04/17 22:20
- [wdm] 不错。不过,程序没有注释和分析,就会像僵尸一样干瘪啊。 04/17 20:01
[2008-04-16 22:56] 实验14显示时间
code segment
s: db 9,8,7,4,2,0
start:mov ax,cs
mov ds,ax
mov si,offset s
mov di,0
mov cx,6
s1:push cx
mov al,[si]
out 70h,al
in al,71h
mov ah,al
mov cl,4
shr ah,cl
and al,0fh
add ah,30h
add al,30h
mov bx,0b800h
mov es,bx
mov byte ptr es:[160*12+36*2+di],ah
add di,2
mov byte ptr es:[160*12+36*2+di],al
add di,2
cmp byte ptr [si],7
ja s4 ;[si]>7
je s2 ;[si]=7
cmp byte ptr [si],0
ja s3 ;[si]>0
s2:mov dl,0 ;[si]=0
jmp short s5
s3:mov dl,3ah
jmp short s5
s4:mov dl,2fh
s5:mov byte ptr es:[160*12+36*2+di],dl
add di,2
inc si
pop cx
loop s1
mov ax,4c00h
int 21h
code ends
end start
刚开始push cx忘 了,add ah,30h也没写,结果弄得满屏方块哈
[ wdm 发表于 2008-04-17 10:25 ]
程序OK。
有时候看到那些莫名的界面,感觉还挺兴奋呢。呵呵
[ hychewei 发表于 2008-04-23 22:23 ]
看不懂!!能讲讲不?还有为什么没有那么伪代码?
[ fenglixin70953 发表于 2008-09-28 09:54 ]
assume cs:code ;实验14,显示当前日期,时间
code segment
list: db 9,8,7,4,2,0
list2: db '// :: '
start: mov ax,0b800h
mov es,ax
mov ax,cs
mov ds,ax
mov si,offset list
mov di,offset list2
mov bx,160*24+40*2
mov cx,6
s:push cx
mov al,[si]
out 70h,al
in al,71h
mov ah,al
mov cl,4
shr ah,cl
add ah,30h
and al,00001111b
add al,30h
mov byte ptr es:[bx],ah
mov byte ptr es:[bx+2],al
mov dl,[di]
mov byte ptr es:[bx+4],dl
add bx,6
inc si
inc di
pop cx
loop s
call delay
in al,60h
cmp al,10h
je ok
jmp start
ok: mov ax,4c00h
int 21h
delay:push ax
push dx
mov dx,1000h
mov ax,0
s5:sub ax,1
sbb dx,0
cmp ax,0
jne s5
cmp dx,0
jne s5
pop dx
pop ax
ret
code ends
end start