[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-mes] [PATCH mescc-tools] Add support for 24-bit displacements (for
From: |
Danny Milosavljevic |
Subject: |
[bug-mes] [PATCH mescc-tools] Add support for 24-bit displacements (for ARM). |
Date: |
Wed, 6 Feb 2019 18:43:06 +0100 |
* M1-macro.c: Add support for 24-bit numbers.
* hex2_linker.c: Add support for 24-bit displacements.
---
M1-macro.c | 5 +++++
hex2_linker.c | 8 +++++---
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/M1-macro.c b/M1-macro.c
index c128136..f4ffb69 100644
--- a/M1-macro.c
+++ b/M1-macro.c
@@ -432,6 +432,11 @@ char* express_number(int value, char c)
number_of_bytes = 2;
value = value & 0xFFFF;
}
+ else if('~' == c)
+ {
+ number_of_bytes = 3;
+ value = value & 0xFFFFFF;
+ }
else if('%' == c)
{
number_of_bytes = 4;
diff --git a/hex2_linker.c b/hex2_linker.c
index 3a375cf..513e8de 100644
--- a/hex2_linker.c
+++ b/hex2_linker.c
@@ -190,6 +190,7 @@ int ConsumePointer(char ch, FILE* source_file, char* s)
/* Calculate pointer size*/
if((37 == ch) || (38 == ch)) ip = ip + 4; /* Deal with % and & */
else if((64 == ch) || (36 == ch)) ip = ip + 2; /* Deal with @ and $ */
+ else if(126 == ch) ip = ip + 3; /* Deal with ~ */
else if(33 == ch) ip = ip + 1; /* Deal with ! */
else
{
@@ -229,6 +230,7 @@ void storePointer(char ch, FILE* source_file)
}
else if(36 == ch) outputPointer(target, 2); /* Deal with $ */
else if(64 == ch) outputPointer(displacement, 2); /* Deal with @ */
+ else if(126 == ch) outputPointer(displacement, 3); /* Deal with ~ */
else if(38 == ch) outputPointer(target, 4); /* Deal with & */
else if(37 == ch) outputPointer(displacement, 4); /* Deal with % */
else
@@ -362,8 +364,8 @@ void first_pass(struct input_files* input)
}
/* check for and deal with relative/absolute pointers to labels
*/
- if((33 == c) || (64 == c) || (36 == c) || (37 == c) || (38 ==
c))
- { /* deal with 1byte pointer !; 2byte pointers (@ and $); 4byte
pointers (% and &) */
+ if((33 == c) || (64 == c) || (36 == c) || (37 == c) || (38 ==
c) || (126 == c))
+ { /* deal with 1byte pointer !; 2byte pointers (@ and $); 3byte
pointers ~; 4byte pointers (% and &) */
c = ConsumePointer(c, source_file, NULL);
if (62 == c)
{ /* deal with label>base */
@@ -397,7 +399,7 @@ void second_pass(struct input_files* input)
for(c = fgetc(source_file); EOF != c; c = fgetc(source_file))
{
if(58 == c) c = consume_token(source_file, NULL); /* Deal with
: */
- else if((33 == c) || (64 == c) || (36 == c) || (37 == c) || (38
== c)) storePointer(c, source_file); /* Deal with !, @, $, % and & */
+ else if((33 == c) || (64 == c) || (36 == c) || (37 == c) || (38
== c) || (126 == c)) storePointer(c, source_file); /* Deal with !, @, $, %, &
and ~ */
else process_byte(c, source_file, TRUE);
}
- [bug-mes] [PATCH mescc-tools] Add support for 24-bit displacements (for ARM).,
Danny Milosavljevic <=