Question

Write an assembly program that will create a word namely “number” and assign it a value...

Write an assembly program that will create a word namely “number” and assign it a value of 0x000F. [Remember this value is stored in binary form in the computer] Your program should store the binary representation of the ‘number’ in a ‘strOut’ variable and do the sys_write call to print
out the binary representation in the standard output in 16 bit form.

The output will look like this

0000000000001111

0 0
Add a comment Improve this question Transcribed image text
Answer #1
section .text
   global _start          ;must be declared for linker (gcc)
        
_start:                   ;tell linker entry point
   mov  edx,1             ;message length
   mov  ecx,strIut        ;message to write
   mov  ebx,1             ;file descriptor (stdout)
   mov  eax,4             ;system call number (sys_write)
   int  0x80              ;call kernel

   mov  eax,1             ;system call number (sys_exit)
   int  0x80              ;call kernel

section .data
strOut DB 'number'
   cx = 16   ; 16 bits to output
bin_loop:
    rcl al,1 ; move most significant bit into CF
    setc bl  ; bl = 0 or 1 by CF (80386 instruction)
    add bl,'0' ; turn that 0/1 into '0'/'1' ASCII char
    call display_bl ; must preserve al and cx
    loop bin_loop
Add a comment
Know the answer?
Add Answer to:
Write an assembly program that will create a word namely “number” and assign it a value...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • E2.15 In assembly code, write a program to count the number of elements in an array...

    E2.15 In assembly code, write a program to count the number of elements in an array that are smaller than 16. The array is stored at memory locations starting from $1010. The array has 30 8-bit unsigned elements. Store the count in the memory location $C001.

  • create a program that assigns variable 1 the value of 2.Assign variable 2 the value of...

    create a program that assigns variable 1 the value of 2.Assign variable 2 the value of 7.Add 1 to variable 2.Add variable 1 and variable 2.Store the result in variable 2 and output variable 2 using flowchart

  • using mips for assembly language WPte a program that asks the user for 2 numbers. the program should then add the 2 numbers bit by bit, using boolean operators no arithmetic operations ex: add, ad...

    using mips for assembly language WPte a program that asks the user for 2 numbers. the program should then add the 2 numbers bit by bit, using boolean operators no arithmetic operations ex: add, addi, sub, mult, div or arrays are permitted in this project. forming a new variable (in a register) with the solution. That solution is to be output bit by bit using the function that was written in class do not use syscall with a value 10...

  • Write a program that will ask the user for a decimal number such as 18 and...

    Write a program that will ask the user for a decimal number such as 18 and prints the 16 bit binary equivalent of the number: 0000 0000 0001 0010 NOTE: Your output should be a binary string formatted by nibbles (spaces every four bits): 0000 0000 0010 1110 1010 0111 1. Ask the user for a number and store it in an int variable called “number”. 2. Find out how many bits you want to use to represent this number....

  • Write a Python program to prompt the user for an integer number. Assign this integer to...

    Write a Python program to prompt the user for an integer number. Assign this integer to a variable X. Then assign a variable Y to the X**3 (X to the power 3). Finally, assign the variable Z to the square root of Y and print the values of X, Y, and Z as shown in the example below. Use main() function to define and call the program. Example: Enter an integer number: 3 X = 3 if Y=X**3 then Y...

  • Question 5 The shortest IEEE standard for rep- expnt fraction resenting rational numbers is calle...

    PLEASE NOTE: PLEASE ANSWER IN MATHEMATICAL FORM!! THIS IS NOT ESSAY QUESTION. THANKS Question 5 The shortest IEEE standard for rep- expnt fraction resenting rational numbers is called half-precision float- sign (S bit) ing point. It uses a 16-bit word partitioned as in the I diagram at right. (This diagram is taken from the Wiki can be found.) (10 bit) article on the subject, where more details 15 10 As described in lectures, to store a rational number r it...

  • Write a C program, that would take a negative number as a input from the console,...

    Write a C program, that would take a negative number as a input from the console, and convert it into 2’s complement binary representation. Recall that, there are two steps to that: ● 1’s complement of the positive bitwise representation, which is similar to bit flipping. ○ Find out the appropriate bitwise operator for that, or do it manually. ● Add 1 with the 1’s complement number. ○ Simply add 1 with the number you get in the previous step....

  • Write a program in MIPs Assembly Language to compute nth number of a fibonacci number sequence....

    Write a program in MIPs Assembly Language to compute nth number of a fibonacci number sequence. Your program should prompt for an integer input n from the user. The program should call a recursive function to compute the nth fibonacci number. Your program must follow programming convention. You should submit program and screenshot of output in a single word/pdf file. You should use following recursive definition of fibonacci function: fib(0) = 0 fib(1) = 1 fib(n) = fib(n-1) +fib(n-2)

  • JUST GIVE ME THE C CODE FOR THIS QUESTION. I GOT THE ASSEMBLY CODE.

    JUST GIVE ME THE C CODE FOR THIS QUESTION. I GOT THE ASSEMBLY CODE. In this assignment, you will create a C program that iteratively populates a fixed-size integer array of 3 elements, array α.withhexadecimal integer valuesprovided by scanf. The user will enter 3 positive hexadecimal integer values, one per line, and the program will store the 3 values in arYay _afOJ,arvay aflJ, and crr ay_af2J. Once the 3 integers are entered, your program will print the array ain 32...

  • please include only the digits of the appropriate number system. In particular, do not precede the...

    please include only the digits of the appropriate number system. In particular, do not precede the answers with ‘0x’ or ‘0b’ or follow your answers with base indicators, like subscript 2 or 10. 1. A processor uses 24 bits for its memory addressing. How many possible distinct locations (in decimal) can the computer address? The computer memory address locations are numbered from 0 to the maximum. If a memory locations' address is (7243)10, how is this address represented in binary...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT