Mercurial > repos > simple16
comparison src/asm.c @ 58:bed2d84eeabe
Fix ldimh special casing of loading labels for the case when the label is not a forward reference
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 06 Sep 2016 09:42:31 -0700 |
parents | c44170825b16 |
children | b15187a99d6f |
comparison
equal
deleted
inserted
replaced
57:c44170825b16 | 58:bed2d84eeabe |
---|---|
352 label *l = find_label(meta, arg); | 352 label *l = find_label(meta, arg); |
353 if (!l) { | 353 if (!l) { |
354 l = add_label(meta, arg, 0, 0); | 354 l = add_label(meta, arg, 0, 0); |
355 } | 355 } |
356 if (l->valid) { | 356 if (l->valid) { |
357 value = l->address; | 357 if (*inst == LDIMH) { |
358 value = l->address >> 8; | |
359 } else { | |
360 value = l->address; | |
361 } | |
358 } else { | 362 } else { |
359 value = 0; | 363 value = 0; |
360 add_reference(l, pc, (*inst & 0xF) == LDIMH ? IMMEDHI : (*inst & 0xF) == LDIM ? IMMED8 : IMMED4); | 364 add_reference(l, pc, (*inst & 0xF) == LDIMH ? IMMEDHI : (*inst & 0xF) == LDIM ? IMMED8 : IMMED4); |
361 } | 365 } |
362 } | 366 } |