Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Introduction to Assembly language commands mov ing data mov, movzx, movsx memory, immediate and register moves widening narrowing cbw cwd cwde cdq cdqe cqo Arithmetic

Introduction to Assembly language commands

mov ing data mov, movzx, movsx memory, immediate and register moves widening narrowing cbw cwd cwde cdq cdqe cqo

Arithmetic add inc adc sub dec mul imul div idiv

Add

Store the value 0x0a in rax

Print the register

Add 0x0a to rax

Print the register

Add 0x0a to rax again

Print the register

I will review the code for the add statements CS12 ADD 0x000000000000000A 0x0000000000000014 0x000000000000001E Add with carry To add with carry store the value 0xFF in AL

Add 0x1 to al

Add with carry 0x1 to al

Print RAX

You should see the line below added to your output 0x0000000000000002 CS12 ADD 0x000000000000000A 0x0000000000000014 0x000000000000001E 0x0000000000000002 Santa Increment

Increment the rax register and print it out CS12 ADD 0x000000000000000A 0x0000000000000014 0x000000000000001E 0x0000000000000002 0x0000000000000003 Subtract

Add the SUB to the output

Subtract 0xa from the rax register and print it

All previous data should print out as well as shown, in subsequent slides I will not be providing the previous data, but the last slide will hold the entire expected output CS12 ADD 0x000000000000000A 0x0000000000000014 0x000000000000001E 0x0000000000000002 0x0000000000000003 SUB 0xFFFFFFFFFFFFFFF9

Decrement

Decrement rax

Print rax 0xFFFFFFFFFFFFFFF8 Unsigned Multiplication

Output MUL

Set rax to 0x80

Multiply rax by 0xa (using rbx)

Print the register value for RDX

Print the register value for RAX

Now set rax to 0x8000000001

Multply rax by 0x8000000000

Print RDX And RAX Note values in both registers MUL 0x0000000000000000 0x0000000000000500 0x0000000000004000 0x0000008000000000 Santa Rosa Junior College, STUART Signed Multiplication

Set al to 0x8f

Use mul to multiply al by 0x2 (using bl)

Print the register value for RAX

Repeat with imul

Note the difference between the singed and unsigned operations MUL 0x0000000000000000 0x0000000000000500 0x0000000000004000 0x0000008000000000 0x000000000000011E 0x000000000000FF1E Santa Rosa Junior College, STUART Unsigned Division

Output DIV

Set rax to 0xFFFA

Set rdx to 0x0

Divide rdx:rax by 0xF (using rbx)

Print the register value for RAX

Print the register value for RDX

Note values in both registers

RAX is the quotient

RDX is the remainder DIV 0x0000000000001110 0x000000000000000A Santa Rosa Junior College, STUART Signed Division

Output DIV

Set ax to -22

Divide ax by 0x5 (using bh)

Print the register value for RAX

Note: FE FC are ah:al

FE = -2 remainder

FC = -4 quotient

image text in transcribed

ubuntu@ubuntu:~/CS12-Labs/math ubuntu@ubuntu:-/CS12-Labs/math$ .ath CS12 ADD 0x000000000000001E SUB 0xFFFFFFFFFFFFFFF8 MUL 0x0000000000000500 DIV 0x000000000000FEF ubuntu@ubuntu:~/CS12-Labs/math ubuntu@ubuntu:-/CS12-Labs/math$ .ath CS12 ADD 0x000000000000001E SUB 0xFFFFFFFFFFFFFFF8 MUL 0x0000000000000500 DIV 0x000000000000FEF

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke

1st Edition

0130086509, 978-0130086501

More Books

Students also viewed these Databases questions

Question

Describe the team dynamics at Facebook.

Answered: 1 week ago