'How to output user input (string) to the screen inside a procedure with structure passed by reference in asm?
I'm creating a Payroll program using assembly language. I have a structure to hold first and last name using BYTE sized arrays. Also DWORD types for ID numbers and hourly wage. I then created a procedure to collect user input using the structure passing by reference. I posted the first name input for getEmployeeData PROC.
I've tried storing the first name with a local variable (outside of the struct) under .data which gave me random character output.
Employee STRUCT
first BYTE 16 DUP(0) ; member variables
last BYTE 16 DUP (0)
IDnum DWORD ?
hourly DWORD ?
Employee ENDS
getEmployeeData PROTO,
emp: PTR Employee
.data
em Employee <>
.code
main PROC
INVOKE getEmployeeData, ADDR em
main ENDP
getEmployeeData PROC USES edx,
emp : PTR Employee
mov edx, OFFSET pFirst
call writeLine
mov edx, emp
call readString
ret
getEmployeeData ENDP
END main
I want to print the name to the screen. Please advise.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
