Question: I need help creating a program i n assembly that draws the letter v i n memory. I a m using 3 2 bit registers.

I need help creating a program in assembly that draws the letter vin memory. I am using 32 bit registers. I also have a template and would greatly appreciate if someone could figure out the rest of the code. Instructions: you should have a total of four loops:
(1) One outer loop to loop over the N-1 top rows
(2) One inner loop to print the number of spaces before the first asterisk in the top N-1 rows
(3) One inner loop to print the number of spaces between the first and second asterisk in the top N1
rows
(4) One loop to print the number of spaces before the asterisk in the bottom (final) row
In addition to the above, you also need to:
(1) Use the runtime stack to switch ECX back and forth between the outer loop and the
inner loops. We saw before that one way that you could save and restore ECX was by using a variable (or
another register) to do so, but we can also accomplish this with the runtime stack. In this assignment you need to
use the runtime stack to do this.
(2) Implement the logic for drawing the V pattern in memory in a procedure (function)
named draw_v_pattern (this logic should NOT be in main!). In main you need to call the
draw_v_pattern procedure. Make sure to properly initialize the appropriate register(s) in main BEFORE the call to
the draw_v_pattern procedure. Make sure to also return back to main when the draw_v_pattern procedure is
finished! template: ; Program template
.386
.model flat,stdcall
.stack 4096
ExitProcess proto,dwExitCode:dword
ROWS =11 ; this can be changed to any value between 2-16; the correct V pattern should be "drawn" in memory in all cases
COLS =2*ROWS-1
MID_COL = COLS/2
.data
V BYTE 32*ROWS dup (?) ; the memory allocated for the V pattern
curr_row BYTE ? ; this refers to the current row in the pattern being processed
; count is used to refer to a row in memory, such as 0x00404000(row 0),0x00404020(row 32),0x00404040(row 64), etc
; You need to use count to move between the different rows in memory
; HINT: think about incrementing or decrementing count by 32
count DWORD 32*(ROWS-1) ; you can change the initial value depending on if you want it to count up or down
.code
main proc
; IMPLEMENT THIS
; IMPLEMENT THIS
; IMPLEMENT THIS
; IMPLEMENT THIS
; IMPLEMENT THIS
invoke ExitProcess,0
main endp
end main

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 Programming Questions!