Skip to content

Commit 4faac8c

Browse files
committed
Add u32 expression support and whitespace handling improvements
Major enhancements: - Extended expression evaluator to use u32 internally, allowing values > 65535 (e.g., $10000 for top-of-memory calculations) - Added low/high byte operators (< and >) for extracting byte components - Fixed lexer to allow whitespace in operands by splitting on first space only - Improved long branch expansion algorithm with proper symbol table handling Technical changes: - number.rs: Changed parse() to return u32 instead of u16 - parser/expression.rs: Added Expr::Number(u32), LowByte, HighByte variants - eval/expression.rs: Added evaluate_u32() and evaluate_u16() methods - assembler.rs: Updated all evaluate() calls to use evaluate_u16() - lexer.rs: Changed split_whitespace() to splitn(2, char::is_whitespace) This enables real-world 6502 code patterns like: LDA #<($10000 - RAM_SIZE) ; Calculate from top of memory OFFSET = BASE + $100 ; Complex constant expressions All existing tests pass, new u32 calculation tests verify correctness.
1 parent ca33621 commit 4faac8c

File tree

6 files changed

+308
-58
lines changed

6 files changed

+308
-58
lines changed

0 commit comments

Comments
 (0)