I figure, it's my turn to try my hand at a coding horror. This one had me stumped for a couple better-spent-elsewhere hours:
menu_prompt: mov edx, OFFSET menu ; print menu of operations call WriteString call ReadChar call WriteChar call Crlf cmp al, 'p' ; If 'p' was entered... je print ; ...print nodes ... mov edx, OFFSET error ; Print invalid option message call WriteString jmp menu_prompt print: push cur push head call Print jmp menu_prompt ... done: call WaitMsg ; hold display window open exit main ENDP .data ... .code ... Print PROC ... Print ENDP
I was trying to figure out how the values of the cur and head pointers weren't being stored on the stack before the call to the Print procedure; the program repeatedly generated a memory access violation when it tried to dereference the pointer, and I'd be sitting there rooting around the stack frame, and the values are nowhere to be found, like they've never been pushed on the stack before the call. Huh. Visual inspection of the code provided no answers. If you see it already, you're better read than I am on this assembler.
The answer? (MASM transforms all identifiers to uppercase by default, for case-insensitivity! Thus, my jmp statement was just jumping to the Print procedure, without pushing its parameters on the stack, instead of jumping to the print label. I have no idea why the assembler wouldn't raise an error or a warning for that, but I've learned my lesson [just started using MASM, in particular, not long ago].)