当前位置:网站首页>Compile homework after class
Compile homework after class
2022-07-06 17:02:00 【My71】
Homework 1: Letter conversion
demand
- prompt # No. end procedure .
- Prompt for a character .
- Judge whether the character is legal (a~z A~Z)
- Legal input : Prompt the conversion result : Enter the conversion result .
- illegal input : Count , End the program more than three times .
- Input # No. end procedure .
flow chart

Code implementation
data segment
count db 33h
input db "Input $"
program db " end of the program$"
prompt db "Please enter a character: $"
message db "Please enter the correct characters $"
result db "The results: $"
data ends
code segment
assume cs:code,ds:data
main:
mov ax,data
mov ds,ax
mov dx,offset input
call ah09
mov dl,23h
call ah02
mov dx,offset program
call ah09
call br
jmp start
start: ; Start
mov dx,offset prompt
call ah09
mov ah,01h
int 21h
call br
cmp al,23h
jz edit
cmp al,5bh
jl upper
cmp al,60h
jg lower
upper: ; Handle capitalization
cmp al,41h
jl error
add al,20h
jmp print
lower: ; Handle lowercase
cmp al,7ah
jg error
sub al,20h
jmp print
print: ; Output
mov dx,offset result
call ah09
mov dl,al
call ah02
call br
jmp start
error: ; Error handling
dec count
cmp count,30h
jz edit
mov dx,offset message
call ah09
call br
jmp start
edit:
mov ah,4ch
int 21h
ah09 proc near
push ax
mov ah,09h
int 21h
pop ax
ret
ah09 endp
ah02 proc near
push ax
mov ah,02h
int 21h
pop ax
ret
ah02 endp
br proc near
push dx
mov dl,0ah
call ah02
pop dx
ret
br endp
code ends
end main
Homework 2: Timer effect
demand
- 00 ~ 99 Cycle show .
- Print a number every time .
- Clear the last output number before printing the current number .
- Press any key to exit the program
flow chart

Code implementation
data segment
ten db 30h
bis db 30h
data ends
code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax
fbis:
mov ah,0bh
int 21h
cmp al,00h
jnz exit
mov dl,ten
call d02
mov dl,bis
call d02
call timer
mov dl,0dh
call d02
inc bis
cmp bis,3ah
jb fbis
inc ten
mov bis,30h
cmp ten,3ah
jb fbis
mov ten,30h
mov bis,30h
jmp fbis
exit:
mov ah,4ch
int 21h
d02 proc near
mov ah,02h
int 21h
ret
d02 endp
timer proc near
push cx
push dx
mov cx,1000h
fori:
mov dx,50h
forj:
dec dx
cmp dx,0h
jg forj
dec cx
cmp cx,0h
jg fori
pop dx
pop cx
ret
timer endp
code ends
end start
Homework 3: Analog hexadecimal conversion
demand
- Put the value to be converted into BL In the register ( Advanced version : Input from keyboard )
- Output BL Binary and hexadecimal data stored in .
flow chart

Code
code segment
assume cs:code
start:
mov bl,0a1h
call toBinary
call toHexade
edit:
mov ah,4ch
int 21h
toBinary proc near
push bx
push cx
push dx
mov cx,8
loopi:
rol bl,1
mov dl,bl
and dl,01h
add dl,30h
call d02
loop loopi
mov dl,'B'
call d02
call br
pop dx
pop cx
pop bx
ret
toBinary endp
toHexade proc near
push bx
push cx
push dx
mov cx,2
loopj:
push cx
mov cl,4
rol bl,cl
pop cx
mov dl,bl
and dl,0fh
cmp dl,09h
jg letter
jng number
letter:
add dl,37h
jmp print
number:
add dl,30h
print:
call d02
loop loopj
mov dl,'H'
call d02
pop dx
pop cx
pop bx
ret
toHexade endp
d02 proc near
mov ah,02h
int 21h
ret
d02 endp
br proc near
push dx
mov dl,0ah
call d02
pop dx
ret
br endp
code ends
end start
边栏推荐
- Activiti目录(一)重点介绍
- Activiti目录(三)部署流程、发起流程
- Shell_ 03_ environment variable
- Fdog series (V): use QT to imitate QQ to realize login interface to main interface, function chapter.
- Many papers on ByteDance have been selected into CVPR 2021, and the selected dry goods are here
- ~71 abbreviation attribute of font
- Yum install XXX reports an error
- ~74 JD top navigation bar exercise
- ~81 long table
- 8086 分段技术
猜你喜欢

7-5 blessing arrived

Fdog series (I): think about it. It's better to write a chat software. Then start with the imitation QQ registration page.

~86m rabbit practice

~79 Movie card exercise

7-4 harmonic average

「博士毕业一年,我拿下 ACL Best Paper」

Record the error reason: terminate called after throwing an instance

Shell_ 05_ operator

~87 animation

Solr word segmentation analysis
随机推荐
Yum install XXX reports an error
一个数10年工作经验的微服务架构老师的简历
8086 分段技术
字节跳动多篇论文入选 CVPR 2021,精选干货都在这里了
字节跳动开源GAN模型压缩框架,算力最高节省97.8%丨ICCV 2021
string. How to choose h and string and CString
J'ai traversé le chemin le plus fou, le circuit cérébral d'un programmeur de saut d'octets
How to configure hosts when setting up Eureka
服务器端渲染(SSR)和客户端渲染(CSR)的区别
登陆验证koa-passport中间件的简单使用
Install docker under windows10 (through Oracle VM VirtualBox)
was unable to send heartbeat
汇编语言段定义
[graduation project] QT from introduction to practice: realize imitation of QQ communication, which is also the last blog post in school.
The "advertising maniacs" in this group of programmers turned Tiktok advertisements into ar games
Only learning C can live up to expectations top5 S1E8 | S1E9: characters and strings & arithmetic operators
Solr new core
Shell_ 05_ operator
7-5 blessing arrived
Usage of insert() in vector