SourceFormatX

軟體簡介

主要功能

為什麼要使用

源碼美化演示

整合和插件

界面預覽

常見問題

升級歷史

所獲獎項

用戶評價

許可協議

CodeToHtml

80x86組合語言原始碼美化效果演示

現在購買
下載試用

程式碼美化工具功能

SourceFormatX 使用強大的80x86組合語言詞法解析引擎全面地分析您的原始碼並根據用戶自定義的原始碼風格重構和美化80x86和8086原始碼檔案,因此它能精細地根據不同的原始碼風格美化多種原始碼,甚至是下面這些極度混亂的原始碼:

C/C++ Java C# Delphi (Pascal)
PHP JSP ASP JavaScript
Visual Basic VB.NET VBScript HTML Components
80x86 ASM 8051 ASM CORBA IDL


這是一個非常極端的 80x86 組合語言 (80x86 Assembly / 8086 ASM) 原始碼美化的範例,其目的是為了展示 SourceFormatX 80x86組合語言程式碼美化工具詞法解析引擎的威力,這份混亂的8086原始碼檔案在1秒種內即被SourceFormatX美化和縮排成整潔的版式。

  ;----- 原始碼美化之前的80x86組合語言原始碼 -----

  .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 ; create window
    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 ; loop
          Invoke        GetMessage, addr msg,NULL,0,0
    .BREAK .IF (!eax)
      INVOKE    TranslateMessage, Addr msg
  INVOKE    DispatchMessage,    ADDR msg
                .ENDW ; end loop
   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

  ; position viewer
   _glMatrixMode GL_MODELVIEW
          _glTranslatef 0.0f,      0.0f,-2.0f

         ; position light
   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組合語言原始碼 -----

  .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                              ; create window
             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                                                  ; loop
                         invoke              GetMessage, addr msg, NULL, 0, 0
                         .break              .if (!EAX)
                         invoke              TranslateMessage, addr msg
                         invoke              DispatchMessage, addr msg
             .endw       ; end loop
             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

      ; position viewer
      _glMatrixMode GL_MODELVIEW
      _glTranslatef 0.0f, 0.0f, -2.0f

      ; position light
      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

  不要再浪費寶貴的時間手動整理美化8086和80x86組合語言原始碼了! 現在就下載SourceFormatX原始碼美化工具