BLOG ARTICLE asm | 4 ARTICLE FOUND

  1. 2010.08.27 어셈을 시작하며
  2. 2010.08.13 NASM, MASM 차이 1
  3. 2010.07.15 About link errors
  4. 2010.07.07 segment:offset

어셈을 시작하며

asm 2010. 8. 27. 15:45
내가 어셈을 시작하며 느낀것이 있다. 구체적으로 어셈에 손을 대기 시작한것은 한 2달전쯤... 인것 같다, 
어셈에 발을 들여 놓으면서  혼돈이 되었던 점을 적어보도록 하자

1. nasm ,masm 어떤것을 사용해야 하는가?  난 masm을 선택했다.
2. masm을 선택한 이유! 주변에서 좋다고 추천하고 내가 봐도 괜찮은 책은 다 masm이다. 요즘은 nasm을 많이 사용한다고 하는데, 배울 길이 없는걸 어떻게해?. 강의문서라고 해도 냅다 책내용 간략하게 요약해놓은 것 뿐이고, 그래서 아주아주 좋은 책 을 기반으로 공부를 시작했다. 
3. 16,32비트 프로그래밍 어떤거 해야되?
당연히 시대의 흐름이 맞추어 32비트 프로그래밍을 해야되겠다고 생각할지도 모르겠지만 난, 이해가 되지 않았다. 16비트 프로그래밍을 모르는데 어떻게 32비트 프로그래밍을 하냐고... ax에서 eax 이렇게 확장되었는데 ax부터 알아야지. 그래서 16비트 프로그래밍부터 시작하고 있다. 지금도 하고있다. 아직까지 32비트 못들어갔다. 줸장....

4. 정식 세그먼트? 약식 세그먼트? 
책이 좋아서 설명이 중반부에 되어있었다. 것도 모르고 '이런문법이 어디있어 씨댕;;;' 하면서 찾고찾다가 겨우 알아냈다. 정식표현과 약식표현....ㅠ

나만이런거에 혼란을 느꼈나?... 다들 그러리라 본다. 

'asm' 카테고리의 다른 글

NASM, MASM 차이  (1) 2010.08.13
About link errors  (0) 2010.07.15
segment:offset  (0) 2010.07.07
AND

NASM, MASM 차이

asm 2010. 8. 13. 00:48

MASM은 MS사에서 만든 어셈블러입니다.


NASM은 오픈소스로 만들어진 어셈블러입니다.

 

MASM와 NASM은 Intel 문법을 따르지만, directive에 있어서는 조금 차이가 납니다.

 

MASM은 윈도우 환경에서만 사용될 수 있으나, NASM은 다양한 환경에서 사용될 수 있습니다.

 

또한, 주소 지정 방식에서도 조금 차이가 납니다.

 

뭘 공부해야 하느냐는 목적에 따라 사용 하면 됩니다.

 

1. 윈도우, 리눅스 환경 및 독자 OS 개발에 사용하고 싶다면 NASM을 추천합니다.

 

참고로, Visual Studio에서 NASM 문법을 사용해서 C언어와 함께 개발하려면 독립적인 OBJECT 파일로

 

만들어서 링크해야 합니다. 즉, Visual Studio에서 인라인 어셈블은 안됩니다.

 

2. WinDebug 등의 디버거를 이용해서 윈도우용 프로그램을 리버스 엔지니어링하려면 아무래도 MASM 문법

 

에 익숙한 것이 낫습니다. 이런 경우에는 MASM을 공부하세요.

 

또한, MS에서 만든 것이다 보니 Visual Studio에서 C언어와 함께 인라인 어셈블이 가능합니다.

'asm' 카테고리의 다른 글

어셈을 시작하며  (0) 2010.08.27
About link errors  (0) 2010.07.15
segment:offset  (0) 2010.07.07
AND

About link errors

asm 2010. 7. 15. 02:01

Linker Errors LNK1190 to LNK1581

Linker Tools Error LNK1190
invalid fixup found, type type
The object file has become corrupted. Recompile.

Linker Tools Error LNK1194
cannot delay-load dll name due to import of data symbol symbol name; relink without /DELAYLOAD:dll name
You cannot delay load a DLL if data is imported from it.

Linker Tools Error LNK1195
target machine "machine" requires "option"
Add the required option.

Linker Tools Error LNK1196
invalid or corrupt import object: unknown version
The import library has become corrupted. Rebuild the library.

Linker Tools Error LNK1197
invalid or corrupt import object: unknown type
The import library has become corrupted. Rebuild the library.

Linker Tools Error LNK1198
invalid or corrupt import object: unknown name type
The import library has become corrupted. Rebuild the library.

Linker Tools Error LNK1199
invalid or corrupt import object: non-zero reserved fields
The import library has become corrupted. Rebuild the library.

