SlideShare a Scribd company logo
Assembly Programming I
Peter
SystemArchitect
peter@quantr.hk
www.quantr.hk
Peter Cheung
• Programmer
• Ask me quedtions at peter@quantr.Hk
Today
• Assembly programming jump start
• Instruction Set
Learning Path
• Book
• Instruction
• CPU Architecture (intel
system programming guide)
• Newsgroup
• Alt.lang.asm
• Alt.os.development
We need an Assembler
• Assembler
• Nasm/Fasm/Masm/Basm
• Macro
We need an way to debug
• http://bochs.sourceforge.net
We need an way to debug
• https://x64dbg.com
Our first program
org 0x7c00
mov ax,0xb800
mov ds,ax
;mov byte [ds:0],0x1b
here:
inc byte [ds:0]
jmp here
times 510 - ($-$$) db 0
dw 0xAA55
hello.asm bochsrc.bxrc
boot: floppy
floppya: 1_44=hello, status=inserted
megs: 16
#ata0-master: type=disk, mode=flat, path="30M.sample"
nasm hello.asm
ndisasm hello
bochs -q -f bochsrx.bxrc
Debugger:
bochsdbg -q -f bochsrx.bxrc
run
Registers
Addressing
Addressing
SEGMENT:OFFSE
T
Size Directives
mov BYTE [ds:bx], 2 ; Move 2 into the single byte at the address stored in EBX.
mov WORD [ds:bx], 2
; Move the 16-bit integer representation of 2 into the 2 bytes
starting at the address in EBX.
mov DWORD [ds:bx], 2
; Move the 32-bit integer representation of 2 into the 4 bytes
starting at the address in EBX.
Data Movement Instructions
mov <reg>,<reg>
mov <reg>,<mem>
mov <mem>,<reg>
mov <reg>,<const>
mov <mem>,<const>
MOV DX, TAX_RATE
MOV COUNT, CX
MOV EAX, EBX
Immediate Addressing
BYTE_VALUE DB 150 ; A byte value is defined WORD_VALUE
DW 300 ; A word value is defined
ADD BYTE_VALUE, 65 ; an immediate operand 65 is added
MOV AX, 45H ; immediate constant 45H is transferred to AX
Multiple Initializations
marksTIMES 9 DW 0
XOR
Operand1: 0101
Operand2: 0011
----------------------------
After XOR -> Operand1: 0110
XOR EAX, EAX
TEST
Test al, 01h
Jz even_number
CMP
CMP DX, 00 ; compare the DX value with zero
JE L7 ; if yes, then jump to label L7
CMP
LP1:
INC EDX
CMP EDX, 10 ; Compares whether the counter has reached 10
JLE LP1 ; If it is less than or equal to 10, then jump to LP1
CMP

More Related Content

PDF
Usecase examples of Packer
PDF
Ansible Introduction - Ansible Brno #1 - David Karban
ODP
Ansible basics workshop
PDF
(WS14) Sasa Matijasic - Node.js i "novi" web
PPTX
Introduction to ansible
PDF
Ansible is the simplest way to automate. MoldCamp, 2015
PPTX
Baking in the cloud with packer and puppet
PPTX
Teched 2012 就是为了改变脚本世界
Usecase examples of Packer
Ansible Introduction - Ansible Brno #1 - David Karban
Ansible basics workshop
(WS14) Sasa Matijasic - Node.js i "novi" web
Introduction to ansible
Ansible is the simplest way to automate. MoldCamp, 2015
Baking in the cloud with packer and puppet
Teched 2012 就是为了改变脚本世界

What's hot (20)

PPTX
Shell Tips and Tricks
PDF
Ansible 101
PPT
Ansible presentation
KEY
Node.js
PPT
Tips for a Faster Website
ODP
ansible why ?
KEY
wwc start-launched
PPTX
Ansible - Crash course
PDF
Server-Side JavaScript Developement - Node.JS Quick Tour
KEY
Web 3, Week 1: Amazon Web Services for Beginners
PDF
Rackspace Hack Night - Vagrant & Packer
PDF
Network Automation with Ansible
PDF
Banquet 36
PDF
Manage WordPress with Awesome using wp cli
PPTX
GPU Cracking on the Cheap
PPTX
GPU Cracking - On the Cheap
PDF
Jenkins and ansible reference
KEY
Mysqlnd uh
PDF
Ansible Automation to Rule Them All
PDF
Automation with ansible
Shell Tips and Tricks
Ansible 101
Ansible presentation
Node.js
Tips for a Faster Website
ansible why ?
wwc start-launched
Ansible - Crash course
Server-Side JavaScript Developement - Node.JS Quick Tour
Web 3, Week 1: Amazon Web Services for Beginners
Rackspace Hack Night - Vagrant & Packer
Network Automation with Ansible
Banquet 36
Manage WordPress with Awesome using wp cli
GPU Cracking on the Cheap
GPU Cracking - On the Cheap
Jenkins and ansible reference
Mysqlnd uh
Ansible Automation to Rule Them All
Automation with ansible
Ad

