当前位置:网站首页>Microcomputer principle operation
Microcomputer principle operation
2022-07-29 03:22:00 【Believe yourself!!!】
example 4-12:
;eg0501.asm
include io32.inc
.data
string byte 'Do you have fun with Assembly?',0
.code
start:
xor ebx,ebx
again:
mov al,string[ebx]
cmp al,0
jz done
inc ebx
jmp again
done: mov eax,ebx
call dispuid
exit 0
end startexercises 4-13
;eg0201.asm
include io32.inc
.data
string byte 'Do you have fun with Assembly?',0
space dword ?
.code
start:
mov esi,offset string
xor ebx,ebx
again: mov al,[esi]
cmp al,0
jz done
cmp al,20h
jne next
inc bx
next: inc esi
jmp again
done: mov space,ebx
exit 0;
end startexample 4-10:
include io32.inc
.data
.code
start:
mov edx,1
mov esi,2
done1: add edx,esi ; Add natural numbers , Sum up
jc done ; Highest carry , Jump
inc esi ; Addend plus one
jmp done1 ; Add natural numbers repeatedly
done: sub esi,1 ; Plus minus one , Make the cumulative sum effective without carry
mov ebx,1
mov ecx,2
nom: add ebx,ecx ; Find the effective cumulative sum
cmp ecx,esi ; Add to N The boundary of stops
jz again
inc ecx ; Addend plus one
jmp nom ; Add natural numbers repeatedly
again: mov eax,ebx ; Displays the maximum value of the effective cumulative sum
call dispuid
call dispcrlf ; Line break
mov eax,ecx ; Show N The boundaries of
call dispuid
exit 0
end startExample 4-15:
;eg0101.asm
include io32.inc
.data
regd byte 'EAX=',8 dup(0),'H',0
.code
start:
mov eax,1234abcdh
xor ebx,ebx
mov ecx,8
again: rol eax,4
push eax
call htoasc
mov regd+4[ebx],al
pop eax
inc ebx
dec ecx
jnz again
mov eax,offset regd
call dispmsg
htoasc proc
and al,0fh
or al,30h
cmp al,39h
jbe htoend
add al,7
htoend: ret
htoasc endp
exit 0
end startexercises 4-29:
;eg0502.asm
include io32.inc
.data
var byte 'This is a test!'
.code
start: mov eax,offset var
mov ecx,sizeof var
call dispmem
exit 0
dispmem proc
push ebx
mov ebx,eax
dispml: mov al,[ebx]
call disphb
mov al,' '
call dispc
inc ebx
loop dispml
pop ebx
ret
dispmem endp
end startexample 4-18:
;eg0101.asm
include io32.inc
.data
count =10
array dword count dup(0)
temp dword ?
readbuf byte 30 dup(0)
.code
start:
mov ecx,count
mov ebx,offset array
again: call read
mov eax,temp
mov [ebx],eax
add ebx,4
dec ecx
jnz again
read proc
push eax
push ebx
push ecx
push edx
read0: mov eax,offset readbuf
call readmsg
test eax,eax
jz readerr
cmp eax,12
ja readerr
mov edx,offset readbuf
xor ebx,ebx
xor ecx,ecx
mov al,[edx]
cmp al,'+'
jz read1
cmp al,'-'
jnz read2
mov ecx,-1
read1: inc edx
mov al,[edx]
test al,al
jz read3
read2: cmp al,'0'
jb readerr
cmp al,'9'
ja readerr
sub al,30h
imul ebx,10
jc readerr
movzx eax,al
add ebx,eax
cmp ebx,80000000h
jbe read1
readerr: mov eax,offset errmsg
call dispmsg
jmp read0
read3: test ecx,ecx
jz read4
neg ebx
jmp read5
read4: cmp ebx,7fffffffh
ja readerr
read5: mov temp,ebx
pop edx
pop ecx
pop ebx
pop eax
ret
errmsg byte 'Input error,enter again:',0
read endp
exit 0
end startexercises 7-22:
边栏推荐
- Calculation of array serial number of force deduction questions (daily question 7/28)
- Introduction to JVM foundation I (memory structure)
- What is eplato cast by Plato farm on elephant swap? Why is there a high premium?
- 腾讯云使用pem登录
- 美联储再加息,75基点 鲍威尔“放鸽”,美股狂欢
- 2022-07-28 第四小组 修身课 学习笔记(every day)
- CUDA GDB prompt: /tmp/tmpxft**** cudafe1.stub. c: No such file or directory.
- MYCAT read / write separation configuration
- GJB常见混淆概念
- How to realize multi line annotation in MATLAB
猜你喜欢

13_ UE4 advanced_ Montage animation realizes attack while walking

How does DataGrid export and recover the entire database data, using a single SQL file

Redis configuration cache expiration listening event trigger

【打开新世界大门】看测试老鸟如何把API 测试玩弄在鼓掌之间

July 28, 2022 Gu Yujia's study notes

Hangao database best practice configuration tool Hg_ BP log collection content

Digital image processing Chapter 10 - image segmentation
![[robot learning] matlab kinematics and ADMAS dynamics analysis of manipulator gripper](/img/e1/a67048ea69bfe6064651d459311a88.png)
[robot learning] matlab kinematics and ADMAS dynamics analysis of manipulator gripper

Score addition and subtraction of force deduction and brushing questions (one question per day 7/27)

西瓜书学习第六章---SVM
随机推荐
Introduction and advanced MySQL (XIV)
军品技术文件划分及说明
Object转String的几种方法
Shell script summary
增量实时灾备笔记
Shardingsphere's level table practice (III)
ShardingSphere之水平分表实战(三)
Reproduce 20 character short domain name bypass and XSS related knowledge points
Typescript learning (I)
3D高级渲染器:Artlantis studio 2021.2中文版
SAP 中国本地化内容汇总
Let's talk about the summary of single merchant function modules
Apache文件管理自学笔记——映射文件夹和基于单ip多域名配置apache虚拟机
Plato Farm在Elephant Swap上铸造的ePLATO是什么?为何具备高溢价?
mycat读写分离配置
Singleton and invariant modes of concurrent mode
Several methods of converting object to string
Summary of basic knowledge points of C language
4000 多字学懂弄通 js 中 this 指向问题,顺便手写实现 call、apply 和 bind
Detailed steps for installing MySQL 8.0 under Linux