diff options
author | Juan J. Martinez <jjm@usebox.net> | 2023-05-11 18:55:06 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2023-05-11 18:55:06 +0100 |
commit | 871062265cdfb565ba64834cfd85f079f387317e (patch) | |
tree | 3768449b1c73a9d367c07488f1380bf18dddae81 /tr8vm.c | |
parent | 89b7d027048108cc18c4afe36fcc079800abea3f (diff) | |
download | tr8vm-871062265cdfb565ba64834cfd85f079f387317e.tar.gz tr8vm-871062265cdfb565ba64834cfd85f079f387317e.zip |
Make address unsigned
Convert x, y coord to signed when we do the clipping.
Diffstat (limited to 'tr8vm.c')
-rw-r--r-- | tr8vm.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -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; |