|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 老头子学汇编 于 2011-10-23 15:10 编辑
运行环境1: XP (vmware虚拟机), 3.5 软盘, DOS系统没有安装,不知道有没有问题
2:虚拟机软盘驱动器,连接,随便生成1.fld或1.img格式的文件就可以了
(这是把3.5软盘连接的,如果没有连接3.5软盘,那就没有效果的)
3:在虚拟机编译后,直接运行就可以了,不过360报木马,点允许
4:重启后就可以看到
代码如下:;键盘输入1,2,3,4
;1) reset pc ;重新启动计算机
;2) start systme ; 引导现有的操作系统
;3) clock ; 进入动时钟程序,F1键修改颜色,退出ESC键
;4) set clock ; 设置时间,退出ESC键,设置时间Enter(回车键)
assume cs:code
code segment
;===========读取软盘到0:7c00h位置==
ReadFloppy:mov ax,0
mov es,ax
mov bx,8000h
mov al,4
mov ch,0
mov cl,1
mov dl,0
mov dh,0
mov ah,2
int 13h
mov ax,0
mov es,ax
mov bx,7c00h
mov al,3
mov ch,0
mov cl,1
mov dl,0
mov dh,0
mov ah,2
int 13h
mov ax,0
push ax
mov ax,7e00h
push ax
retf
db 1c9h dup (0)
dw 0aa55h
;==================================
Experiment17:jmp short Experiment
;===========数据====================
Menu db "1) reset pc ",0
db "2) start system",0
db "3) clock ",0
db "4) set clock ",0
db "Input format:"
db "yy/mm/dd hh:mm:ss",0
db "Input errors Tip: "
db "99/12/31 23:59:59",0
;==================================
;===========显示菜单====================
Experiment:mov ax,cs
mov ds,ax
mov si,0
mov ax,0b800h
mov es,ax
mov di,160*12+33*2
mov bx,0
mov cx,4
Exp: mov al,ds:[si+7e02h]
cmp al,0
je short Expe
mov es:[di+bx],al
inc si
add bx,2
jmp short Exp
Expe: add si,1
mov bx,0
add di,160
loop Exp
jmp short Keyboard
;=====================================
;===========键盘输入==============
Keyboard:mov ah,0
int 16h
cmp al,"1"
je short resetpc
cmp al,"2"
je short startsystem
cmp al,"3"
je short Clearthescreen
cmp al,"4"
je short Clearthescreen
jmp short Keyboard
;================================
;============系统重启=============
resetpc:mov ax,0ffffh
push ax
mov ax,0
push ax
retf
;==================================
;=============引导现在的操作系统=====
startsystem:mov ax,0
mov es,ax
mov bx,7c00h
mov al,1
mov ch,0
mov cl,1
mov dl,80h
mov dh,0
mov ah,2
int 13h
mov ax,0
push ax
mov ax,7c00h
push ax
retf
;==========================================
;============清除屏幕========
Clearthescreen:push ax
push bx
push es
push cx
mov ax,0b800h
mov es,ax
mov bx,0
mov cx,2000
Screen: mov byte ptr es:[bx]," "
and byte ptr es:[bx+1],00000111b
or byte ptr es:[bx+1],00000111b
add bx,2
loop short Screen
pop cx
pop es
pop bx
pop ax
cmp al,"3"
je short clock
cmp al,"4"
je short kaset
call Experiment
kaset: call setclock
;===========动态时钟@修改颜色=========
clock:push bx
push es
mov ax,0b800h
mov es,ax
mov bx,0
mov si,160*12+30*2
mov bh,0
mov ah,0
mov bl,10
dec bl
xxxx: mov al,bl
out 70h,al
in al,71h
mov ah,al
mov cl,4
shr ah,cl
and al,00001111b
add ah,30h
add al,30h
cmp bl,9
je short Years
cmp bl,8
je short Month
cmp bl,7
je short Day
cmp bl,4
je short Time
cmp bl,2
je short Point
cmp bl,0
je short Second
Modify:in al,60h
cmp al,01
je short Clearthescreen
cmp al,3bh
je short Color
pop es
pop bx
jmp short clock
ssss:jmp short xxxx
aaaa:jmp short Modify
Years:mov es:[si],ah ; 年份
mov es:[si+2],al
mov byte ptr es:[si+4],"/"
dec bl
jmp short ssss
Month:mov es:[si+6],ah ;月份
mov es:[si+8],al
mov byte ptr es:[si+10],"/"
dec bl
jmp short ssss
Day: mov es:[si+12],ah ;天数
mov es:[si+14],al
mov byte ptr es:[si+16]," "
dec bl
sub bl,2
jmp short ssss
Time: mov es:[si+18],ah ;小时
mov es:[si+20],al
mov byte ptr es:[si+22],":"
sub bl,2
jmp short ssss
Point:mov es:[si+24],ah ;分钟
mov es:[si+26],al
mov byte ptr es:[si+28],":"
sub bl,2
jmp short ssss
Second:mov es:[si+30],ah ;秒
mov es:[si+32],al
mov byte ptr es:[si+34]," "
sub bl,2
jmp short ssss
Color:push bx
mov bx,160*12+30*2
mov cx,17
Colos:inc byte ptr es:[bx+1]
add bx,2
loop short Colos
pop bx
jmp short aaaa
;================================
;================修改时间============
setclock: mov ax,cs
mov ds,ax
mov si,7e3eh
mov ax,0b800h
mov es,ax
mov di,160*12+25*2
mov ch,0
set: mov cl,ds:[si]
cmp cl,0
je short Cursor
mov es:[di],cl
inc si
add di,2
jmp short set
Cursor:mov ah,2 ;
mov bh,0
mov dh,13
mov dl,38
input:int 10h
in al,60h ;
cmp al,01
je short Quit
cmp al,01ch
je short timeEnter
jjjj: push dx
cmp al,39h
je short zzzz
pop dx
push dx
cmp al,0eh
je short Clear
pop dx
wwww: mov ah,0
int 16h
cmp al,3ah
ja short LLLL
cmp al,1fh
jnb short show
LLLL: jmp short input
Quit:mov ah,2
mov bh,0
mov dx,0
int 10h
mov al,0
call Clearthescreen ;清屏
zzzz:pop dx
mov al," "
jmp short wwww
;------------显示字符------------
show:push bx
push dx
mov ah,9
mov bl,7
mov bh,0
mov cx,1
int 10h
mov ah,2
pop dx
pop bx
inc dl
cmp dl,56
je short Overflow
jmp short input
Overflow:mov ah,9
mov al," "
mov bl,7
mov bh,0
mov cx,1
int 10h
jmp short Cursor
;---------清楚字符--------------
Clear:pop dx
mov ah,2
mov al,0
dec dl
cmp dl,37
je short Cursor
int 10h
mov ah,9
mov al," "
mov bl,7
mov bh,0
mov cx,1
int 10h
jmp short wwww
;-----------------------------
;----------修改时间-----------
timeEnter:mov ax,0b800h
mov es,ax
mov di,160*13+40*2
mov al,es:[di]
cmp al,"/"
jne short Error1
mov al,es:[di+2]
cmp al,"2"
jnb short Error1
mov al,es:[di+4]
cmp al,"3"
jnb short Error1
mov al,es:[di+6]
cmp al,"/"
jne short Error1
mov al,es:[di+8]
cmp al,"4"
jnb short Error1
mov al,es:[di+12]
cmp al," "
jne short Error1
mov al,es:[di+14]
cmp al,"3"
jnb short Error1
mov al,es:[di+18]
cmp al,":"
jne short Error1
mov al,es:[di+20]
cmp al,"6"
jnb short Error1
mov al,es:[di+24]
cmp al,":"
jne short Error1
mov al,es:[di+26]
cmp al,"5"
ja short Error1
jmp short Dateissue
Goback:mov al,0
call jjjj
Error1:mov ax,cs
mov ds,ax
mov si,0
mov ax,0b800h
mov es,ax
mov di,20*160+22*2
pppp: mov al,ds:[si+7e5dh]
cmp al,0
je short Goback
mov es:[di],al
mov byte ptr es:[di+1],00000100b
inc si
add di,2
jmp short pppp
Dateissue:mov al,es:[di+8]
cmp al,"3"
jne short issue
mov al,es:[di+10]
cmp al,"1"
ja short Error1
issue: mov al,es:[di+14]
cmp al,"2"
je short TTTT
jmp short correctinput
TTTT: mov al,es:[di+16]
cmp al,"3"
ja short Error1
;------ACSLL码转换BCD码,再修改时间---
correctinput:mov ax,0b800h
mov es,ax
mov di,160*13+38*2
mov bl,9
mov cx,3
Writedate: push cx
mov ah,es:[di]
mov al,es:[di+2]
sub ah,30h
sub al,30h
mov cl,4
shl ah,cl
add ah,al
mov al,bl
out 70h,al
mov al,ah
out 71h,al
add di,6
dec bl
pop cx
loop short Writedate
mov bl,4
mov cx,3
Writedate_1:push cx
mov ah,es:[di]
mov al,es:[di+2]
sub ah,30h
sub al,30h
mov cl,4
shl ah,cl
add ah,al
mov al,bl
out 70h,al
mov al,ah
out 71h,al
add di,6
sub bl,2
pop cx
loop short Writedate_1
call Quit
start:mov ax,cs
mov es,ax
mov bx,offset ReadFloppy
mov al,3
mov ch,0
mov cl,1
mov dl,0
mov dh,0
mov ah,3
int 13h
mov ax,4c00h
int 21h
code ends
end start
|
|