Add pseudoteletypewriter to emulator

https://justine.storage.googleapis.com/emulator628.mp4
This commit is contained in:
Justine Tunney 2020-08-26 23:08:08 -07:00
parent e86cff8ba0
commit 5aabacb361
94 changed files with 3245 additions and 2179 deletions

View file

@ -22,14 +22,14 @@
#include "tool/build/lib/machine.h"
#include "tool/build/lib/modrm.h"
uint64_t AluBsr(struct Machine *m, uint64_t _, uint64_t x) {
uint64_t AluBsr(struct Machine *m, uint32_t rde, uint64_t _, uint64_t x) {
unsigned i;
if (Rexw(m->xedd)) {
if (Rexw(rde)) {
x &= 0xffffffffffffffff;
m->flags = SetFlag(m->flags, FLAGS_ZF, !x);
if (!x) return 0;
return 63 ^ __builtin_clzll(x);
} else if (!Osz(m->xedd)) {
} else if (!Osz(rde)) {
x &= 0xffffffff;
m->flags = SetFlag(m->flags, FLAGS_ZF, !x);
if (!x) return 0;
@ -43,14 +43,14 @@ uint64_t AluBsr(struct Machine *m, uint64_t _, uint64_t x) {
}
}
uint64_t AluBsf(struct Machine *m, uint64_t _, uint64_t x) {
uint64_t AluBsf(struct Machine *m, uint32_t rde, uint64_t _, uint64_t x) {
unsigned i;
if (Rexw(m->xedd)) {
if (Rexw(rde)) {
x &= 0xffffffffffffffff;
m->flags = SetFlag(m->flags, FLAGS_ZF, !x);
if (!x) return 0;
return __builtin_ctzll(x);
} else if (!Osz(m->xedd)) {
} else if (!Osz(rde)) {
x &= 0xffffffff;
m->flags = SetFlag(m->flags, FLAGS_ZF, !x);
if (!x) return 0;
@ -64,7 +64,7 @@ uint64_t AluBsf(struct Machine *m, uint64_t _, uint64_t x) {
}
}
uint64_t AluPopcnt(struct Machine *m, uint64_t _, uint64_t x) {
uint64_t AluPopcnt(struct Machine *m, uint32_t rde, uint64_t _, uint64_t x) {
m->flags = SetFlag(m->flags, FLAGS_ZF, !x);
m->flags = SetFlag(m->flags, FLAGS_CF, false);
m->flags = SetFlag(m->flags, FLAGS_SF, false);