Code:
.data
msg1 DWORD "AX="
msg2 DWORD "Elevator will stop at floor no."
randomNum DWORD
.code
call Randomize ;Set the seed
mov ax, 0xffff ;sets the range of random number from 0 to ffff(1111 1111 1111 1111)
call RandomRange ; Generates a random number in ax
mov randomNum, ax; save the generated number in randomNum
// Print "Ax="
mov edx, OFFSET msg1
call WriteString
; Display register AX
mov ebx,TYPE 2
call WriteBinB ; if ebx is set to 2 then WriteBinB will output contents of eax as 16-bit binary format(for WORD ebx is set to 1)
// Print msg2 string
mov edx, OFFSET msg2
call WriteString
; Now check individual bits of the register AX. To check status of individual bits in each iteration AND registers bx and cx. Since only first bit of cx is set so if the first bit of bx is also set then AND will result into 1 otherwise 0.
mov edx,1; counter for floor numbers
mov bx,ax ; copy the random number genrated in bx
mov cx, 0x0001 ; 0000 0000 0000 0001
CHECK:
cmp edx,17
je END; If counter reaches 17 then end the loop
and cx, bx ; AND of cx and bx
jz ZERO; If this results in 0 then bit is not set, jump to ZERO
jmp ONE ; jump to ONE
ZERO:
shr bx ; Right shift bx to check next bit
inc edx ; increment the counter
jmp CHECK
ONE:
mov eax,edx
call WriteInt ; Display the floor number
inc edx
shr bx
jmp CHECK
END:
_exit
Please write in Assembly Language! Thank you. 4 The Sheraton Hotel in Irvine is a 16...
Assembly language x86 processors in c++ starting with asm_ 4 The Sheraton Hotel in Irvine is a 16 floor building. Suppose each bits of AX register represent one floor (the right most bit is representing the first floor). Ten people got into the elevator on the first floor and each pressed a random floor number between 2 and 16 (some random numbers may be the same which indicates more than one person will get off at the same floor). Write...
Assembly language x86 processors in c++ Suppose the content of ax register is OxAFBB. Write program to do the following 16 15 14 13 12 11 10 987 6 5 4 3 2 1 1 1 0 0 a. Count and display the number of ones b. Determine whether the bit number 8 is on or off c. The bits 14,13,12,11 indicates the number of doors open (1011 means 8+2+1-11 doors open). Determine how many doors are open 01 0
question 1 part 2 and 3 thank you (47) Naruto Notone C Sign In er Sign Up | Ch ® UFC & MMA × Secure I https://piazza-resourcess3.amazonaws.com/jgopch0cb93d8/j .pdfAWSAccessKeyld-AKAILDNRL/4ALKBWOHA8lexpires-15200435/2&Signature-ol9aXG9 /UAKIHS0QUwMeyBX.. ☆ ミ quations must be properly tyne-set including superscript-s expunents, Always watch the course websile for updates on the assignments. Question 1 (4 points) Show you work I. Convert 2727 into a 32-bit two's complement binary number 2. Convert -5795 into a 16-bit two's complement binary number 3. Add the above...
Please write the code in assembly language which can run in HLA. Thank you very much!! -So we need to write the code in assembly language in Notepad++, end with .hla and run it in CMD. - This project is about writing a program to read numbers, counts the items read, calculates the total, the maximum and minimum of the numbers. -The program stops when a 0 is entered. Zero will not be part of the data. -work with integers,...
Assembly Language Programming Assignment program must be in: MASM assembly language / x86 architecture / irvine library procedures Objectives: 1. using register indirect addressing 2. passing parameters 3. generating “random” numbers 4. working with arrays Description: Write and test a MASM program to perform the following tasks: 1. Introduce the program. 2. Generate ARRAYSIZE random integers in the range [LO = 10 .. HI = 29], storing them in consecutive elements of an array. ARRAYSIZE should be set to 200....
the w 2. This problem explores the use of a one-time pad version of t In this scheme, the key is a stream of random numbers between 0 and example, if the key is 3 19 5..., then the first letter of plaintext is encrypted with a shift of 3 letters, the second with a shift of 19 letters, the third with a shift of 5 letters, and so on. a. Encrypt the plaintext sendmoremoney with the key stream 9...
Can you use Multisim or something similar. I got the truth table and design, but having a hard time with the actual wiring. I need to see where each cable and light bulb go. 3.4. Multiplexer Multiplexers are very useful components in digital systems. They transfer a large number of information units over a smaller number of channels, (usually one channel) under the control of selection signals. Fig. 3 is a 4-line to l-line MUX. In this circuit, lo, 11, 12,...
Solve it for java Question Remember: You will need to read this assignment many times to understand all the details of the you need to write. program Goal: The purp0se of this assignment is to write a Java program that models an elevator, where the elevator itself is a stack of people on the elevator and people wait in queues on each floor to get on the elevator. Scenario: A hospital in a block of old buildings has a nearly-antique...
Please help me write in C++ language for Xcode. Thank you. In this lab you are going to write a time card processor program. Your program will read in a file called salary.txt. This file will include a department name at the top and then a list of names (string) with a set of hours following them. The file I test with could have a different number of employees and a different number of hours. There can be more than...
please answer all prelab questions, 1-4. This is the prelab manual, just in case you need background information to answer the questions. The prelab questions are in the 3rd photo. this where we put in the answers, just to give you an idea. Lab Manual Lab 9: Simple Harmonic Oscillation Before the lab, read the theory in Sections 1-3 and answer questions on Pre-lab Submit your Pre-lab at the beginning of the lab. During the lab, read Section 4 and...