有沒有使用Borland的TASM擴展宏的方法? 我想轉換一個TASM compatible .ASM文件來查看所有擴展的宏。 找不到任何選項來執行此操作。如何擴展TASM宏
回答
使用TASM的命令行選項/ la生成擴展列表。從此列表中,您可以看到高級別和低級別的擴展。此功能在TASM的所有版本降至1988年
例如最初的版本,讓我們假設你有以下TASM宏:
OUTPUTMESSAGE MACRO hConsole,stringval
LOCAL msg
.data
msg db '&stringval',0
.code
call outputString ,hConsole,OFFSET msg
ENDM ;OUTPUTMESSAGE
你想看到下面的源是如何擴大:
OUTPUTMESSAGE hConsole,<This app was assembled with TASM version >
OUTPUTMESSAGE hConsole,%??version
與/ LA(I碰巧使用5.4版本)將產生以下所產生的列表文件:
516 OUTPUTMESSAGE hConsole,<This app was assembled with TASM version >
1 517 0000018F .data
1 518 00000000 54 68 69 73 20 61 70+ ??0000 db 'This app was assembled with TASM version ',0
519 70 20 77 61 73 20 61+
520 73 73 65 6D 62 6C 65+
521 64 20 77 69 74 68 20+
522 54 41 53 4D 20 76 65+
523 72 73 69 6F 6E 20 00
1 524 0000002A .code
2 525 0000018F C8 0000 00 ENTERD 00000h,0
2 526 call outputString ,hConsole,OFFSET ??0000
3 527 00000193 68 00000000r PUSH OFFSET ??0000
3 528 00000198 FF 75 08 PUSH hConsole
3 529 0000019B E8 FFFFFE9B CALL outputString
530 OUTPUTMESSAGE hConsole,%??version
1 531 000001A0 .data
1 532 0000002A 31 32 38 34 00 ??0001 db '1284',0
1 533 0000002F .code
1 534 call outputString ,hConsole,OFFSET ??0001
2 535 000001A0 68 0000002Ar PUSH OFFSET ??0001
2 536 000001A5 FF 75 08 PUSH hConsole
2 537 000001A8 E8 FFFFFE8E CALL outputString
這些列對應於[深度] [行號] [偏移量] [機器代碼] [源]。不幸的是,你會發現,[line#]列並不是特別有用。下面是從TASM5用戶指南剪斷描述列:
[depth] - indicates the level of nesting of Include files and macros within your
listing file.
[line#] - is the number of the line in the listing file (not including header
and title lines). Line numbers are particularly useful when the
cross-reference feature of Turbo Assembler, which refers to lines by
line number, is used. Be aware that the line numbers in [line#] are
not the source module line numbers. For example, if a macro is
expanded or a file is included, the line-number field will continue to
advance, even though the current line in the source module stays the
same. To translate a line number (for example, one that the
cross-referencer produced) back to the source file, you must look up
the line number in the listing file, and then find that same line (by
eye, not by number) in the source file.
[offset] - is the offset in the current segment of the start of the machine code
generated by the associated assembler source line.
[machine_code] - is the actual sequence of hexadecimal byte and word values that
is assembled from the associated assembler source line.
[source] - is simply the original assembler line, comments and all. Some
assembler lines, such as those that contain only comments, don't
generate any machine code; these lines have no [offset] or [machine_
code] fields, but do have a line number.
@byteprt謝謝,有關如何過濾除源之外的所有內容的任何想法? – franck
打開或關閉列可能對您有用,但TASM(甚至MASM)的列表文件不是超級靈活的。您也不能依賴深度列等於特定值來獲取最低級別的源,因爲此數字根據指令/宏的類型波動,如上所示。正如@ Ped7g所建議的那樣,我認爲你最好的選擇就是將所得到的模塊進行反彙編以獲得源代碼。如果您需要了解特定的宏,那麼列表文件至少可用於此目的。 – byteptr
話雖如此,如果您編寫了一個解析器腳本,以便只提取其行也包含[machine-code]列中的值的源代碼行,那麼在所有擴展之後,只會得到最低級別的彙編源代碼,這聽起來就像您之後。請注意,這種技術不能用於可靠地複製原始數據,因爲您會錯過指令之間的指令,例如在指令之間切換數據和.code之間(如上所述)。再說一次,看起來你會回到一個需要使用反彙編程序的人。 – byteptr
- 1. 奇怪的宏(TASM)
- 2. __VA_ARGS__宏擴展
- 3. Verilog宏擴展
- 4. 宏擴展
- 5. Unfamilar宏擴展
- 6. MSVC++ variadic宏擴展
- 7. 快速宏擴展
- 8. 超載宏擴展
- 9. 延遲宏擴展
- 10. 瞭解宏擴展
- 11. 禁止宏擴展
- 12. C/C++宏擴展
- 13. C++宏擴展器
- 14. Clojure的宏擴展
- 15. 跟蹤宏擴展
- 16. C宏擴展如何工作?
- 17. 如何逐步查看宏擴展?
- 18. 如何在Android Studio中擴展C++宏?
- 19. 如何在guile scheme中擴展宏?
- 20. 如何跟蹤c宏擴展?
- 21. 如何擴展`類名/ staticField`宏語法
- 22. 如何在clojure中擴展宏?
- 23. 如何處理程序宏內的擴展宏?
- 24. 如何編寫擴展爲`#ifdef ...#endif`宏塊的C宏?
- 25. 宏擴展到額外的宏參數
- 26. 在遞歸擴展宏
- 27. C++宏擴展,調試
- 28. 預編譯可擴展宏
- 29. 錯誤用c宏擴展
- 30. C宏擴展說明
如果TASM不提供一種方法(我不知道),你可能要編譯源和objdump的二進制迴文本,如果它是值得的。 – Ped7g