另外一個在週末看到的奇怪東西,用 x86 組語寫的 web forum:「AsmBB – a lightweight web forum engine written in assembly language (asmbb.org)」,官網在 asmBB 這邊,說明則是在「What is AsmBB?」這頁。
是個 x86 assembly + SQLite 的組合:
AsmBB is fully written in assembly language and uses SQLite as a database back-end. That is why it can work on really weak hosting and in the same time serve huge amount of visitors without lags and delays.
程式碼是用 Fossil 管的,不過作者有 mirror 到 GitHub 上:「johnfound/asmbb」。
SQlite 的部分用了 SQLeet,可以在 sqleet.inc 這個檔案裡面看到引用了 libsqleet.so
:
AsmBB uses SQLite with SQLeet extension as a back-end storage database and FastCGI interface to the web server.
組語的部分看起來是用 fasm 寫的,看程式碼 (像是 encryption.asm) 可以看到一些好用的語法,像是自動處理 function 參數的部分 (應該有設定某種 convention),跟當年寫 MASM 的用法方便不少:
stdcall TextCreate, sizeof.TText mov edx, eax stdcall TextCat, edx, <"Content-type: text/html; charset=utf-8", 13, 10, 13, 10> stdcall RenderTemplate, edx, 'crypto.tpl', 0, esi