Debian Codegraph @

terps/bocfel/process.h

raw symbols SCIP
1 // vim: set ft=cpp:
2
3 #ifndef ZTERP_PROCESS_H
4 #define ZTERP_PROCESS_H
5
6 #include <array>
7 #include <exception>
8
9 #include "stack.h"
10 #include "types.h"
11
12 static constexpr uint8_t JOURNEY_DIAL_EXT = 0xf0;
13 static constexpr uint8_t SHOGUN_MENU_EXT = 0xf1;
14
15 namespace Operation {
16 // Jump back to the previous round of interpreting. This is used
17 // when an interrupt routine returns.
18 class Return : public std::exception {
19 };
20
21 // Jump back to the first round of processing and continue; this is
22 // used for @restart, which is assumed to have put everything back
23 // in a clean state.
24 class Restart : public std::exception {
25 };
26
27 // Jump back to the first round of processing, but tell it to
28 // immediately stop. This is used to implement @quit.
29 class Quit : public std::exception {
30 };
31
32 // Jump back to the first round of processing, optionally calling
33 // zread() or zread_char(). This is used after a successful restore.
34 struct Restore : public std::exception {
35 explicit Restore(SaveOpcode saveopcode_) : saveopcode(saveopcode_) {
36 }
37
38 const SaveOpcode saveopcode;
39 };
40 }
41
42 extern unsigned long pc;
43 extern unsigned long current_instruction;
44
45 extern std::array<uint16_t, 8> zargs;
46 extern int znargs;
47
48 extern bool interrupt_override;
49
50 bool in_interrupt();
51 void setup_opcodes();
52 void process_instructions();
53 void process_loop();
54
55 #endif