Question: You are tasked to write a procedure which prints content of register CX as hexadecimal string on console. You can start with the following startup

 You are tasked to write a procedure which prints content ofregister CX as hexadecimal string on console. You can start with the

You are tasked to write a procedure which prints content of register CX as hexadecimal string on console. You can start with the following startup code. ; First Name: ; Last Name: ; Student Number: ; I declare that the attached assignment is my own work in ; accordance with Seneca Academic Policy. No part of this ; assignment has been copied manually or electronically from ; any other source (including web sites) or distributed to ; other students. ORG 100h ; For testing, we can assign an arbitrary number to cx MOV cx, OXFABC ; This procedure takes prints content of AX as a hexadecimal ; string on console. ; Assume the value is in cx print_hex PROC MOV BX, ? AND BX, CX ; You need to define a 16-bit number as a mask ; When apply the AND operation only 4 bits of MSB ; contains original values ; You need to shift ? amount to right such that LSB ; contains only 4 bits for MSB SHR BX, ? MOV AL, BL CMP AL, ? ; Replace ? with a number which is a decider for ; numbers and letters in a hex number ane nex numbe JGE is_letter ADD AL, ? ; Replace ? with an ASCII character to make an ASCII ; number from AL JMP print is_letter: SUB AL, ? ; Replace ? with number to make AL an offset when ; added to 'A' creates the right letter ADD AL, 'A' print: MOV AH, OEh; Print request INT 10h ret print_hex ENDP Tasks: 1. Complete the above code and test it. If you have complete and run it correctly it should print F on screen. (2 marks) 2. You need to complete the code such that all contents of CX is printed (4 characters) in hex on screen. You can replicate the same code to achieve the desire result. (3 marks) 3. You extend the procedure such that you use a loop instead of repeating the same code

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!