- [kanwangxue] 感觉楼主很乖的。有点孩子气。呵呵。 01/27 08:58
- [kanwangxue] it界,进去干嘛啊,到时候自己牛比了,首先写一个自己的语言,自己用。进入IT界不就是随波做流吗/?他 01/27 08:57
- [kanwangxue] 哥们,不要为了赚钱而学计算机。 计算机是年轻时候干的, 30岁后可以开始想赚钱,年轻嘛,不要这么悲 01/27 08:50
- [游客] 怎么说? 01/26 16:22
- [游客] 你这不行啊,差远了! 01/10 22:29
- [chinatree] 谢谢你。相信你也会成功的。 01/09 14:22
- [landyking] 哥们儿,好久不见。相信你会成功的。 12/02 23:34
- [chinatree] 哇哇,被挖坟了。莫生气,只是感觉谦虚些好,就算你的程序真的是史上最强的,也别说出来嘛,自己偷着乐就行 11/20 00:41
- [xiaoyao2012] 你的程序和我的程序比较也不见得你的程序又节约空间,在某种意义上说你的程序用了没学的指令,所以不见得你 11/19 15:39
- [heliang6291] 一起加油啊 07/02 02:45
- [游客] 急需一个汇编程序大作业。。。。。。。。。。。。。。。。。。。??? 12/28 16:50
- [游客] 这么多人喜欢你,我嫉妒了。但你不可以喜欢那么多,允许你在我不需要你的时候帮别人。如果我需要立叫立到。 11/13 13:11
- [tily] 兄弟 我来看你啦 呵呵 最近可好呀 09/26 22:17
- [stqcw] 能加我qq吗?1270911891 我在做课程设计2的时候 遇到点问题 09/24 09:16
- [stqcw] 能加我qq吗?1270911891 我的环境还是有点问题。按下A的时候不能显示满屏的A 09/20 09:36
- [stqcw] 牛人 我在xp里面运行王爽 汇编第二版 p280的例子 按下esc键没反应 呀 怎样在虚拟机里配置一 09/17 15:18
- [landyking] 呵呵,交个朋友,共同学习. 09/08 00:03
- [luyingdzx] 能知道你的QQ吗?或者请加一下我的QQ271190440,可以吗 虽然在论坛能获得解答,但是有的问 08/07 21:32
[2011-09-09 21:12] 课程设计2
在家里憋了三天,终于写出来了。
assume cs:code,ds:code,ss:code,es:code
code segment
mov ax ,offset lll;把代码写到软盘的偏移地址
push ax
cmp cx,215h;这个215H是代码总长度,如果是被操作系统执行的话CX就是215H,就会跳走到写软盘,如果是被BIOS加载的,它的值应该是随机的
jnz sl
ret
sl:mov ax,1000h;先将程序读到另一空间偏移地址为0处
mov es,ax
xor bx,bx
mov dx,bx
mov ax,201h
mov cx,1
int 13h;读软盘1号逻辑扇区到1000:0,这里的偏移地址是0,不用考虑7C00H的问题
push es
mov bx,offset m_m
push bx
retf;跳到另一个段的m_m
rrrr db 32 dup (0);定义32个栈
aaaa db "1) reset pc",0
db "2) start system",0
db "3) clock",0
db "4) set clock",0
bbbb dw offset st1,offset st2,offset st3,offset st4
m_m:mov ax,cs
mov ss,ax
mov sp,offset rrrr
add sp,32
call qingping
mov ax,0b865h
mov es,ax
xor di,di
push cs
pop ds
mov si,offset aaaa
call dddd
add di,138
call dddd
add di,130
call dddd
add di,144
call dddd
s1:in al,60h
cmp al,2
jb s1
cmp al,5;输入功能号
ja s1
sub al,2
xor bx,bx
mov bl,al
add bx,bx
call word ptr bbbb[bx];跳到定址表中的地址
jmp m_m;当子程序返回时跳到m_m重新开始
st1:mov ax,0ffffh
push ax
xor ax,ax
push ax
retf;重启只要跳到FFFF:0就好
st2:xor ax,ax;从硬盘1号逻辑扇区把操作系统读出来
mov es,ax
mov bx,7c00h
mov dx,80h
mov ax,201h
mov cx,1
int 13h
push es
mov bx,7c00h
push bx
retf
st3:call qingping;时间的子程序,以前实验时写的
jmp s_s
abcd db 9,8,7,4,2,0
db "// :: "
mov bl,1
s_s:push cs
pop ds
mov ax,0b872h
mov es,ax
xor di,di
mov si,offset abcd
mov cx,6
s_p:
mov al,[si]
out 70h,al
in al,71h
mov ah,al
shr ah,1
shr ah,1
shr ah,1
shr ah,1
and al,0fh
add ax,3030h
mov es:[di],ah
mov es:[di+1],bl
mov es:[di+2],al
mov es:[di+3],bl
mov al,[si+6]
mov es:[di+4],al
mov es:[di+5],bl
inc si
add di,6
loop s_p
in al,60h
cmp al,3bh
jnz a_a
inc bl
a_a:cmp al,1
jnz s_s
ret
st4:jmp a_s
cccc db "nn/yy/rr ss:ff:mm:",0
db 9,8,7,4,2,0
a_s:call qingping
mov ax,0b850h
mov es,ax
mov si,offset cccc
xor di,di
call dddd
mov cx,6;循环6次设置时间
mov ax,0b872h
mov es,ax
xor di,di
d_f:xor ax,ax
int 16h
cmp al,0;有时候这里得到的都是0,不知道为什么不循环等待
jz d_f
push ax
xor ax,ax
int 16h
pop bx
cmp al,39h
ja b_n
cmp al,30h
jb b_n
mov es:[di],bl
mov byte ptr es:[di+1],2
mov es:[di+2],al
mov byte ptr es:[di+3],2
add di,6
g_g:sub al,30h
sub bl,30h
shl bl,1
shl bl,1
shl bl,1
shl bl,1
xchg al,bl
add al,bl
xchg ah,al
mov al,[si]
out 70h,al
xchg ah,al
out 71h,al
b_n:inc si
loop d_f
mov si,offset cccc
call dddd
xor ax,ax
int 16h
ret
dddd:push cx;显示字符串的子程序,以0为结束标志
xor ch,ch
dd_dd:mov cl,[si]
jcxz reeet
mov es:[di],cl
mov byte ptr es:[di+1],2
add di,2
inc si
jmp dd_dd
reeet:inc si
pop cx
ret
qingping:mov cx,2000;清屏子程序
mov ax,0b800h
mov es,ax
xor di,di
c_c:mov byte ptr es:[di]," "
add di,2
loop c_c
ret
lll:mov ax,cs;把代码复制到软盘,这里的偏移地址是200,所以以下部分不会出现在软盘
mov es,ax
xor bx,bx
xor dx,dx
mov ax,301h
mov cx,1
int 13h
mov ax,offset sl
push ax
ret
code ends
end
assume cs:code,ds:code,ss:code,es:code
code segment
mov ax ,offset lll;把代码写到软盘的偏移地址
push ax
cmp cx,215h;这个215H是代码总长度,如果是被操作系统执行的话CX就是215H,就会跳走到写软盘,如果是被BIOS加载的,它的值应该是随机的
jnz sl
ret
sl:mov ax,1000h;先将程序读到另一空间偏移地址为0处
mov es,ax
xor bx,bx
mov dx,bx
mov ax,201h
mov cx,1
int 13h;读软盘1号逻辑扇区到1000:0,这里的偏移地址是0,不用考虑7C00H的问题
push es
mov bx,offset m_m
push bx
retf;跳到另一个段的m_m
rrrr db 32 dup (0);定义32个栈
aaaa db "1) reset pc",0
db "2) start system",0
db "3) clock",0
db "4) set clock",0
bbbb dw offset st1,offset st2,offset st3,offset st4
m_m:mov ax,cs
mov ss,ax
mov sp,offset rrrr
add sp,32
call qingping
mov ax,0b865h
mov es,ax
xor di,di
push cs
pop ds
mov si,offset aaaa
call dddd
add di,138
call dddd
add di,130
call dddd
add di,144
call dddd
s1:in al,60h
cmp al,2
jb s1
cmp al,5;输入功能号
ja s1
sub al,2
xor bx,bx
mov bl,al
add bx,bx
call word ptr bbbb[bx];跳到定址表中的地址
jmp m_m;当子程序返回时跳到m_m重新开始
st1:mov ax,0ffffh
push ax
xor ax,ax
push ax
retf;重启只要跳到FFFF:0就好
st2:xor ax,ax;从硬盘1号逻辑扇区把操作系统读出来
mov es,ax
mov bx,7c00h
mov dx,80h
mov ax,201h
mov cx,1
int 13h
push es
mov bx,7c00h
push bx
retf
st3:call qingping;时间的子程序,以前实验时写的
jmp s_s
abcd db 9,8,7,4,2,0
db "// :: "
mov bl,1
s_s:push cs
pop ds
mov ax,0b872h
mov es,ax
xor di,di
mov si,offset abcd
mov cx,6
s_p:
mov al,[si]
out 70h,al
in al,71h
mov ah,al
shr ah,1
shr ah,1
shr ah,1
shr ah,1
and al,0fh
add ax,3030h
mov es:[di],ah
mov es:[di+1],bl
mov es:[di+2],al
mov es:[di+3],bl
mov al,[si+6]
mov es:[di+4],al
mov es:[di+5],bl
inc si
add di,6
loop s_p
in al,60h
cmp al,3bh
jnz a_a
inc bl
a_a:cmp al,1
jnz s_s
ret
st4:jmp a_s
cccc db "nn/yy/rr ss:ff:mm:",0
db 9,8,7,4,2,0
a_s:call qingping
mov ax,0b850h
mov es,ax
mov si,offset cccc
xor di,di
call dddd
mov cx,6;循环6次设置时间
mov ax,0b872h
mov es,ax
xor di,di
d_f:xor ax,ax
int 16h
cmp al,0;有时候这里得到的都是0,不知道为什么不循环等待
jz d_f
push ax
xor ax,ax
int 16h
pop bx
cmp al,39h
ja b_n
cmp al,30h
jb b_n
mov es:[di],bl
mov byte ptr es:[di+1],2
mov es:[di+2],al
mov byte ptr es:[di+3],2
add di,6
g_g:sub al,30h
sub bl,30h
shl bl,1
shl bl,1
shl bl,1
shl bl,1
xchg al,bl
add al,bl
xchg ah,al
mov al,[si]
out 70h,al
xchg ah,al
out 71h,al
b_n:inc si
loop d_f
mov si,offset cccc
call dddd
xor ax,ax
int 16h
ret
dddd:push cx;显示字符串的子程序,以0为结束标志
xor ch,ch
dd_dd:mov cl,[si]
jcxz reeet
mov es:[di],cl
mov byte ptr es:[di+1],2
add di,2
inc si
jmp dd_dd
reeet:inc si
pop cx
ret
qingping:mov cx,2000;清屏子程序
mov ax,0b800h
mov es,ax
xor di,di
c_c:mov byte ptr es:[di]," "
add di,2
loop c_c
ret
lll:mov ax,cs;把代码复制到软盘,这里的偏移地址是200,所以以下部分不会出现在软盘
mov es,ax
xor bx,bx
xor dx,dx
mov ax,301h
mov cx,1
int 13h
mov ax,offset sl
push ax
ret
code ends
end
评论次数(2) |
浏览次数(361) |
类型(汇编作业) |
收藏此文 |