%macro dhl 1.nolist db (%1) >> 8 db (%1) & 0xFF %endmacro %macro dhla 1.nolist db ((%1)-_f0) >> 8 db ((%1)-_f0) & 0xFF %endmacro SECTION .data global _f0 _f0: ;; lua: return gsub(strings.Cdefs, "#", "%%") %define H_C1 0x00 %define H_RSR 0x01 %define H_COL 0x02 %define H_C0 0x03 %define H_DROPPING 0x04 %define H_LUAC0 0x05 %define H_LUAC1 0x06 %define H_LUAC2 0x07 %define FIP_RETURN 0xFFFF %define FIP_RSREXIT 0xFFFE %define FIP_FIPDROP 0xFFFD %define SF_EXIT 0xFF %define SF_DUP 0xFE %define F_EXIT 0xFDFF %define F_STO 0xFDFE %define F_DUP 0xFDFD %define F_PLUS 0xFDFC %define F_1 0xFDFB %define F_TOS 0xFDFA %define F_lua_statex21 0xFDF9 %define F_0 0xFDF8 ;; lua: return strings.nasmbytecode ADR_strlen: db H_C1 extern strlen dd strlen ADR_0x24: db H_RSR ADR_S0x24: db H_COL dhl F_STO db SF_DUP db SF_DUP dhl ADR_strlen -_f0 dhl F_PLUS dhl F_1 dhl F_PLUS dhl F_TOS db SF_EXIT ADR_lua_open: db H_C0 extern lua_open dd lua_open ADR_lua_stdlibsopen: db H_DROPPING db H_LUAC0 extern lua_stdlibsopen dd lua_stdlibsopen ADR_lua_getglobal: db H_DROPPING db H_LUAC1 extern lua_getglobal dd lua_getglobal ADR_lua_pushstring: db H_DROPPING db H_LUAC1 extern lua_pushstring dd lua_pushstring ADR_lua_call: db H_DROPPING db H_LUAC2 extern lua_call dd lua_call global ADR_DEMO ADR_DEMO: db H_COL dhl ADR_lua_open -_f0 dhl F_lua_statex21 dhl ADR_lua_stdlibsopen -_f0 dhl ADR_0x24 -_f0 db 'print',0 dhl ADR_lua_getglobal -_f0 dhl ADR_0x24 -_f0 db 'Hello',0 dhl ADR_lua_pushstring -_f0 dhl F_1 dhl F_0 dhl ADR_lua_call -_f0 db SF_EXIT