This commit is contained in:
nilsplk 2023-10-26 14:03:31 +02:00
parent d05c415295
commit d947afdf03

23
njvm.c
View File

@ -54,6 +54,15 @@ unsigned int code3[] = {
(WRCHR << 24), (WRCHR << 24),
(HALT << 24) (HALT << 24)
}; };
void copyToProgramm(unsigned int codeToCopy[]){
int size = sizeof(codeToCopy)/sizeof(codeToCopy[0]);
for (int i = 0; i < size; i++) {
printf("Test\n");
}
printf("%i",size);
}
// Stack // Stack
#define maxValues 1000 #define maxValues 1000
@ -151,7 +160,7 @@ end:
} }
#ifdef DEBUG #ifdef DEBUG
void printStck(void){ void printStack(void){
if(current >= 0) return; if(current >= 0) return;
printf("----\n"); printf("----\n");
for (int i = 0; i < current; i++) { for (int i = 0; i < current; i++) {
@ -162,17 +171,7 @@ void printStck(void){
void tests(void){ void tests(void){
printf("Runnig debug mode\n"); printf("Runnig debug mode\n");
stackPush(10); copyToProgramm(code1);
stackPush(15);
stackPush(13);
printStck();
current = 0;
programmSpeicher[0] = (RDINT << 24);
programmSpeicher[1] = (RDINT << 24);
programmSpeicher[2] = (MOD << 24);
programmSpeicher[3] = (WRINT << 24);
execute();
printStck();
} }
#endif /* ifdef DEBUG */ #endif /* ifdef DEBUG */