王爽《汇编语言》课程设计二

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

先运行代码1,再运行代码2,要利用虚拟机代码1

assume cs:code

code segment

NewStart1:jmp short NewStart2

db '1) reset pc ',0

db '2) start system ',0

db '3) clock ',0

db '4) set clock ',0

s5 dw 8 dup (0)

s6 db "aaaa/aa/aa aa:aa:aa",0

NewStart2:mov bx,200h

mov ds,bx

mov bx,0b800h

mov es,bx

mov si,2

mov bp,160*10+30*2

mov cx,4

show:push cx

mov di,0

mov cx,16

show1:mov al,ds:[si]

mov es:[bp+di],al

add di,2

inc si

loop show1

pop cx

add bp,158

loop show

mov bx,66

mov word ptr ds:[bx],0

mov word ptr ds:[bx+2],0ffffh

ccc:mov ah,0

int 16h

cmp al,'1'

je reset

cmp al,'2'

je startsystem

cmp al,'3'

je clock

cmp al,'4'

je setclock

jmp ccc

reset:mov bx,200h

mov ds,bx

mov bx,66

jmp dword ptr ds:[bx] startsystem:mov bx,0

mov es,bx

mov bx,7c00h

mov dl,80h

mov dh,0

mov ch,0

mov cl,1

mov al,1

mov ah,2

int 13h

mov bx,0

push bx

mov bx,7c00h

push bx

retf

setclock:jmp short setclock1

b db 'aaaaaaaaaaaaaa' setclock1:

push ax

push si

push ds

push dx

mov ax,200h

mov ds,ax

mov si,offset b

mov dx,0

call getstr

call str

pop dx

pop ds

pop si

pop ax

call cls

jmp near ptr NewStart1

clock:call cls

mov bx,200h

mov ds,bx

mov bx,0

mov es,bx

mov bx,66

push es:[9*4]

pop ds:[bx+10]

push es:[9*4+2]

pop ds:[bx+12]

cli

mov word ptr es:[9*4],offset int9

mov es:[9*4+2],ds

sti

s4:mov si,offset s6

mov al,32h

call s

mov [si],ah

mov [si+1],al

add si,2

mov al,9

mov cx,3

s1:mov bl,al

call s

mov [si],ah

mov [si+1],al

add si,3

mov al,bl

dec al

loop s1

mov si,offset s6

add si,11

mov al,4

mov cx,3

s2:mov bl,al

call s

mov [si],ah

mov [si+1],al

add si,3

mov al,bl

sub al,2

loop s2

mov bx,0b800h

mov es,bx

mov si,offset s6

mov di,160*6+40*2

mov cx,19

s3:mov bl,[si]

mov es:[di],bl

inc si

add di,2

loop s3

jmp short s4

s:push cx

out 70h,al

in al,71h

mov ah,al

mov cl,4

shr ah,cl

and al,00001111b

add ah,30h

add al,30h

pop cx

ret

cls:push es

push bx

push cx

mov bx,0b800h

mov es,bx

mov bx,0

mov cx,2000

s10:mov byte ptr es:[bx],' '

add bx,2

loop s10

pop cx

pop bx

pop es

ret

相关文档
最新文档