📄 asm_2_htm.asm
字号:
;===============================
inc Base
.endw
done:
return 0
found:
return 1
IsKeyword endp
;########################################################################
; END of IsKeyword
;########################################################################
;########################################################################
; IsPsuedo Function
;########################################################################
IsPsuedo proc string:DWORD, str_size:BYTE
;================================================
; This tests the passed string to see if it is
; a psuedo-op that needs highlighting or not
; if so it highlights the string it and
; writes it out if not it returns zero
;================================================
;================================
; Local variables
;================================
LOCAL Base:BYTE
;================================
; Initialize Base to zero
;================================
mov Base, 0
;================================
; Loop until we reach the end of
; the types
;================================
.while Base < NUM_PSUEDO
;================================================
; Load in our current type we want to test
;================================================
mov eax, PSUEDO_BASE
add al, Base
invoke LoadString, hInst, eax, ADDR szTestString, 15
;==========================================
; Compare it to the string that was passed
;==========================================
invoke CompareString, LOCALE_USER_DEFAULT, NORM_IGNORECASE, \
string, -1, offset szTestString, -1
;====================================================
; If we succceeded write it out and clear the buffer
;====================================================
.if eax == 2
;=================================
; Write out the font color stuff
;=================================
mov dwArgs, offset szDEFAULT_PSUEDO
invoke wvsprintfA,ADDR szFontBuffer,ADDR szFontTemp, offset dwArgs
invoke wvsprintfA, hDest_Memory, ADDR szFontBuffer, 0
;=====================================
; Add the number written and advance
; the memory handle by that amount
;=====================================
add written, eax
add hDest_Memory, eax
;=================================
; Write it out
;=================================
xor eax, eax
.while al < str_size
;========================
; Setup the current char
;========================
mov ebx, string
add bl, al
;===========================
; Move char to register
; for passing to WriteChar
;===========================
xor ecx, ecx
mov cl, BYTE PTR [ebx]
;============================
; Set Cur Char back to 0
;============================
mov BYTE PTR [ebx], 0
;============================
; Preserve our register
;============================
push eax
;=============================
; If needed convert to upper
;=============================
.if MakeCaps == TRUE
;======================
; Yes so make the call
;======================
invoke CharUpper, ecx
mov cl, al
.endif
;============================
; Make the call to WriteChar
;============================
invoke WriteChar, cl
;==============================
; Restore and inc the counter
;==============================
pop eax
inc eax
.endw
;==================================
; We are finished with the psuedo
; so close the font color
;==================================
invoke wvsprintfA, hDest_Memory, ADDR szEndFont, 0
;=====================================
; Add the number written and advance
; the memory handle by that amount
;=====================================
add written, eax
add hDest_Memory, eax
;==================================
; Jump to found and leave function
;==================================
jmp found
.else
;====================
; NOPE GOTO NEXT ONE
;====================
.endif
;===============================
; Increment the base pointer
;===============================
inc Base
.endw
done:
return 0
found:
return 1
IsPsuedo endp
;########################################################################
; END of IsPsuedo
;########################################################################
;########################################################################
; IsType Function
;########################################################################
IsType proc string:DWORD, str_size:BYTE
;================================================
; This tests the passed string to see if it is
; a type declaraion if so it highlights it and
; writes it out if not it returns zero
;================================================
;================================
; Local variables
;================================
LOCAL Base:BYTE
;================================
; Initialize Base to zero
;================================
mov Base, 0
;================================
; Loop until we reach the end of
; the types
;================================
.while Base < NUM_TYPE
;================================================
; Load in our current type we want to test
;================================================
mov eax, TYPE_BASE
add al, Base
invoke LoadString, hInst, eax, ADDR szTestString, 15
;==========================================
; Compare it to the string that was passed
;==========================================
invoke CompareString, LOCALE_USER_DEFAULT, NORM_IGNORECASE, \
string, -1, offset szTestString, -1
;====================================================
; If we succceeded write it out and clear the buffer
;====================================================
.if eax == 2
;=================================
; Write out the font color stuff
;=================================
mov dwArgs, offset szDEFAULT_TYPE
invoke wvsprintfA,ADDR szFontBuffer,ADDR szFontTemp, offset dwArgs
invoke wvsprintfA, hDest_Memory, ADDR szFontBuffer, 0
;=====================================
; Add the number written and advance
; the memory handle by that amount
;=====================================
add written, eax
add hDest_Memory, eax
;=================================
; Write it out
;=================================
xor eax, eax
.while al < str_size
;========================
; Setup the current char
;========================
mov ebx, string
add bl, al
;===========================
; Move char to register
; for passing to WriteChar
;===========================
xor ecx, ecx
mov cl, BYTE PTR [ebx]
;============================
; Set Cur Char back to 0
;============================
mov BYTE PTR [ebx], 0
;============================
; Preserve our register
;============================
push eax
;=============================
; If needed convert to upper
;=============================
.if MakeCaps == TRUE
;======================
; Yes so make the call
;======================
invoke CharUpper, ecx
mov cl, al
.endif
;============================
; Make the call to WriteChar
;============================
invoke WriteChar, cl
;==============================
; Restore and inc the counter
;==============================
pop eax
inc eax
.endw
;==================================
; We are finished with the type
; so close the font color
;==================================
invoke wvsprintfA, hDest_Memory, ADDR szEndFont, 0
;=====================================
; Add the number written and advance
; the memory handle by that amount
;=====================================
add written, eax
add hDest_Memory, eax
;==================================
; Jump to found and leave function
;==================================
jmp found
.else
;====================
; NOPE GOTO NEXT ONE
;====================
.endif
;===============================
; Increment the base pointer
;===============================
inc Base
.endw
done:
return 0
found:
return 1
IsType endp
;########################################################################
; END of IsType
;########################################################################
;########################################################################
; IsComment Function
;########################################################################
IsComment proc string:DWORD, str_size:BYTE
;================================================
; This tests the passed string to see if it is
; a multi line comment that needs highlighting
; if so it highlights the linesit and
; writes it out if not it returns zero
;================================================
;==========================
; Local Variables
;==========================
LOCAL Delimiter:BYTE
;================================================
; Load in our current type we want to test
;================================================
mov eax, COMMENT_BASE
invoke LoadString, hInst, eax, ADDR szTestString, 15
;==========================================
; Compare it to the string that was passed
;==========================================
invoke CompareString, LOCALE_USER_DEFAULT, NORM_IGNORECASE, \
string, -1, offset szTestString, -1
;====================================================
; If we succceeded write it out, clear the buffer,
; and get the delimter we need to test for
;====================================================
.if eax == 2
;=================================
; Write out the font color stuff
;=================================
mov dwArgs, offset szDEFAULT_COMMENT
invoke wvsprintfA,ADDR szFontBuffer,ADDR szFontTemp, offset dwArgs
invoke wvsprintfA, hDest_Memory, ADDR szFontBuffer, 0
;=====================================
; Add the number written and advance
; the memory handle by that amount
;=====================================
add written, eax
add hDest_Memory, eax
;=================================
; Write it out
;=================================
xor eax, eax
.while al < str_size
;========================
; Setup the current char
;========================
mov ebx, string
add bl, al
;===========================
; Move char to register
; for passing to WriteChar
;===========================
xor ecx, ecx
mov cl, BYTE PTR [ebx]
;============================
; Set Cur Char back to 0
;============================
mov BYTE PTR [ebx], 0
;============================
; Preserve our register
;============================
push eax
;============================
; Make the call to WriteChar
;============================
invoke WriteChar, cl
;==============================
; Restore and inc the counter
;==============================
pop eax
inc eax
.endw
;===================================
; Now we need to get the delimiter
;===================================
again:
mov eax, hSrc_Memory
mov bl, BYTE PTR [eax]
inc hSrc_Memory
.if bl == 32 || bl == 9 || bl == 13 || bl == 10
;============================
; Wasn't our delimiter so
; write it out and go to
; the next byte for testing
;============================
invoke WriteChar, bl
jmp again
.else
;============================
; It was our delimiter so set
; it as such and write it out
;============================
mov Delimiter, bl
invoke WriteChar, bl
.endif
;========================================
; Go until we find the delimiter again
;========================================
another:
mov eax, hSrc_Memory
mov bl, BYTE PTR [eax]
inc hSrc_Memory
.if bl == Delimiter
;==========================
; Write it out
;==========================
invoke WriteChar, bl
;==========================
; Go until End of Line
;==========================
waitEOL:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -