-
Notifications
You must be signed in to change notification settings - Fork 3
/
cend.c
43 lines (40 loc) · 1.39 KB
/
cend.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
40
41
42
/*
*******************************************************************
*** 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* cend(char* line) {
if (useStg) {
Asm(" ldi STG_.1");
Asm(" phi rf");
Asm(" ldi STG_.0");
Asm(" plo rf");
Asm(" lda rf");
Asm(" phi r2");
Asm(" ldn rf");
Asm(" plo r2");
Asm(" sex r2");
Asm(" irx");
Asm(" ldxa");
Asm(" plo r6");
Asm(" ldx");
Asm(" phi r6");
Asm(" sep sret");
}
else if (exitAddress != 0xffff) {
sprintf(buffer," lbr 0%xh ; Jump to exit address",exitAddress); Asm(buffer);
}
else if (useElfos) {
Asm(" lbr 0303h ; Jump to exit address");
}
else {
Asm(" idl ; Idle the CPU");
Asm(" lbr $-1");
}
return line;
}