Fixed corruption in ff00-ffff, improved checks for | and $, thanks karolbelina!

This commit is contained in:
Andrew Alderwick 2021-10-23 23:15:07 +01:00
parent 6799b5f78e
commit 5807e22fef
1 changed files with 4 additions and 2 deletions

View File

@ -12,7 +12,7 @@ WITH REGARD TO THIS SOFTWARE.
*/
#define TRIM 0x0100
#define LENGTH 0x10000 - TRIM
#define LENGTH 0x10000
typedef unsigned char Uint8;
typedef signed char Sint8;
@ -366,11 +366,13 @@ pass2(FILE *f)
if(skipblock(w, &ccmnt, '(', ')')) continue;
if(skipblock(w, &cmacr, '{', '}')) continue;
if(w[0] == '|') {
if(p.length && shex(w + 1) < p.ptr)
if(p.length && (Uint16)shex(w + 1) < p.ptr)
return error("Pass 2 - Memory overwrite", w);
p.ptr = shex(w + 1);
continue;
} else if(w[0] == '$') {
if(p.length && (Uint16)(p.ptr + shex(w + 1)) < p.ptr)
return error("Pass 2 - Memory overwrite", w);
p.ptr += shex(w + 1);
continue;
} else if(w[0] == '@') {