mirror of
https://github.com/aap/pdp6.git
synced 2026-01-11 23:53:31 +00:00
made emulator use less cpu
This commit is contained in:
parent
e000f5b5a7
commit
d50b59c325
@ -828,6 +828,7 @@ cli(FILE *in, Channel **c)
|
||||
void*
|
||||
cmdthread(void *p)
|
||||
{
|
||||
threadname("cli");
|
||||
cli(stdin, p);
|
||||
quit(0);
|
||||
return nil;
|
||||
|
||||
@ -835,6 +835,8 @@ renderthread(void *arg)
|
||||
SDL_Event ev;
|
||||
SDL_Texture *tex;
|
||||
|
||||
threadname("dis340");
|
||||
|
||||
dis = arg;
|
||||
|
||||
crtinit();
|
||||
@ -866,12 +868,15 @@ renderthread(void *arg)
|
||||
SDL_RenderClear(renderer);
|
||||
|
||||
render(dis->crt);
|
||||
// SDL_Delay(30);
|
||||
|
||||
SDL_UpdateTexture(tex, nil, dis->crt->pixels, 1024*sizeof(u32));
|
||||
SDL_RenderCopy(renderer, tex, nil, nil);
|
||||
|
||||
SDL_RenderPresent(renderer);
|
||||
|
||||
// probably not the best idea to do it like this,
|
||||
// should perhaps add a time delta to render instead
|
||||
SDL_Delay(30);
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
@ -56,6 +56,8 @@ simthread(void *p)
|
||||
{
|
||||
Task *t;
|
||||
|
||||
threadname("sim");
|
||||
|
||||
printf("[simthread] start\n");
|
||||
for(;;)
|
||||
for(t = tasks; t; t = t->next){
|
||||
|
||||
@ -48,8 +48,10 @@ mount ptr ../code/ptp.out
|
||||
#mount dx1 ../test/out.dt6
|
||||
#mount dx1 ../test/test.dt6
|
||||
mount dx1 ../files/sys6.dtr
|
||||
##mount dx1 ../system.dtr
|
||||
#mount dx2 ../test/stuff.dtr
|
||||
#mount dx2 ../test/spcwar.dtr
|
||||
mount dx2 ../test/foo.dtr
|
||||
#mount dx2 ../test/foo.dtr
|
||||
mount dx2 ../test/aap.dtr
|
||||
|
||||
#load -b ../maint/pdp6.part1
|
||||
|
||||
@ -1336,6 +1336,7 @@ void main340(void);
|
||||
// SDL_UnlockSurface(screen);
|
||||
|
||||
SDL_RenderPresent(renderer);
|
||||
SDL_Delay(30);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -109,6 +109,9 @@ rtcthread(void *p)
|
||||
RtcMsg msg;
|
||||
int loss;
|
||||
|
||||
threadname("rtc");
|
||||
|
||||
struct timespec slp = { 0, 1*1000*1000 }; // 1ms
|
||||
loss = 0;
|
||||
for(;;){
|
||||
clock_gettime(CLOCK_REALTIME, &now);
|
||||
@ -133,6 +136,9 @@ rtcthread(void *p)
|
||||
else
|
||||
rtcstop(msg.c);
|
||||
}
|
||||
|
||||
// make this thread sleep a bit
|
||||
nanosleep(&slp, nil);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
#define _GNU_SOURCE // TODO, make portable
|
||||
#include "threading.h"
|
||||
#include <assert.h>
|
||||
|
||||
@ -208,6 +209,13 @@ threadwait(int id)
|
||||
pthread_join(gethandle(id), nil);
|
||||
}
|
||||
|
||||
void
|
||||
threadname(char *name)
|
||||
{
|
||||
// TODO: make portable
|
||||
pthread_setname_np(pthread_self(), name);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
@ -58,3 +58,4 @@ int threadid(void);
|
||||
void **threaddata(void);
|
||||
void threadkill(int id);
|
||||
void threadwait(int id);
|
||||
void threadname(char *name);
|
||||
|
||||
@ -18,5 +18,8 @@ fe6_emu: $(SRC) 6/emu6.c
|
||||
$(CC) -I6 $(CFLAGS) $(LDFLAGS) -o $@ $^
|
||||
|
||||
|
||||
fe6_fastemu: $(SRC) fastemu.c ../femu/fpdp6.c
|
||||
$(CC) -I6 $(CFLAGS) $(LDFLAGS) -o $@ $^
|
||||
|
||||
feka: $(SRC) ka/real.c
|
||||
$(XX)gcc -Ika $(CFLAGS) $(LDFLAGS) -o $@ $^
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user