Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download
# file opened: lua_inctext.asm
1 0000 ; setup Lua "inc_text" functionality
2 0000 INCLUDELUA "lua_inctext.lua"
3 0000
4 0000 OUTPUT "lua_inctext.bin"
5 0000
6 0000 ORG 0x8000
7 8000 21 10 80 ld hl,Text1 ; using labels defined from the text file (included below)
8 8003 11 30 80 ld de,Text2
9 8006 DD 21 41 80 ld ix,Text3
10 800A CD 59 80 call Final
11 800D C3 0D 80 jp $
12 8010
13 8010 LUA ALLPASS
14 8010 ~ -- inc_text(file_name, ">>", 13) -- default values of parameters
15 8010 ~ inc_text("lua_inctext/test.txt") -- test defaults
16 8010 ~ inc_text("lua_inctext/test2.txt", "!!", 10) -- test non-default parameters
17 8010 ~ inc_text("missing file") -- test error handling
18 8010 ;; inc_text ;; file "lua_inctext/test.txt", asm_marker ">>", eol_byte 13
18 8010 Text1
18 8010 48 65 6C 6C ; these bytes were emitted silently/externally (lua script?)
18 8014 6F 21 21 0D
18 8018 52 65 61 64
18 801C 79 3F 0D 22
18 8020 33 22 0D 3E
18 8024 32 3C 0D 27
18 8028 31 27 0D 47
18 802C 6F 21 0D
18 802F 00 DB 0 ; turn it into zero-terminated string by adding zero
18 8030 Text2 ; the ASCII art begins with space, the ">>" is not marker, but data!
18 8030 53 4F 53 21 ; these bytes were emitted silently/externally (lua script?)
18 8034 21 21 0D 20
18 8038 3E 3E 20 5C
18 803C 5F 6F 5F 2F
18 8040 0D
18 8041 Text3
18 8041 47 41 4D 45 ; these bytes were emitted silently/externally (lua script?)
18 8045 20 4F 56 45
18 8049 52 0D 50 52
18 804D 45 53 53 20
18 8051 41 4E 59 20
18 8055 4B 45 59 0D
18 8059 Final
18 8059
18 8059 3E 3E LD A, '>' ; binary ">>"
18 805B 07 RLCA
18 805C C3 59 80 JP Final
18 805F 53 45 56 45 BYTE "SEVER",0,"BURAN",0
18 8063 52 00 42 55
18 8067 52 41 4E 00
18 806B ;; inc_text ;; end of file "lua_inctext/test.txt"
18 806B ;; inc_text ;; file "lua_inctext/test2.txt", asm_marker "!!", eol_byte 10
18 806B Test2_Text1
18 806B 48 65 6C 6C ; these bytes were emitted silently/externally (lua script?)
18 806F 6F 21 21 0A
18 8073 3E 3E 09 44
18 8077 42 20 30 0A
18 807B 00 DB 0 ; line above has "wrong" marker and will be added as text
18 807C C3 7C 80 Test2_Final jp Test2_Final
18 807F ;; inc_text ;; end of file "lua_inctext/test2.txt"
lua_inctext.lua(22): error: [LUA] [inc_text]: file not found: missing file
lua_inctext.asm(18): ^ emitted from here
18 807F ENDLUA
19 807F
20 807F OUTEND
# file closed: lua_inctext.asm
Value Label
------ - -----------------------------------------------------------
0x8010 Text1
0x8030 Text2
0x8041 Text3
0x8059 Final
0x806B X Test2_Text1
0x807C Test2_Final