aboutsummaryrefslogtreecommitdiff
path: root/src/libout.c
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2016-05-11 09:18:52 +0100
committerIan C <ianc@noddybox.co.uk>2016-05-11 09:18:52 +0100
commite60cc5a36c148ef5ea0e38bcc848cf32f2b54a18 (patch)
tree0170a51b02b56d17e2b9e4c4e4716aaf0e4ac3c5 /src/libout.c
parent728bbf0dee1e66c30fa57f278d4a82e576f6398b (diff)
Added option to import only labels from library.
Diffstat (limited to 'src/libout.c')
-rw-r--r--src/libout.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/libout.c b/src/libout.c
index 5aed18c..f9ca74f 100644
--- a/src/libout.c
+++ b/src/libout.c
@@ -149,8 +149,12 @@ int LibLoad(const char *filename, LibLoadOption opt,
int min;
int len;
int old_pc;
+ unsigned old_bank;
Byte *p;
+ old_bank = Bank();
+ old_pc = PC();
+
bank = ReadNumber(fp);
min = ReadNumber(fp);
len = ReadNumber(fp);
@@ -159,20 +163,25 @@ int LibLoad(const char *filename, LibLoadOption opt,
fread(buff, 1, len, fp);
- old_pc = PC();
-
SetPC(min);
p = buff;
- while(len-- > 0)
+ if (opt != LibLoadLabels)
{
- PCWrite(*p++);
+ while(len-- > 0)
+ {
+ PCWrite(*p++);
+ }
}
SetPC(old_pc);
+ SetAddressBank(old_bank);
}
- LabelReadBlob(fp);
+ if (opt != LibLoadMemory)
+ {
+ LabelReadBlob(fp);
+ }
fclose(fp);