I can't find much info about these:

What is REPNZ? and the others like it (REPZ CMPSB)

How do I get the commandline in a win32 app? I call GetCommandLine, and move it into a LPSTR variable.. then what?

When declaring a structure, I do it like this "name OVERLAPPED <>" how will this look in a 'local form'? (like name:PROCESS32 <>?), also what is the difference between <> and {}

This isn't really code related but is ASM still good to learn? When new processors are out by intel/amd, will ASM programs still work or would you need to reWrite some things?
Posted on 2003-06-11 15:58:42 by KewLexX
All opcodes are detailed in the help files that came with masm32, there is also information available from intel. The rep family of instructions will repeat an opcode execution until a condition is met, usually involving ecx.

The value returned from GetCommadLine is a pointer to a buffer in memory that contains a null terminated string of the command line. You can use it in any function that accepts null terminated strings. for example:

invoke GetCommandLine
mov lpCmdLine,eax
invoke MessageBox,NULL,lpCmdLine,NULL,MB_OK

Substrcutures are addressed as follows

Struct1 STRUCT
data1 dd ?
data2 dd ?
data3 dd ?
Struct1 ENDS

Struct2 STRUCT
st1 Struct1 <>
data1 dd ?
data2 dd ?
data3 dd ?
Struct2 ENDS

LocalStruct Struct2 <0>

mov LocalStruct.st1.data1,10
mov LocalStruct.data2,100

Based on the board that you are asking whether asm is still useful in, what kind of response were you expecting ? Yes, it is still useful, intel has made it's processors compatible since the 8088 back in the 70's.
Posted on 2003-06-11 16:07:05 by donkey
I didn't mean 'useful', I love it, but I wanted to know if it was going to die when the next line of processors came out, but I guess not :)

Thanks for your response, I don't want to flood the board with useless posts so I'll post my next problem here, I am trying to read the ID3 tag on mp3's. I know that the first 3 bytes are 'TAG' so I will check that first to see if its a id3 tag. This is my code so far, how do I check if the buffer == TAG?



.386
.model flat,stdcall
option casemap:none

include \masm32\include\windows.inc

include \masm32\include\user32.inc
includelib \masm32\lib\user32.lib

include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib

wsprintfA PROTO C :DWORD,:VARARG
wsprintf equ <wsprintfA>

.data
FileName db "duck.mp3", 0
x db "id3", 0
Done db "Successful", 0
;errors
NoFile db "File not found", 0
ReErr db "Error reading this file", 0
WrFile db "Error writing to file", 0

OffsetPos OVERLAPPED <0,0,0,0,0>
format db "Output: %u", 0
result db 128 dup(0)

.data?
hInstance HINSTANCE ?
CommandLine LPSTR ?
hFile HANDLE ?
Numb dd ?
buffer db 3 dup(?)
NumOfBytesRead dd ?
FileSize dd ?

.code
main:
invoke CreateFile, addr FileName, GENERIC_READ or GENERIC_WRITE,\
FILE_SHARE_READ or FILE_SHARE_WRITE, NULL, OPEN_EXISTING,\
FILE_ATTRIBUTE_NORMAL, NULL

.if EAX != INVALID_HANDLE_VALUE
mov hFile, EAX
invoke GetFileSize, EAX, 0
sub EAX, 7Fh
mov FileSize, EAX
mov OffsetPos.loffset, EAX ;fSize - 127
invoke ReadFile, hFile, addr buffer, 3, addr NumOfBytesRead, addr OffsetPos
.if EAX != FALSE
invoke MessageBox, 0, addr buffer, addr x, 0 ;buffer would be 'TAG' if it's an ID3 tag
.else
invoke MessageBox, 0, addr ReErr, addr x, 0 or MB_ICONWARNING
.endif
.else
invoke MessageBox, 0, addr NoFile, addr x, 0 or MB_ICONWARNING
.endif

XOR EAX, EAX
invoke ExitProcess, EAX
end main

(I have some variable's I don't use, they are for later on in the program)
Posted on 2003-06-11 16:51:42 by KewLexX