-
Notifications
You must be signed in to change notification settings - Fork 3
/
cif.c
40 lines (37 loc) · 1.54 KB
/
cif.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
*******************************************************************
*** This software is copyright 2021 by Michael H Riley ***
*** You have permission to use, modify, copy, and distribute ***
*** this software so long as this copyright notice is retained. ***
*** This software may not be used in commercial applications ***
*** without express written permission from the author. ***
*******************************************************************
*/
#include "header.h"
char* cif(char* line) {
word addr;
line = trim(line);
line = cexpr(line, 0);
if (exprErrors > 0) return line;
line = trim(line);
Asm(" sex r7 ; Point X to expr stack");
Asm(" irx ; Move to lsb of result");
Asm(" ldxa ; retrieve it");
Asm(" or ; combine with byte 2");
if (use32Bits) {
Asm(" irx ; move to byte 3");
Asm(" or ; combine");
Asm(" irx ; move to byte 4");
Asm(" or ; and combine");
}
Asm(" sex r2 ; Point X to system stack");
findNextLineNumber(lastLineNumber, &addr);
sprintf(buffer," lbz l_%d ; Jump if test failed",addr); Asm(buffer);
if (strncasecmp(line,"then",4) == 0) {
line += 4;
}
line = trim(line);
line--;
*line = ':';
return line;
}