-
Notifications
You must be signed in to change notification settings - Fork 3
/
cgoto.c
31 lines (28 loc) · 955 Bytes
/
cgoto.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
/*
*******************************************************************
*** 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* cgoto(char* line) {
word target;
word lineno;
line = trim(line);
line = getNumber(line, &lineno);
if (lineno == 0) {
showError("Invalid line number for goto");
*line = 0;
return line;
}
if (findLine(lineno, &target) != 0) {
showError("Line number not found");
*line = 0;
return line;
}
sprintf(buffer," lbr l_%d ; Jump",lineno); Asm(buffer);
return line;
}