Similar to Assembly programming (20)

PDF
Linux Performance Tools 2014
PDF
Lessons learned from building Demand Side Platform
PPTX
PDF
ImplementingCryptoSecurityARMCortex_Doin
PPTX
Week1 Electronic System-level ESL Design and SystemC Begin
PDF
One Shellcode to Rule Them All: Cross-Platform Exploitation
PDF
Introduction to Node.js: What, why and how?
PDF
Fast as C: How to Write Really Terrible Java
KEY
DjangoCon 2010 Scaling Disqus
PDF
Build your own embedded linux distributions by yocto project
PPTX
ZeroMQ at Oredev 2013
PPTX
Anton Dorfman. Shellcode Mastering.
PPTX
Shellcode mastering
PDF
Ironic 140622212631-phpapp02
PDF
Ironic
PDF
Ironic 140622212631-phpapp02
PPTX
introduction to node.js
PPTX
DIY Java Profiling
PPTX
Performance Benchmarking: Tips, Tricks, and Lessons Learned
KEY
CHI - YAPC NA 2012
Linux Performance Tools 2014
Lessons learned from building Demand Side Platform
ImplementingCryptoSecurityARMCortex_Doin
Week1 Electronic System-level ESL Design and SystemC Begin
One Shellcode to Rule Them All: Cross-Platform Exploitation
Introduction to Node.js: What, why and how?
Fast as C: How to Write Really Terrible Java
DjangoCon 2010 Scaling Disqus
Build your own embedded linux distributions by yocto project
ZeroMQ at Oredev 2013
Anton Dorfman. Shellcode Mastering.
Shellcode mastering
Ironic 140622212631-phpapp02
Ironic
Ironic 140622212631-phpapp02
introduction to node.js
DIY Java Profiling
Performance Benchmarking: Tips, Tricks, and Lessons Learned
CHI - YAPC NA 2012
Ad

More from Peter Cheung (6)

PPTX
FPGA Introduction.pptx
PPTX
Logic Simulator Presentation .pptx
PPTX
How to use verilator.pptx
PPTX
Quantr Foundation 2023 Q2 Achievements.pptx
PPTX
0CodePM.pptx
PPTX
Assembly programming lesson 2
FPGA Introduction.pptx
Logic Simulator Presentation .pptx
How to use verilator.pptx
Quantr Foundation 2023 Q2 Achievements.pptx
0CodePM.pptx
Assembly programming lesson 2

Recently uploaded (20)

PDF
Digital Strategies for Manufacturing Companies
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PPTX
L1 - Introduction to python Backend.pptx
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
Computer Software and OS of computer science of grade 11.pptx
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
PTS Company Brochure 2025 (1).pdf.......
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PPTX
assetexplorer- product-overview - presentation
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Nekopoi APK 2025 free lastest update
PDF
Softaken Excel to vCard Converter Software.pdf
Digital Strategies for Manufacturing Companies
Design an Analysis of Algorithms I-SECS-1021-03
L1 - Introduction to python Backend.pptx
Upgrade and Innovation Strategies for SAP ERP Customers
Computer Software and OS of computer science of grade 11.pptx
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PTS Company Brochure 2025 (1).pdf.......
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
assetexplorer- product-overview - presentation
How to Choose the Right IT Partner for Your Business in Malaysia
Wondershare Filmora 15 Crack With Activation Key [2025
Odoo Companies in India – Driving Business Transformation.pdf
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
wealthsignaloriginal-com-DS-text-... (1).pdf
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Nekopoi APK 2025 free lastest update
Softaken Excel to vCard Converter Software.pdf

Assembly programming