File tree Expand file tree Collapse file tree 4 files changed +19
-39
lines changed Expand file tree Collapse file tree 4 files changed +19
-39
lines changed Original file line number Diff line number Diff line change 5
5
#include "registers.h"
6
6
#include "program.h"
7
7
8
+ enum instructions {
9
+ NOP ,
10
+ PUSH ,
11
+ POP ,
12
+ LOAD ,
13
+ STORE ,
14
+ JMP ,
15
+ JZ ,
16
+ JNZ ,
17
+ ADD ,
18
+ SUB ,
19
+ MUL ,
20
+ DIV ,
21
+ PRINT ,
22
+ STOP
23
+ };
24
+
8
25
uint16_t ip = 0 ;
9
26
10
27
void inop (void )
Original file line number Diff line number Diff line change 3
3
4
4
#include <stdint.h>
5
5
6
- enum instructions {
7
- NOP ,
8
- PUSH ,
9
- POP ,
10
- LOAD ,
11
- STORE ,
12
- JMP ,
13
- JZ ,
14
- JNZ ,
15
- ADD ,
16
- SUB ,
17
- MUL ,
18
- DIV ,
19
- PRINT ,
20
- STOP
21
- };
22
-
23
- extern uint16_t ip ;
24
-
25
- void inop (void );
26
- void ipush (int32_t element );
27
- void ipop (void );
28
- void iload (uint8_t reg );
29
- void istore (uint8_t reg );
30
- void ijmp (uint16_t position );
31
- void ijz (uint16_t position );
32
- void ijnz (uint16_t position );
33
- void iadd (void );
34
- void isub (void );
35
- void imul (void );
36
- void idiv (void );
37
- void iprint (void );
38
- void istop (void );
39
-
40
6
void call_instruction (void );
41
7
42
8
#endif /* end of include guard: INSTRUCTIONS_H */
Original file line number Diff line number Diff line change 2
2
#include <stdio.h>
3
3
#include "stack.h"
4
4
5
+ static const int STACK_SIZE = 256 ;
6
+
5
7
int32_t stack [STACK_SIZE ];
6
8
uint8_t sp = 0 ;
7
9
Original file line number Diff line number Diff line change 3
3
4
4
#include <stdint.h>
5
5
6
- static const int STACK_SIZE = 256 ;
7
-
8
- extern int32_t stack [STACK_SIZE ];
9
- extern uint8_t sp ;
10
-
11
6
void stack_push (int32_t element );
12
7
13
8
int32_t stack_pop (void );
You can’t perform that action at this time.
0 commit comments