Marie程序汇编报错:标签不能以0..9作为起始字符的问题排查
Hey there, let's break down exactly what's causing your assembly failure and how to fix it:
The Root Cause
The error message spells it out clearly: MARIE's assembler doesn't allow labels to start with a digit (0-9). Looking at your code, the issue is the line near the end: 0, DEC 01. The label here is a single digit 0, which violates MARIE's label naming rules.
MARIE requires all labels to start with an alphabetic character (A-Z, case typically doesn't matter for most MARIE assemblers), and you can follow it with additional letters or digits if needed.
Corrected Code
Here's your code with the problematic label fixed (I renamed 0 to ZERO to comply with the rules):
START, INPUT SKIPCOND 800 HALT OUTPUT STORE A SUB Z SKIPCOND 800 SKIPCOND 000 JUMP START X, INPUT STORE B OUTPUT SUB A SKIPCOND 800 JUMP Y JUMP X Y, LOAD B ADD C STORE S EVEN, SUB T SKIPCOND 800 JUMP L JUMP EVEN L, SKIPCOND 400 JNS ODD LOAD S OUTPUT LOAD A SUB S STORE N OUTPUT JUMP START ODD, OUTPUT S LOAD S ADD 0 STORE S JUMPI ODD A, DEC 00 B, DEC 00 S, DEC 00 N, DEC 04 C, DEC 04 Z, DEC 94 T, DEC 02 ZERO, DEC 01 END START
Quick Reminder
Going forward, double-check any new labels you add to make sure they start with a letter—this will keep you from running into the same error again.
内容的提问来源于stack exchange,提问作者TK708

