Hi I was wondering if anyone could help me figure out why every time I try to run this code it keeps bringing up an error of "cannot nest procedures". I need to use the PROTO and PROC directives in this program for my HW assignment. I'm also trying to use the INVOKE command as well in the program to learn it better but it isn't required. This is the exact problem from the book (I'm barely in the first section of the problem as you can tell from the code I have written):
"Create two procedures: (1) SetColor receives two byte parameters: forecolor and backcolor. It calls the SetTextColor procedure from the Irvine32 library. (2) WriteColorChar receives three byte parameters: char, forecolor, and backcolor. It displays a single character, using the color attributes specified in forecolor and backcolor. It calls the SetColor procedure, and it also calls WriteChar from the Irvine32 library. Both SetColor and WriteColorChar must contain declared parameters. Write a short test program that tests both procedures. Be sure to create PROTO declarations for SetColor and WriteColorChar."
And this is my code:
INCLUDE Irvine32.inc .data ccolor DWORD 13 bcolor DWORD 16 SetColor PROTO,cc:DWORD,bc:DWORD prompt BYTE "Hi",0 .code main PROC INVOKE SetColor,ccolor,bcolor mov edx,OFFSET prompt call WriteString jmp final SetColor PROC,cc:DWORD,bc:DWORD mov eax,cc add eax,bc call SetTextColor ret SetColor ENDP final: exit main ENDP END main