Output: Conclusion
Output: Conclusion
mov Rax,1
mov Rdi,1
mov rsi,%1
mov rdx,%2
syscall
%endmacro
display:
mov rbx,rax ; store no in rbx
mov rdi,result ;point rdi to result variable
mov cx,16 ;load count of rotation in cl
up1:
rol rbx,04 ;rotate no of left by four bits
mov al,bl ; move lower byte in al
and al,0fh ;get only LSB
cmp al,09h ;compare with 39h
jg add_37 ;if greater than 39h skip add 37
add al,30h
jmp skip ;else add 30
add_37:
add al,37h
skip:
mov [rdi],al ;store ascii code in result variable
inc rdi ; point to next byte
dec cx ; decrement counter
jnz up1 ; if not zero jump to repeat
dispmsg result,16 ;call to macro
ret
OUTPUT:
CONCLUSION: In this practical session, we learnt how to display any number on monitor. (Convesion
of hex to ascii number in ALP program).
15
EXP NO: 03
AIM: Write an X86/64 ALP to find the largest of given Byte/Word/Dword/64-bit numbers
OBJECTIVES:
ENVIRONMENT:
THEORY:
Datatype in 80386:
Datatypes of 80386:
The 80386 supports the following data types they are
Bit
Bit Field: A group of at the most 32 bits (4bytes)
Bit String: A string of contiguous bits of maximum 4Gbytes in length.
Signed Byte: Signed byte data
Unsigned Byte: Unsigned byte data.
Integer word: Signed 16-bit data.
Long Integer: 32-bit signed data represented in 2's complement form.
Unsigned Integer Word: Unsigned 16-bit data
Unsigned Long Integer: Unsigned 32-bit data
Signed Quad Word: A signed 64-bit data or four word data.
Unsigned Quad Word: An unsigned 64-bit data.
Offset: 16/32-bit displacement that points a memory location using any of the addressing modes.
Pointer: This consists of a pair of 16-bit selector and 16/32-bit offset.
Character: An ASCII equivalent to any of the alphanumeric or control characters.
Strings: These are the sequences of bytes, words or double words. A string may contain minimum one byte and maximum 4
Gigabytes.
BCD: Decimal digits from 0-9 represented by unpacked bytes.
Packed BCD: This represents two packed BCD digits using a byte, i.e. from 00 to 99.
16
Registers in 80386:
EAX AX AH,AL
EBX BX BH,BL
ECX CX CH,CL
EDX DX DH,DL
EBP BP
EDI DI
ESI SI
ESP
17
1. To give the programming versatility to the user.
2. To reduce the number of bits in addressing field of instruction.
ALGORITHM:
FLOWCHART:
18
EXP NO: 04
AIM: Write a switch case driven X86/64 ALP to perform 64-bit hexadecimal arithmetic operations (+,-
,*, /) using suitable macros. Define procedure for each operation.
OBJECTIVES:
ENVIRONMENT:
THEORY:
ALGORITHM:
FLOWCHART:
PROGRAM:
section .data
menumsg db 10,'****** Menu ******',
db 10,'1: Addition'
db 10,'2: Subtraction'
db 10,'3: Multiplication'
db 10,'4: Division'
db 10,10,'Enter your choice:: '
19