Assembler Developer

Moderators: None (Apply to moderate this forum)
Number of threads: 1030
Number of posts: 1826

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Can anyone explain me this asm code? Posted by drew999 on 15 Apr 2011 at 10:58 AM
This is the code. Please, someone help me!

.data
CaseTable BYTE "A"
DWORD Process_A
EntrySize = ($ - CaseTable)
BYTE "B"
DWORD Process_B
BYTE "C"
DWORD Process_C
BYTE "D"
DWORD Process_D
NOE = ($ - CaseTable)
p BYTE "Inserisci A, B, C o D: ", 0
msgA BYTE "A pressed", 0
msgB BYTE "B pressed", 0
msgC BYTE "C pressed", 0
msgD BYTE "D pressed", 0
.code
MAIN PROC
mov edx, offset p
call WriteString
call ReadChar
mov ebx, offset CaseTable
mov ecx, NOE
l1:
cmp al, [ebx]
jne l2
call NEAR PTR[ebx + 1]
call WriteString
call Crlf
l2:
add ebx, EntrySize
loop l1
l3:
exit
MAIN ENDP

Process_A PROC
mov edx, offset msgA
ret
PA ENDP

Process_B PROC
mov edx, offset msgB
ret
PB ENDP

Process_C PROC
mov edx, offset msgC
ret
PC ENDP

Process_D PROC
mov edx, offset msgD
ret
PD ENDP
END MAIN

Report
Re: Can someone explain me this asm code? Posted by AsmGuru62 on 16 Apr 2011 at 5:50 AM
The code asks the user to press a character A,B,C, or bloody D. Then code uses a table to map that character to an address of a subroutine and then calls that subroutine by its address. Then subroutine prints its text, which is: "process A", "process B", etc.
Report
Re: Can anyone explain me this asm code? Posted by drew999 on 18 Apr 2011 at 12:47 AM
Thank a lot.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.