aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-05-11 18:55:06 +0100
committerJuan J. Martinez <jjm@usebox.net>2023-05-11 18:55:06 +0100
commit871062265cdfb565ba64834cfd85f079f387317e (patch)
tree3768449b1c73a9d367c07488f1380bf18dddae81
parent89b7d027048108cc18c4afe36fcc079800abea3f (diff)
downloadtr8vm-871062265cdfb565ba64834cfd85f079f387317e.tar.gz
tr8vm-871062265cdfb565ba64834cfd85f079f387317e.zip
Make address unsigned
Convert x, y coord to signed when we do the clipping.
-rw-r--r--tr8vm.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/tr8vm.c b/tr8vm.c
index ca2452e..5af21fe 100644
--- a/tr8vm.c
+++ b/tr8vm.c
@@ -159,7 +159,7 @@ static void update_ctl(SDL_Event *ev)
uint8_t blt_set = 0;
uint8_t blt_paramc = 0;
-int8_t blt_param[6] = { 0 };
+uint8_t blt_param[6] = { 0 };
uint8_t port(uint8_t p, uint8_t v)
{
@@ -192,8 +192,8 @@ uint8_t port(uint8_t p, uint8_t v)
{
uint16_t src = blt_param[0] | (blt_param[1] << 8);
- for (int16_t y = blt_param[3]; y < blt_param[3] + blt_param[5]; y++)
- for (int16_t x = blt_param[2]; x < blt_param[2] + blt_param[4]; x++)
+ for (int16_t y = (int8_t)blt_param[3]; y < (int8_t)blt_param[3] + blt_param[5]; y++)
+ for (int16_t x = (int8_t)blt_param[2]; x < (int8_t)blt_param[2] + blt_param[4]; x++)
{
uint8_t b = read_m(src++);
@@ -213,8 +213,8 @@ uint8_t port(uint8_t p, uint8_t v)
{
uint16_t dst = blt_param[0] | (blt_param[1] << 8);
- for (int16_t y = blt_param[3]; y < blt_param[3] + blt_param[5]; y++)
- for (int16_t x = blt_param[2]; x < blt_param[2] + blt_param[4]; x++)
+ for (int16_t y = (int8_t)blt_param[3]; y < (int8_t)blt_param[3] + blt_param[5]; y++)
+ for (int16_t x = (int8_t)blt_param[2]; x < (int8_t)blt_param[2] + blt_param[4]; x++)
{
uint8_t b = 0;