Fix labels and jumps

This commit is contained in:
2025-02-11 12:29:11 +01:00
parent f8b0307949
commit 0fc4040ad7
4 changed files with 57 additions and 139 deletions

View File

@@ -24,7 +24,7 @@
//
typedef struct {
char name[64];
int address; // address (in the output machine code)
uint32_t address; // address (in the output machine code)
} Label;
extern Label labels[MAX_LABELS];
@@ -43,7 +43,7 @@ void toLowerCase(char *string);
int lookupLabel(const char *name);
// Add a label to the table
int addLabel(const char *name, int address);
int addLabel(const char *name, uint32_t address);
//
// Parse a register string (e.g., "R0", "R1", etc.) and return it's number.
@@ -83,7 +83,7 @@ void firstPass(const char *source);
// The second pass actually translates the assembly instructions to machine code.
// The machine code is written into the provided buffer. (It must be large enough.)
//
int completePass(const char *input, CPU *cpu, bool erase);
uint32_t completePass(const char *input, CPU *cpu, bool erase);
#endif //RISCB_ASSEMBLER_H