Linker Tools Error LNK1200
error reading program database "filename"
The given program database (PDB) could not be read, probably because it is corrupted. If filename is the PDB for an object file, recompile the object file; use the /debug:full and /pdbfile options. If filename is the PDB for the main output file and this error occurred during an incremental link, delete the PDB and relink.

Linker Tools Error LNK1201
error writing to program database "filename"; check for insufficient disk space
LINK could not write to the program database (PDB) for the output file. One of the following may be a cause:

  • The file is corrupted. Delete filename and relink.
  • There was not enough disk space to write to the file.
  • The drive being written to was not available, possibly due to a network problem.

Linker Tools Error LNK1202
"filename" missing debugging information for referencing module
The given program database (PDB) for an object file was invalid. Recompile the object file; use CL's /Zi option.

Linker Tools Error LNK1203
"filename" missing current debugging information for referencing module
The given program database (PDB) for an object file was invalid. Recompile the object file; use CL's /Zi option.

Linker Tools Error LNK1204
"filename" compiled /Yc /Yu /Z7; cannot create PDB; recompile with /Zi
Multilayered program databases (PDBs) are not supported in combination with old-style debugging information. Recompile using CL's /Zi option.

Linker Tools Error LNK1206
cannot overwrite Visual C++ 1.0 PDB "filename"; delete and rebuild
This version of LINK cannot write to an existing program database (PDB) created using older versions of the visual development environment. Delete filename and rebuild.

Linker Tools Error LNK1207
incompatible PDB format in "filename"; delete and rebuild
This version of LINK cannot write to the existing program database (PDB). Delete filename and rebuild.

Linker Tools Error LNK1209
program database "filename" differs from previous link; relink or rebuild
The given program database (PDB) is invalid and possibly corrupt. Relink. If filename is also the PDB for an object file, recompile to recreate the PDB.

Linker Tools Error LNK1210
insufficient memory for incremental link; relink with /INCREMENTAL:NO
There was not enough virtual memory available for LINK to create the incremental status (.ILK) file.

Linker Tools Error LNK1211
precompiled type information not found; "filename" not linked or overwritten
The given object file, compiled with /Yc, either was not specified in the LINK command or was overwritten.

Linker Tools Error LNK1212
error opening program database; file is in use
The PDB is already in use by another application.

Linker Tools Error LNK1213
unexpected import object encountered
The import library has become corrupted. Rebuild the library.

Linker Tools Error LNK1221
a subsystem can't be inferred and must be defined
The linker does not have enough information to infer which subsystem you will target your application. To fix this error, use the /SUBSYSTEM option.

Linker Tools Error LNK1561
entry point must be defined
The symbol specified by the /ENTRY option is not defined.

Linker Tools Error LNK1581
corrupted object or old compiler (bad Pcode entry point)
Your object file contained a bad entry point. The object file is probably corrupt. See Corrupt Object File for more information.


'asm' 카테고리의 다른 글

어셈을 시작하며  (0) 2010.08.27
NASM, MASM 차이  (1) 2010.08.13
segment:offset  (0) 2010.07.07
AND

segment:offset

asm 2010. 7. 7. 00:42
지금은뭐 32bit니 64bit 하지만 기본적인 개념을 잡고자 설명해보도록한다.

x86의 초기모델인 8086은 8086 은 내부적으로 16비트의 레지스터를 사용한다.
따라서 CPU 내부 구조는 16 bit 레지스터를 사용하고 있었으므로 최대 2^16인 65536 Byte, 즉 64KB의 메모리밖에 사용할 수 없다.
이에 인텔은 세그먼트와 오프셋이라는 개념을 도입해서 16 bit 레지스터를 이용해 20 bit를 가리킬 수 있도록 하였다.
즉 2^20인 1Mbyte를 사용할 수 있게 되었다.

Segment : Offset 과 같이 쓰며, 이렇게 표시되어있는 논리주소는 세그먼트를 4bit 시프트하고, 거기에 오프셋을 더해 물리주소로 변환한다.  --> 20비트 사용

예를들어 0x1000:0x2345 이라면 0x1000을 4bit 왼쪽으로 시프트(2^4 = 16) 16진수로는 자릿수 0을 더해서 거기에 오프셋 값을 더해  0x10000 + 0x2345 = 0x12345 이 된다.

이 방법을 통해서 0x00000 부터 최대 0xFFFFF 까지 1MB의 메모리를 사용할 수 있게 되었다. 따라서 하나의 세그먼트의 크기는 64KB가 되며, 이 세그먼트부터 다음 세그먼트 사이에 존재하는 주소에 접근하기 위해서 오프셋을 사용한다.

'asm' 카테고리의 다른 글

어셈을 시작하며  (0) 2010.08.27
NASM, MASM 차이  (1) 2010.08.13
About link errors  (0) 2010.07.15
AND