shithub: rgbds

Download patch

ref: 2f60e0a59ee72647d223c86d246a8ca4893c133f
parent: ffe9e92b4878ccc21ef49df7c8f0234c16059aa3
author: ISSOtm <[email protected]>
date: Sun Feb 9 11:06:30 EST 2020

Use meaningful types for byte output functions

--- a/include/asm/section.h
+++ b/include/asm/section.h
@@ -26,8 +26,8 @@
 void out_NewSection(char const *pzName, uint32_t secttype, int32_t org,
 		    struct SectionSpec const *attributes);
 
-void out_AbsByte(int32_t b);
-void out_AbsByteGroup(char const *s, int32_t length);
+void out_AbsByte(uint8_t b);
+void out_AbsByteGroup(uint8_t const *s, int32_t length);
 void out_Skip(int32_t skip);
 void out_String(char const *s);
 void out_RelByte(struct Expression *expr);
--- a/src/asm/asmy.y
+++ b/src/asm/asmy.y
@@ -1137,7 +1137,7 @@
 			char *s = $1;
 			int32_t length = charmap_Convert(&s);
 
-			out_AbsByteGroup(s, length);
+			out_AbsByteGroup((uint8_t*)s, length);
 			free(s);
 		}
 ;
--- a/src/asm/section.c
+++ b/src/asm/section.c
@@ -199,9 +199,8 @@
 /*
  * 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->nPC++;
 	nPC++;
@@ -210,7 +209,7 @@
 /*
  * Output an absolute byte
  */
-void out_AbsByte(int32_t b)
+void out_AbsByte(uint8_t b)
 {
 	checkcodesection();
 	checksectionoverflow(1);
@@ -217,7 +216,7 @@
 	absByteBypassCheck(b);
 }
 
-void out_AbsByteGroup(char const *s, int32_t length)
+void out_AbsByteGroup(uint8_t const *s, int32_t length)
 {
 	checkcodesection();
 	checksectionoverflow(length);
@@ -278,11 +277,10 @@
 /*
  * Output an absolute word
  */
-static void absWord(int32_t b)
+static void absWord(uint16_t b)
 {
 	checkcodesection();
 	checksectionoverflow(2);
-	b &= 0xFFFF;
 	pCurrentSection->tData[nPC] = b & 0xFF;
 	pCurrentSection->tData[nPC + 1] = b >> 8;
 	pCurrentSection->nPC += 2;
@@ -312,7 +310,7 @@
 /*
  * Output an absolute longword
  */
-static void absLong(int32_t b)
+static void absLong(uint32_t b)
 {
 	checkcodesection();
 	checksectionoverflow(sizeof(int32_t));