当前位置:网站首页>Assembly Language Learning (6) Curriculum Design 1
Assembly Language Learning (6) Curriculum Design 1
2022-08-09 14:50:00 【The target is a technology curtilage】
This part is divided into the first10Course design of part of the chapter after.
The main task is to experiment in sevenPower ideaCompany's data according to below format displayed on the screen.
实验思路:
1.The main body of the code is a traversal21行的循环.
2.对于每行,The most important job is to将dataPart of the value is copied to theMemory location can be displayed on the screen.
Set the register,data段部分,Segment address withds
寄存器,偏移地址用bp
和si
寄存器.
The screen part,Segment address withes
寄存器,偏移地址用di
寄存器.
Note that at the beginning of each row,需要重新给di
赋值,每行结束后,需要对es
、bp
、si
进行处理.
3.For each row to replicate data,首先将Vintage copy过来,之后通过调用函数Conversion and copy the rest of the data.
4.编写子程序用于转化数据:
Call before writing spill-resistant function,反复除以10后加30h入栈,Then the stack deposited in the corresponding position memory.
5.一定不能忘记,Every word of two word unit,The first word JieCunASCII码,The second word JieCun properties.
出现过的问题:
1.似乎使用[bp]
默认的是ss:[bp]
,所以最好加上ds:[bp]
.
2.按理说应该是从B8000h
Memory can show,但是The actual experimentB8168h
都显示不出来.Didn't know what went wrong,调试了很久……Now guess may be to press the enter key when debugging,Lead to back up a few lines.
3.The other register is less,所以需要The use of planning in advance register.
代码为:
assume cs:code,ds:data,ss:stack
data segment
year db '1975','1976','1977','1978','1979','1980','1981','1982','1983'
db '1984','1985','1986','1987','1988','1989','1990','1991','1992'
db '1993','1994','1995'
income dd 16,22,382,1356,2390,8000,16000,24486,50065,97479,140417,197514
dd 345980,590827,803530,1183000,1843000,2759000,3753000,4649000,5937000
employeenum dw 3,7,9,13,28,38,130,220,476,778,1001,1442,2258,2793,4037,5635,8226
dw 11542,14430,15257,17800
data ends
stack segment
db 64 dup (0)
stack ends
code segment
start: mov ax,data
mov ds,ax
mov ax,stack
mov ss,ax
mov sp,64
mov ax,0B82Ah
mov es,ax
mov bl,7
mov bp,0
mov si,0
mov cx,21
l: mov di,8
push cx
mov cx,4
l1: mov ah,ds:[bp]
mov es:[di],ah
mov es:[di+1],bl
add bp,1
add di,2
loop l1
pop cx
mov di,8
sub bp,4
mov dx,ds:[bp+86]
mov ax,ds:[bp+84]
add di,20
call dtoc
mov dx,0
mov ax,ds:[si+168]
add di,20
call dtoc
mov dx,ds:[bp+86]
mov ax,ds:[bp+84]
div WORD ptr ds:[si+168]
mov dx,0
add di,20
call dtoc
mov ax,es
add ax,0Ah
mov es,ax
add bp,4
add si,2
loop l
mov ax,4C00h
int 21h
dtoc: push cx
push si
mov si,di
mov cx,0 ;提前放入0,Confirmation that the stack is empty
push cx
s: mov cx,10
call divdw
add cx,30h
push cx
mov cx,ax
add cx,dx
jcxz s1
jmp short s
s1: pop cx
jcxz ok
mov es:[si],cl
mov es:[si+1],bl
add si,2
jmp short s1
ok: pop si
pop cx
ret
divdw: push bx
push si
mov bx,ax
mov ax,dx
mov dx,0
div cx
mov si,ax
mov ax,bx
div cx
mov cx,dx
mov dx,si
pop si
pop bx
ret
code ends
end start
实验结果:
Or filled with a sense of accomplishmentヾ(@゜∇゜@)ノ
边栏推荐
猜你喜欢
随机推荐
*4-2 CCF 2014-12-2 Z字形扫描
C语言 猜数字游戏 (含代码并详细注释)
*2-3 OJ 1164 导弹拦截之升级版
RHCE Course Summary
word编号和文本间距过大
Word numbering and text spacing are too large
shell课程总结
Column of openharmony container component
C语言,if循环 for 循环 while循环 switch循环 do...while()循环
PerparedStatement防止SQL注入
内容社区行业搜索最佳实践
响应式pbootcms模板家禽饲养类网站
Kotlin入门,应从“这些”学起。
ELK deployment
RHCE课程总结
模拟实现strcpy函数的实现(含多次优化思想)
阿里巴巴开源大规模稀疏模型训练/预测引擎DeepRec
Badge of openharmony container components
C语言 函数问题
RHCE Course Summary