瀏覽代碼

+ support labels in the 6502 inline assembler reader

Nikolay Nikolov 2 月之前
父節點
當前提交
f1b1ac55f4
共有 1 個文件被更改,包括 32 次插入21 次删除
  1. 32 21
      compiler/mos6502/ramos6502asm.pas

+ 32 - 21
compiler/mos6502/ramos6502asm.pas

@@ -196,8 +196,19 @@ Unit ramos6502asm;
                 actasmtoken:=AS_END;
                 exit;
               end;
-            message1(asmr_e_unknown_opcode,actasmpattern);
-            actasmtoken:=AS_NONE;
+            { Local label ? }
+            if is_locallabel(actasmpattern) then
+              begin
+                actasmtoken:=AS_LLABEL;
+                firsttoken:=true;
+                exit;
+              end
+            else
+              begin
+                actasmtoken:=AS_LABEL;
+                firsttoken:=true;
+                exit;
+              end;
           end
         else { else firsttoken }
           { Here we must handle all possible cases }
@@ -2014,25 +2025,25 @@ Unit ramos6502asm;
         { main loop }
         repeat
           case actasmtoken of
-            //AS_LLABEL:
-            //  Begin
-            //    if CreateLocalLabel(actasmpattern,hl,true) then
-            //      ConcatLabel(curlist,hl);
-            //    Consume(AS_LLABEL);
-            //  end;
-            //
-            //AS_LABEL:
-            //  Begin
-            //    if SearchLabel(upper(actasmpattern),hl,true) then
-            //      begin
-            //        if hl.is_public then
-            //          ConcatPublic(curlist,actasmpattern_origcase);
-            //        ConcatLabel(curlist,hl);
-            //      end
-            //    else
-            //     Message1(asmr_e_unknown_label_identifier,actasmpattern);
-            //    Consume(AS_LABEL);
-            //  end;
+            AS_LLABEL:
+              Begin
+                if CreateLocalLabel(actasmpattern,hl,true) then
+                  ConcatLabel(curlist,hl);
+                Consume(AS_LLABEL);
+              end;
+
+            AS_LABEL:
+              Begin
+                if SearchLabel(upper(actasmpattern),hl,true) then
+                  begin
+                    if hl.is_public then
+                      ConcatPublic(curlist,actasmpattern_origcase);
+                    ConcatLabel(curlist,hl);
+                  end
+                else
+                 Message1(asmr_e_unknown_label_identifier,actasmpattern);
+                Consume(AS_LABEL);
+              end;
 
             AS_END:
               begin