Use meaningful types for byte output functions

This commit is contained in:
ISSOtm
2020-02-09 16:06:30 +01:00
parent ffe9e92b48
commit 2f60e0a59e
3 changed files with 8 additions and 10 deletions

View File

@@ -26,8 +26,8 @@ struct Section *out_FindSectionByName(const char *pzName);
void out_NewSection(char const *pzName, uint32_t secttype, int32_t org, void out_NewSection(char const *pzName, uint32_t secttype, int32_t org,
struct SectionSpec const *attributes); struct SectionSpec const *attributes);
void out_AbsByte(int32_t b); void out_AbsByte(uint8_t b);
void out_AbsByteGroup(char const *s, int32_t length); void out_AbsByteGroup(uint8_t const *s, int32_t length);
void out_Skip(int32_t skip); void out_Skip(int32_t skip);
void out_String(char const *s); void out_String(char const *s);
void out_RelByte(struct Expression *expr); void out_RelByte(struct Expression *expr);

View File

@@ -1137,7 +1137,7 @@ constlist_8bit_entry : /* empty */
char *s = $1; char *s = $1;
int32_t length = charmap_Convert(&s); int32_t length = charmap_Convert(&s);
out_AbsByteGroup(s, length); out_AbsByteGroup((uint8_t*)s, length);
free(s); free(s);
} }
; ;

View File

@@ -199,9 +199,8 @@ void out_NewSection(char const *pzName, uint32_t secttype, int32_t org,
/* /*
* Output an absolute byte (bypassing ROM/union checks) * Output an absolute byte (bypassing ROM/union checks)
*/ */
static void absByteBypassCheck(int32_t b) static void absByteBypassCheck(uint8_t b)
{ {
b &= 0xFF;
pCurrentSection->tData[nPC] = b; pCurrentSection->tData[nPC] = b;
pCurrentSection->nPC++; pCurrentSection->nPC++;
nPC++; nPC++;
@@ -210,14 +209,14 @@ static void absByteBypassCheck(int32_t b)
/* /*
* Output an absolute byte * Output an absolute byte
*/ */
void out_AbsByte(int32_t b) void out_AbsByte(uint8_t b)
{ {
checkcodesection(); checkcodesection();
checksectionoverflow(1); checksectionoverflow(1);
absByteBypassCheck(b); absByteBypassCheck(b);
} }
void out_AbsByteGroup(char const *s, int32_t length) void out_AbsByteGroup(uint8_t const *s, int32_t length)
{ {
checkcodesection(); checkcodesection();
checksectionoverflow(length); checksectionoverflow(length);
@@ -278,11 +277,10 @@ void out_RelByte(struct Expression *expr)
/* /*
* Output an absolute word * Output an absolute word
*/ */
static void absWord(int32_t b) static void absWord(uint16_t b)
{ {
checkcodesection(); checkcodesection();
checksectionoverflow(2); checksectionoverflow(2);
b &= 0xFFFF;
pCurrentSection->tData[nPC] = b & 0xFF; pCurrentSection->tData[nPC] = b & 0xFF;
pCurrentSection->tData[nPC + 1] = b >> 8; pCurrentSection->tData[nPC + 1] = b >> 8;
pCurrentSection->nPC += 2; pCurrentSection->nPC += 2;
@@ -312,7 +310,7 @@ void out_RelWord(struct Expression *expr)
/* /*
* Output an absolute longword * Output an absolute longword
*/ */
static void absLong(int32_t b) static void absLong(uint32_t b)
{ {
checkcodesection(); checkcodesection();
checksectionoverflow(sizeof(int32_t)); checksectionoverflow(sizeof(int32_t));