mirror of
https://github.com/g012/l65.git
synced 2024-11-15 19:09:19 +00:00
Added .label syntax for local labels.
This commit is contained in:
parent
262a5aa53c
commit
3eaa655784
10
asm.lua
10
asm.lua
@ -17,7 +17,11 @@ syntax6502_off
|
||||
lda = 5 if lda < 6 then print('yep') end
|
||||
syntax6502_on
|
||||
|
||||
section "waitForIntim"
|
||||
--@@data samepage byte(1, 2) crosspage byte(3, 4)
|
||||
|
||||
--section{ "toto", align = 256, offset = 16 }
|
||||
--section{ "toto", org = 0xf100 }
|
||||
section "waitForIntim" --alt short syntax when no other option: @@waitForIntim ?
|
||||
-- n_{ a=INTIM } ?
|
||||
--lda(INTIM) -- or a=INTIM
|
||||
--bne "waitForIntim"
|
||||
@ -38,11 +42,11 @@ section "waitForIntim"
|
||||
asl
|
||||
asl INTIM
|
||||
asl
|
||||
@_toto
|
||||
@.toto
|
||||
bne "test"
|
||||
bne waitForIntim
|
||||
bne f()
|
||||
bne _toto
|
||||
bne .toto
|
||||
|
||||
jam asl lsr ldx #16 ldy 0xf0f0
|
||||
|
||||
|
7
l65.lua
7
l65.lua
@ -1128,11 +1128,13 @@ local function ParseLua(src)
|
||||
-- label declarations
|
||||
if not stat then
|
||||
if tok:ConsumeSymbol('@', tokenList) then
|
||||
local is_local
|
||||
if tok:ConsumeSymbol('.', tokenList) then is_local = true end
|
||||
if not tok:Is('Ident') then return false, GenerateError("<ident> expected.") end
|
||||
local label_name = tok:Get(tokenList)
|
||||
opcode_tok = tokenList[1]
|
||||
label_name = as_string_expr(label_name, label_name.Data)
|
||||
stat = emit_call('label', label_name)
|
||||
stat = emit_call(is_local and 'label_local' or 'label', label_name)
|
||||
end end
|
||||
|
||||
-- 6502 opcodes
|
||||
@ -1141,11 +1143,12 @@ local function ParseLua(src)
|
||||
if tok:ConsumeKeyword(op, tokenList) then
|
||||
opcode_tok = tokenList[1]
|
||||
if opcode_relative[op] then
|
||||
if tok:ConsumeSymbol('.', tokenList) then is_local = true end
|
||||
local st, expr = ParseExpr(scope) if not st then return false, expr end
|
||||
if expr.AstType == 'VarExpr' and expr.Variable.IsGlobal then
|
||||
expr = as_string_expr(expr, expr.Name)
|
||||
end
|
||||
stat = emit_opcode(op .. "_relative", expr) break
|
||||
stat = emit_opcode(op .. "_relative" .. (is_local and '_local' or ''), expr) break
|
||||
end
|
||||
if opcode_immediate[op] and tok:ConsumeSymbol('#') then
|
||||
local st, expr = ParseExpr(scope) if not st then return false, expr end
|
||||
|
Loading…
Reference in New Issue
Block a user