|
80x86アセンブリ言語のソースコード整形例 |
|
|
|
|
|
SourceFormatX は優れた構文解析エンジンを元に作られています。ですのであらゆるスタイルで書かれたソースコードを美しく整形することができます。以下の例のようなめちゃくちゃなコードでさえも、整形することが可能です。
|
これは極端な例ですが。SourceFormatXに搭載されている強力な 80x86アセンブリ言語 (Assembly) のパーサーエンジンの実力を感じて頂けるかと思います。
.386
.MODEL FLAT,STDCALL
include windows.inc
INCLUDE user32.inc
Include kernel32.inc
incLUDE gdi32.inc
.datA
ClassName DB "SimpleWinClass",0
AppName db "Bezier Splines",0
.cODE
start:
INvoke GetModuleHandle, NULL
mov hInstance, eax
inVOKE GetCommandLine
INVOKE WinMain, hInstance, NULL, CommandLine, SW_SHOWDEFAULT
INvoke ExitProcess, eax
WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:SDWORD
LOCAL wc:WNDCLASSEX
local msg:MSG
Local hwnd:HWND
@main: Mov wc.cbSize, SIZEOF WNDCLASSEX
mov wc.style, CS_HREDRAW or CS_VREDRAW
mov wc.lpfnWndProc, OFFSET WndProc
mov wc.cbClsExtra, NULL
Mov wc.cbWndExtra, NULL
push hInstance
pop wc.hInstance
MOV wc.hbrBackground,COLOR_WINDOW+1
mov wc.lpszMenuName,NULL
mov wc.lpszClassName,OFFSET ClassName
invoke LoadIcon,NULL,IDI_APPLICATION
MOV wc.hIcon,eax
mov wc.hIconSm,0
invoke LoadCursor,NULL,IDC_ARROW
mOV wc.hCursor, eax
invoke RegisterClassEx, addr wc INVOKE CreateWindowEx,NULL,ADDR ClassName,ADDR AppName,\
WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,\
CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,\
hInst,NULL
mov hwnd,eax
INVoke ShowWindow, hwnd,SW_SHOWNORMAL
INVOKE UpdateWindow, hwnd
.whiLE TRUE Invoke GetMessage, addr msg,NULL,0,0
.BREAK .IF (!eax)
INVOKE TranslateMessage, Addr msg
INVOKE DispatchMessage, ADDR msg
.ENDW mov eax,msg.wParam
ret
WinMain ENDP
SetupOpenGL PROC hWnd
LoCAL pfd:PIXELFORMATDESCRIPTOR
LOCAL pixformat:DWORD
invoke GetDC, hWnd
mov hdc, EAX
ZeroMemory pfd, sizeof(PIXELFORMATDESCRIPTOR)
.IF eax == 2
mov pfd.nSize, sizeof(PIXELFORMATDESCRIPTOR)
mov pfd.nVersion,1
.ELSE
MOV pfd.dwFlags, PFD_SUPPORT_OPENGL OR PFD_DOUBLEBUFFER OR PFD_DRAW_TO_WINDOW
mov pfd.dwLayerMask, PFD_MAIN_PLANE
MOV pfd.iPixelType, PFD_TYPE_RGBA
.ENDIF
mov pfd.cColorBits, 16
mov pfd.cDepthBits, 16
Mov pfd.cAccumBits, 0
mov pfd.cStencilBits, 0
invoke ChoosePixelFormat, hdc, addr pfd
mov pixformat, Eax
invoke SetPixelFormat,hdc,pixformat,ADDR pfd
_glMatrixMode GL_MODELVIEW
_glTranslatef 0.0f, 0.0f,-2.0f
INVOKE glLightfv, GL_LIGHT0,GL_POSITION, ADDR lightPos
_glEnable GL_LIGHTING
_glEnable GL_LIGHT0
_glEnable GL_DEPTH_TEST
_glShadeModel GL_SMOOTH
ret
SetupOpenGL ENDP
end start
.386
.model flat, stdcall
include windows.inc
include user32.inc
include kernel32.inc
include gdi32.inc
.data
ClassName db "SimpleWinClass", 0
AppName db "Bezier Splines", 0
.code
start:
invoke GetModuleHandle, NULL
mov hInstance, EAX
invoke GetCommandLine
invoke WinMain, hInstance, NULL, CommandLine, SW_SHOWDEFAULT
invoke ExitProcess, EAX
WinMain proc hInst:HINSTANCE, hPrevInst:HINSTANCE, CmdLine:LPSTR, CmdShow:SDWORD
local wc:WNDCLASSEX
local msg:MSG
local hwnd:HWND
@main: mov wc.cbSize, sizeof WNDCLASSEX
mov wc.style, CS_HREDRAW or CS_VREDRAW
mov wc.lpfnWndProc, offset WndProc
mov wc.cbClsExtra, NULL
mov wc.cbWndExtra, NULL
push hInstance
pop wc.hInstance
mov wc.hbrBackground, COLOR_WINDOW+1
mov wc.lpszMenuName, NULL
mov wc.lpszClassName, offset ClassName
invoke LoadIcon, NULL, IDI_APPLICATION
mov wc.hIcon, EAX
mov wc.hIconSm, 0
invoke LoadCursor, NULL, IDC_ARROW
mov wc.hCursor, EAX
invoke RegisterClassEx, addr wc invoke CreateWindowEx, NULL, addr ClassName, addr AppName, \
WS_OVERLAPPEDWINDOW , CW_USEDEFAULT, \
CW_USEDEFAULT , CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, \
hInst , NULL
mov hwnd, EAX
invoke ShowWindow, hwnd, SW_SHOWNORMAL
invoke UpdateWindow, hwnd
.while TRUE invoke GetMessage, addr msg, NULL, 0, 0
.break .if (!EAX)
invoke TranslateMessage, addr msg
invoke DispatchMessage, addr msg
.endw mov EAX, msg.wParam
ret
WinMain endp
SetupOpenGL proc hWnd
local pfd:PIXELFORMATDESCRIPTOR
local pixformat:DWORD
invoke GetDC, hWnd
mov hdc, EAX
ZeroMemory pfd, sizeof(PIXELFORMATDESCRIPTOR)
.if EAX == 2
mov pfd.nSize, sizeof(PIXELFORMATDESCRIPTOR)
mov pfd.nVersion, 1
.else
mov pfd.dwFlags, PFD_SUPPORT_OPENGL or PFD_DOUBLEBUFFER or PFD_DRAW_TO_WINDOW
mov pfd.dwLayerMask, PFD_MAIN_PLANE
mov pfd.iPixelType, PFD_TYPE_RGBA
.endif
mov pfd.cColorBits, 16
mov pfd.cDepthBits, 16
mov pfd.cAccumBits, 0
mov pfd.cStencilBits, 0
invoke ChoosePixelFormat, hdc, addr pfd
mov pixformat, EAX
invoke SetPixelFormat, hdc, pixformat, addr pfd
_glMatrixMode GL_MODELVIEW
_glTranslatef 0.0f, 0.0f, -2.0f
invoke glLightfv, GL_LIGHT0, GL_POSITION, addr lightPos
_glEnable GL_LIGHTING
_glEnable GL_LIGHT0
_glEnable GL_DEPTH_TEST
_glShadeModel GL_SMOOTH
ret
SetupOpenGL endp
end start
再び手動で80x86アセンブリ言語のソースコードを整形するために時を浪費しないで下さい! SourceFormatX体験版の無料ダウンロード!
|