Compare commits
No commits in common. "42246deb3561c4aa7ebb37c5a5077dadfd55d944" and "415f9b72f719df25020e71ae346cb4e8ac68d45e" have entirely different histories.
42246deb35
...
415f9b72f7
117
Session.vim
117
Session.vim
@ -13,13 +13,12 @@ if &shortmess =~ 'A'
|
|||||||
else
|
else
|
||||||
set shortmess=aoO
|
set shortmess=aoO
|
||||||
endif
|
endif
|
||||||
badd +437 vm/main.c
|
badd +397 vm/main.c
|
||||||
badd +48 Makefile
|
badd +1 Makefile
|
||||||
badd +10 vm/vm.h
|
badd +30 vm/vm.h
|
||||||
badd +181 vm/vm.c
|
badd +225 vm/vm.c
|
||||||
badd +14 vm/asm.h
|
badd +53 vm/asm.h
|
||||||
badd +263 vm/asm.c
|
badd +178 vm/asm.c
|
||||||
badd +747 ~/.config/nvim/init.lua
|
|
||||||
argglobal
|
argglobal
|
||||||
%argdel
|
%argdel
|
||||||
$argadd vm/main.c
|
$argadd vm/main.c
|
||||||
@ -45,8 +44,8 @@ set winminheight=0
|
|||||||
set winheight=1
|
set winheight=1
|
||||||
set winminwidth=0
|
set winminwidth=0
|
||||||
set winwidth=1
|
set winwidth=1
|
||||||
exe 'vert 1resize ' . ((&columns * 123 + 128) / 256)
|
exe 'vert 1resize ' . ((&columns * 127 + 128) / 256)
|
||||||
exe 'vert 2resize ' . ((&columns * 132 + 128) / 256)
|
exe 'vert 2resize ' . ((&columns * 128 + 128) / 256)
|
||||||
argglobal
|
argglobal
|
||||||
setlocal fdm=manual
|
setlocal fdm=manual
|
||||||
setlocal fde=0
|
setlocal fde=0
|
||||||
@ -58,11 +57,11 @@ setlocal fdn=20
|
|||||||
setlocal fen
|
setlocal fen
|
||||||
silent! normal! zE
|
silent! normal! zE
|
||||||
let &fdl = &fdl
|
let &fdl = &fdl
|
||||||
let s:l = 437 - ((37 * winheight(0) + 32) / 65)
|
let s:l = 397 - ((1 * winheight(0) + 32) / 65)
|
||||||
if s:l < 1 | let s:l = 1 | endif
|
if s:l < 1 | let s:l = 1 | endif
|
||||||
keepjumps exe s:l
|
keepjumps exe s:l
|
||||||
normal! zt
|
normal! zt
|
||||||
keepjumps 437
|
keepjumps 397
|
||||||
normal! 012|
|
normal! 012|
|
||||||
wincmd w
|
wincmd w
|
||||||
argglobal
|
argglobal
|
||||||
@ -81,15 +80,15 @@ setlocal fdn=20
|
|||||||
setlocal fen
|
setlocal fen
|
||||||
silent! normal! zE
|
silent! normal! zE
|
||||||
let &fdl = &fdl
|
let &fdl = &fdl
|
||||||
let s:l = 15 - ((14 * winheight(0) + 32) / 65)
|
let s:l = 1 - ((0 * winheight(0) + 32) / 65)
|
||||||
if s:l < 1 | let s:l = 1 | endif
|
if s:l < 1 | let s:l = 1 | endif
|
||||||
keepjumps exe s:l
|
keepjumps exe s:l
|
||||||
normal! zt
|
normal! zt
|
||||||
keepjumps 15
|
keepjumps 1
|
||||||
normal! 0
|
normal! 0
|
||||||
wincmd w
|
wincmd w
|
||||||
exe 'vert 1resize ' . ((&columns * 123 + 128) / 256)
|
exe 'vert 1resize ' . ((&columns * 127 + 128) / 256)
|
||||||
exe 'vert 2resize ' . ((&columns * 132 + 128) / 256)
|
exe 'vert 2resize ' . ((&columns * 128 + 128) / 256)
|
||||||
tabnext
|
tabnext
|
||||||
edit vm/vm.h
|
edit vm/vm.h
|
||||||
let s:save_splitbelow = &splitbelow
|
let s:save_splitbelow = &splitbelow
|
||||||
@ -108,8 +107,8 @@ set winminheight=0
|
|||||||
set winheight=1
|
set winheight=1
|
||||||
set winminwidth=0
|
set winminwidth=0
|
||||||
set winwidth=1
|
set winwidth=1
|
||||||
exe 'vert 1resize ' . ((&columns * 93 + 128) / 256)
|
exe 'vert 1resize ' . ((&columns * 127 + 128) / 256)
|
||||||
exe 'vert 2resize ' . ((&columns * 162 + 128) / 256)
|
exe 'vert 2resize ' . ((&columns * 128 + 128) / 256)
|
||||||
argglobal
|
argglobal
|
||||||
balt Makefile
|
balt Makefile
|
||||||
setlocal fdm=manual
|
setlocal fdm=manual
|
||||||
@ -122,12 +121,12 @@ setlocal fdn=20
|
|||||||
setlocal fen
|
setlocal fen
|
||||||
silent! normal! zE
|
silent! normal! zE
|
||||||
let &fdl = &fdl
|
let &fdl = &fdl
|
||||||
let s:l = 10 - ((9 * winheight(0) + 32) / 65)
|
let s:l = 26 - ((25 * winheight(0) + 32) / 65)
|
||||||
if s:l < 1 | let s:l = 1 | endif
|
if s:l < 1 | let s:l = 1 | endif
|
||||||
keepjumps exe s:l
|
keepjumps exe s:l
|
||||||
normal! zt
|
normal! zt
|
||||||
keepjumps 10
|
keepjumps 26
|
||||||
normal! 011|
|
normal! 0
|
||||||
wincmd w
|
wincmd w
|
||||||
argglobal
|
argglobal
|
||||||
if bufexists(fnamemodify("vm/vm.c", ":p")) | buffer vm/vm.c | else | edit vm/vm.c | endif
|
if bufexists(fnamemodify("vm/vm.c", ":p")) | buffer vm/vm.c | else | edit vm/vm.c | endif
|
||||||
@ -145,15 +144,15 @@ setlocal fdn=20
|
|||||||
setlocal fen
|
setlocal fen
|
||||||
silent! normal! zE
|
silent! normal! zE
|
||||||
let &fdl = &fdl
|
let &fdl = &fdl
|
||||||
let s:l = 83 - ((7 * winheight(0) + 32) / 65)
|
let s:l = 70 - ((18 * winheight(0) + 32) / 65)
|
||||||
if s:l < 1 | let s:l = 1 | endif
|
if s:l < 1 | let s:l = 1 | endif
|
||||||
keepjumps exe s:l
|
keepjumps exe s:l
|
||||||
normal! zt
|
normal! zt
|
||||||
keepjumps 83
|
keepjumps 70
|
||||||
normal! 021|
|
normal! 026|
|
||||||
wincmd w
|
wincmd w
|
||||||
exe 'vert 1resize ' . ((&columns * 93 + 128) / 256)
|
exe 'vert 1resize ' . ((&columns * 127 + 128) / 256)
|
||||||
exe 'vert 2resize ' . ((&columns * 162 + 128) / 256)
|
exe 'vert 2resize ' . ((&columns * 128 + 128) / 256)
|
||||||
tabnext
|
tabnext
|
||||||
edit vm/asm.h
|
edit vm/asm.h
|
||||||
let s:save_splitbelow = &splitbelow
|
let s:save_splitbelow = &splitbelow
|
||||||
@ -161,7 +160,10 @@ let s:save_splitright = &splitright
|
|||||||
set splitbelow splitright
|
set splitbelow splitright
|
||||||
wincmd _ | wincmd |
|
wincmd _ | wincmd |
|
||||||
vsplit
|
vsplit
|
||||||
1wincmd h
|
wincmd _ | wincmd |
|
||||||
|
vsplit
|
||||||
|
2wincmd h
|
||||||
|
wincmd w
|
||||||
wincmd w
|
wincmd w
|
||||||
let &splitbelow = s:save_splitbelow
|
let &splitbelow = s:save_splitbelow
|
||||||
let &splitright = s:save_splitright
|
let &splitright = s:save_splitright
|
||||||
@ -172,8 +174,9 @@ set winminheight=0
|
|||||||
set winheight=1
|
set winheight=1
|
||||||
set winminwidth=0
|
set winminwidth=0
|
||||||
set winwidth=1
|
set winwidth=1
|
||||||
exe 'vert 1resize ' . ((&columns * 87 + 128) / 256)
|
exe 'vert 1resize ' . ((&columns * 73 + 128) / 256)
|
||||||
exe 'vert 2resize ' . ((&columns * 168 + 128) / 256)
|
exe 'vert 2resize ' . ((&columns * 86 + 128) / 256)
|
||||||
|
exe 'vert 3resize ' . ((&columns * 95 + 128) / 256)
|
||||||
argglobal
|
argglobal
|
||||||
balt vm/vm.c
|
balt vm/vm.c
|
||||||
setlocal fdm=manual
|
setlocal fdm=manual
|
||||||
@ -186,12 +189,12 @@ setlocal fdn=20
|
|||||||
setlocal fen
|
setlocal fen
|
||||||
silent! normal! zE
|
silent! normal! zE
|
||||||
let &fdl = &fdl
|
let &fdl = &fdl
|
||||||
let s:l = 53 - ((34 * winheight(0) + 32) / 65)
|
let s:l = 53 - ((52 * winheight(0) + 32) / 65)
|
||||||
if s:l < 1 | let s:l = 1 | endif
|
if s:l < 1 | let s:l = 1 | endif
|
||||||
keepjumps exe s:l
|
keepjumps exe s:l
|
||||||
normal! zt
|
normal! zt
|
||||||
keepjumps 53
|
keepjumps 53
|
||||||
normal! 0
|
normal! 026|
|
||||||
wincmd w
|
wincmd w
|
||||||
argglobal
|
argglobal
|
||||||
if bufexists(fnamemodify("vm/asm.c", ":p")) | buffer vm/asm.c | else | edit vm/asm.c | endif
|
if bufexists(fnamemodify("vm/asm.c", ":p")) | buffer vm/asm.c | else | edit vm/asm.c | endif
|
||||||
@ -209,15 +212,40 @@ setlocal fdn=20
|
|||||||
setlocal fen
|
setlocal fen
|
||||||
silent! normal! zE
|
silent! normal! zE
|
||||||
let &fdl = &fdl
|
let &fdl = &fdl
|
||||||
let s:l = 265 - ((36 * winheight(0) + 32) / 65)
|
let s:l = 178 - ((18 * winheight(0) + 32) / 65)
|
||||||
if s:l < 1 | let s:l = 1 | endif
|
if s:l < 1 | let s:l = 1 | endif
|
||||||
keepjumps exe s:l
|
keepjumps exe s:l
|
||||||
normal! zt
|
normal! zt
|
||||||
keepjumps 265
|
keepjumps 178
|
||||||
normal! 032|
|
normal! 013|
|
||||||
wincmd w
|
wincmd w
|
||||||
exe 'vert 1resize ' . ((&columns * 87 + 128) / 256)
|
argglobal
|
||||||
exe 'vert 2resize ' . ((&columns * 168 + 128) / 256)
|
if bufexists(fnamemodify("vm/vm.c", ":p")) | buffer vm/vm.c | else | edit vm/vm.c | endif
|
||||||
|
if &buftype ==# 'terminal'
|
||||||
|
silent file vm/vm.c
|
||||||
|
endif
|
||||||
|
balt vm/asm.c
|
||||||
|
setlocal fdm=manual
|
||||||
|
setlocal fde=0
|
||||||
|
setlocal fmr={{{,}}}
|
||||||
|
setlocal fdi=#
|
||||||
|
setlocal fdl=0
|
||||||
|
setlocal fml=1
|
||||||
|
setlocal fdn=20
|
||||||
|
setlocal fen
|
||||||
|
silent! normal! zE
|
||||||
|
let &fdl = &fdl
|
||||||
|
let s:l = 104 - ((1 * winheight(0) + 32) / 65)
|
||||||
|
if s:l < 1 | let s:l = 1 | endif
|
||||||
|
keepjumps exe s:l
|
||||||
|
normal! zt
|
||||||
|
keepjumps 104
|
||||||
|
normal! 043|
|
||||||
|
wincmd w
|
||||||
|
2wincmd w
|
||||||
|
exe 'vert 1resize ' . ((&columns * 73 + 128) / 256)
|
||||||
|
exe 'vert 2resize ' . ((&columns * 86 + 128) / 256)
|
||||||
|
exe 'vert 3resize ' . ((&columns * 95 + 128) / 256)
|
||||||
tabnext
|
tabnext
|
||||||
edit vm/asm.c
|
edit vm/asm.c
|
||||||
let s:save_splitbelow = &splitbelow
|
let s:save_splitbelow = &splitbelow
|
||||||
@ -236,10 +264,9 @@ set winminheight=0
|
|||||||
set winheight=1
|
set winheight=1
|
||||||
set winminwidth=0
|
set winminwidth=0
|
||||||
set winwidth=1
|
set winwidth=1
|
||||||
exe 'vert 1resize ' . ((&columns * 127 + 128) / 256)
|
exe 'vert 1resize ' . ((&columns * 119 + 128) / 256)
|
||||||
exe 'vert 2resize ' . ((&columns * 128 + 128) / 256)
|
exe 'vert 2resize ' . ((&columns * 136 + 128) / 256)
|
||||||
argglobal
|
argglobal
|
||||||
balt vm/asm.h
|
|
||||||
setlocal fdm=manual
|
setlocal fdm=manual
|
||||||
setlocal fde=0
|
setlocal fde=0
|
||||||
setlocal fmr={{{,}}}
|
setlocal fmr={{{,}}}
|
||||||
@ -250,11 +277,11 @@ setlocal fdn=20
|
|||||||
setlocal fen
|
setlocal fen
|
||||||
silent! normal! zE
|
silent! normal! zE
|
||||||
let &fdl = &fdl
|
let &fdl = &fdl
|
||||||
let s:l = 265 - ((35 * winheight(0) + 32) / 65)
|
let s:l = 354 - ((61 * winheight(0) + 32) / 65)
|
||||||
if s:l < 1 | let s:l = 1 | endif
|
if s:l < 1 | let s:l = 1 | endif
|
||||||
keepjumps exe s:l
|
keepjumps exe s:l
|
||||||
normal! zt
|
normal! zt
|
||||||
keepjumps 265
|
keepjumps 354
|
||||||
normal! 031|
|
normal! 031|
|
||||||
wincmd w
|
wincmd w
|
||||||
argglobal
|
argglobal
|
||||||
@ -273,15 +300,15 @@ setlocal fdn=20
|
|||||||
setlocal fen
|
setlocal fen
|
||||||
silent! normal! zE
|
silent! normal! zE
|
||||||
let &fdl = &fdl
|
let &fdl = &fdl
|
||||||
let s:l = 123 - ((48 * winheight(0) + 32) / 65)
|
let s:l = 423 - ((31 * winheight(0) + 32) / 65)
|
||||||
if s:l < 1 | let s:l = 1 | endif
|
if s:l < 1 | let s:l = 1 | endif
|
||||||
keepjumps exe s:l
|
keepjumps exe s:l
|
||||||
normal! zt
|
normal! zt
|
||||||
keepjumps 123
|
keepjumps 423
|
||||||
normal! 0
|
normal! 019|
|
||||||
wincmd w
|
wincmd w
|
||||||
exe 'vert 1resize ' . ((&columns * 127 + 128) / 256)
|
exe 'vert 1resize ' . ((&columns * 119 + 128) / 256)
|
||||||
exe 'vert 2resize ' . ((&columns * 128 + 128) / 256)
|
exe 'vert 2resize ' . ((&columns * 136 + 128) / 256)
|
||||||
tabnext 3
|
tabnext 3
|
||||||
set stal=1
|
set stal=1
|
||||||
if exists('s:wipebuf') && len(win_findbuf(s:wipebuf)) == 0 && getbufvar(s:wipebuf, '&buftype') isnot# 'terminal'
|
if exists('s:wipebuf') && len(win_findbuf(s:wipebuf)) == 0 && getbufvar(s:wipebuf, '&buftype') isnot# 'terminal'
|
||||||
|
111
vm/asm.c
111
vm/asm.c
@ -43,22 +43,6 @@ Line s_jmp_l(int op1_label)
|
|||||||
.op1 = (Ex) { .label = op1_label },
|
.op1 = (Ex) { .label = op1_label },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
Line s_jnz_l(Reg op1_reg, int op2_label)
|
|
||||||
{
|
|
||||||
return (Line) {
|
|
||||||
.ty = LineTy_Jnz_Label,
|
|
||||||
.op1 = (Ex) { .reg = (uint16_t)op1_reg },
|
|
||||||
.op2 = (Ex) { .label = op2_label },
|
|
||||||
};
|
|
||||||
}
|
|
||||||
Line s_cmp_i(Reg op1_reg, uint16_t op2_imm)
|
|
||||||
{
|
|
||||||
return (Line) {
|
|
||||||
.ty = LineTy_Cmp_Imm,
|
|
||||||
.op1 = (Ex) { .reg = (uint16_t)op1_reg },
|
|
||||||
.op2 = (Ex) { .imm = op2_imm },
|
|
||||||
};
|
|
||||||
}
|
|
||||||
Line s_mov8_mr_r(Reg dst_reg, Reg op2_reg)
|
Line s_mov8_mr_r(Reg dst_reg, Reg op2_reg)
|
||||||
{
|
{
|
||||||
return (Line) {
|
return (Line) {
|
||||||
@ -195,8 +179,6 @@ static inline uint16_t linety_arithm_ins(LineTy ty);
|
|||||||
|
|
||||||
void assemble_to_binary(uint16_t* out, const Line* lines, size_t lines_size)
|
void assemble_to_binary(uint16_t* out, const Line* lines, size_t lines_size)
|
||||||
{
|
{
|
||||||
bool debug = false;
|
|
||||||
|
|
||||||
uint16_t ip = 0;
|
uint16_t ip = 0;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -220,11 +202,8 @@ void assemble_to_binary(uint16_t* out, const Line* lines, size_t lines_size)
|
|||||||
out[ip++] = 0; \
|
out[ip++] = 0; \
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug) {
|
printf("assembling...\n");
|
||||||
printf("assembling...\n");
|
printf("ip op n data...\n");
|
||||||
printf("ip op n data...\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (size_t i = 0; i < lines_size; ++i) {
|
for (size_t i = 0; i < lines_size; ++i) {
|
||||||
bool is_label = false;
|
bool is_label = false;
|
||||||
bool is_data = false;
|
bool is_data = false;
|
||||||
@ -260,37 +239,10 @@ void assemble_to_binary(uint16_t* out, const Line* lines, size_t lines_size)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LineTy_Jmp_Label: {
|
case LineTy_Jmp_Label: {
|
||||||
int op1 = line->op1.label;
|
|
||||||
|
|
||||||
uint32_t ins = Op_Jmp;
|
uint32_t ins = Op_Jmp;
|
||||||
set_is_imm(&ins);
|
set_is_imm(&ins);
|
||||||
out[ip++] = (uint16_t)ins;
|
out[ip++] = (uint16_t)ins;
|
||||||
ADD_LABEL(op1);
|
ADD_LABEL(line->op1.label);
|
||||||
break;
|
|
||||||
}
|
|
||||||
case LineTy_Jnz_Label: {
|
|
||||||
uint16_t op1 = line->op1.reg;
|
|
||||||
int op2 = line->op2.label;
|
|
||||||
|
|
||||||
uint32_t ins = Op_Jnz;
|
|
||||||
set_is_imm(&ins);
|
|
||||||
add_op1_reg(&ins, op1);
|
|
||||||
|
|
||||||
out[ip++] = (uint16_t)ins;
|
|
||||||
ADD_LABEL(op2);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case LineTy_Cmp_Imm: {
|
|
||||||
uint16_t op1 = line->op1.reg;
|
|
||||||
uint16_t op2 = line->op2.imm;
|
|
||||||
|
|
||||||
uint32_t ins = Op_Cmp;
|
|
||||||
set_is_imm(&ins);
|
|
||||||
add_op1_reg(&ins, op1);
|
|
||||||
|
|
||||||
out[ip++] = (uint16_t)ins;
|
|
||||||
out[ip++] = op2;
|
|
||||||
break;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LineTy_Mov8_MemReg_Reg: {
|
case LineTy_Mov8_MemReg_Reg: {
|
||||||
@ -479,28 +431,24 @@ void assemble_to_binary(uint16_t* out, const Line* lines, size_t lines_size)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug) {
|
if (!is_label) {
|
||||||
if (!is_label) {
|
printf("%02x %-5s %d",
|
||||||
printf("%02x %-5s %d",
|
ins_ip * 2,
|
||||||
ins_ip * 2,
|
is_data ? "data" : op_str(out[ins_ip] & 0x3f),
|
||||||
is_data ? "data" : op_str(out[ins_ip] & 0x3f),
|
ip - ins_ip);
|
||||||
ip - ins_ip);
|
for (uint16_t i = 0; i < ip - ins_ip; ++i) {
|
||||||
for (uint16_t i = 0; i < ip - ins_ip; ++i) {
|
printf(" %02x %c%c%c%c %c%c%c%c %02x %c%c%c%c %c%c%c%c ",
|
||||||
printf(" %02x %c%c%c%c %c%c%c%c %02x %c%c%c%c %c%c%c%c ",
|
out[ins_ip + i] & 0xff,
|
||||||
out[ins_ip + i] & 0xff,
|
fmt_binary(out[ins_ip + i] & 0xff),
|
||||||
fmt_binary(out[ins_ip + i] & 0xff),
|
out[ins_ip + i] >> 8,
|
||||||
out[ins_ip + i] >> 8,
|
fmt_binary(out[ins_ip + i] >> 8));
|
||||||
fmt_binary(out[ins_ip + i] >> 8));
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
}
|
}
|
||||||
|
printf("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug) {
|
printf("resolving...\n");
|
||||||
printf("resolving...\n");
|
printf(" l ip v data\n");
|
||||||
printf(" l ip v data\n");
|
|
||||||
}
|
|
||||||
for (size_t i = 0; i < unres_labels_size; ++i) {
|
for (size_t i = 0; i < unres_labels_size; ++i) {
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (size_t j = 0; j < res_labels_size; ++j) {
|
for (size_t j = 0; j < res_labels_size; ++j) {
|
||||||
@ -508,18 +456,15 @@ void assemble_to_binary(uint16_t* out, const Line* lines, size_t lines_size)
|
|||||||
out[unres_labels[i].ptr] = res_labels[j].ip;
|
out[unres_labels[i].ptr] = res_labels[j].ip;
|
||||||
found = true;
|
found = true;
|
||||||
|
|
||||||
if (debug) {
|
printf("%2d %02x %02x %02x %c%c%c%c %c%c%c%c %02x %c%c%c%c "
|
||||||
printf(
|
"%c%c%c%c\n",
|
||||||
"%2d %02x %02x %02x %c%c%c%c %c%c%c%c %02x %c%c%c%c "
|
res_labels[j].label,
|
||||||
"%c%c%c%c\n",
|
unres_labels[i].ptr * 2,
|
||||||
res_labels[j].label,
|
res_labels[j].ip,
|
||||||
unres_labels[i].ptr * 2,
|
out[unres_labels[i].ptr] & 0xff,
|
||||||
res_labels[j].ip,
|
fmt_binary(out[unres_labels[i].ptr] & 0xff),
|
||||||
out[unres_labels[i].ptr] & 0xff,
|
out[unres_labels[i].ptr] >> 8,
|
||||||
fmt_binary(out[unres_labels[i].ptr] & 0xff),
|
fmt_binary(out[unres_labels[i].ptr] >> 8));
|
||||||
out[unres_labels[i].ptr] >> 8,
|
|
||||||
fmt_binary(out[unres_labels[i].ptr] >> 8));
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -529,9 +474,7 @@ void assemble_to_binary(uint16_t* out, const Line* lines, size_t lines_size)
|
|||||||
unres_labels[i].label);
|
unres_labels[i].label);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (debug) {
|
printf("done!\n");
|
||||||
printf("done!\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void add_dst_reg(uint32_t* ins, uint16_t reg)
|
static inline void add_dst_reg(uint32_t* ins, uint16_t reg)
|
||||||
|
4
vm/asm.h
4
vm/asm.h
@ -11,8 +11,6 @@ typedef enum {
|
|||||||
LineTy_Nop,
|
LineTy_Nop,
|
||||||
LineTy_Hlt,
|
LineTy_Hlt,
|
||||||
LineTy_Jmp_Label,
|
LineTy_Jmp_Label,
|
||||||
LineTy_Jnz_Label,
|
|
||||||
LineTy_Cmp_Imm,
|
|
||||||
LineTy_Mov8_MemReg_Reg,
|
LineTy_Mov8_MemReg_Reg,
|
||||||
LineTy_Mov8_MemImm_Imm,
|
LineTy_Mov8_MemImm_Imm,
|
||||||
LineTy_Mov8_MemImm_Reg,
|
LineTy_Mov8_MemImm_Reg,
|
||||||
@ -57,8 +55,6 @@ Line s_data_l(int label);
|
|||||||
Line s_nop(void);
|
Line s_nop(void);
|
||||||
Line s_hlt(void);
|
Line s_hlt(void);
|
||||||
Line s_jmp_l(int op1_label);
|
Line s_jmp_l(int op1_label);
|
||||||
Line s_jnz_l(Reg op1_reg, int op2_label);
|
|
||||||
Line s_cmp_i(Reg op1_reg, uint16_t op2_imm);
|
|
||||||
Line s_mov8_mr_r(Reg dst_reg, Reg op2_reg);
|
Line s_mov8_mr_r(Reg dst_reg, Reg op2_reg);
|
||||||
Line s_mov8_mi_i(uint16_t dst_imm, uint16_t op2_imm);
|
Line s_mov8_mi_i(uint16_t dst_imm, uint16_t op2_imm);
|
||||||
Line s_mov8_mi_r(uint16_t dst_imm, Reg op2_reg);
|
Line s_mov8_mi_r(uint16_t dst_imm, Reg op2_reg);
|
||||||
|
326
vm/main.c
326
vm/main.c
@ -183,14 +183,13 @@ void sdldevice_destroy(SdlDevice* device)
|
|||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern const uint64_t charset[];
|
extern const bool charset[][ch_height][ch_width];
|
||||||
|
|
||||||
void sdldevice_set_char(IODevice* io_device, uint16_t offset, uint8_t value)
|
void sdldevice_set_char(IODevice* io_device, uint16_t offset, uint8_t value)
|
||||||
{
|
{
|
||||||
if (!((value >= 'A' && value <= 'Z') || value == ' ')) {
|
// printf("value = %d '%c', offset = %d\n", value, value, offset);
|
||||||
printf("sdldevice: invalid char value = %d\n", value);
|
if (!((value >= 'A' && value <= 'Z') || value == ' '))
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
SdlDevice* device = io_device->self;
|
SdlDevice* device = io_device->self;
|
||||||
pthread_mutex_lock(&device->mutex);
|
pthread_mutex_lock(&device->mutex);
|
||||||
@ -207,9 +206,7 @@ void sdldevice_set_char(IODevice* io_device, uint16_t offset, uint8_t value)
|
|||||||
|
|
||||||
for (int ch_y = 0; ch_y < ch_height; ++ch_y) {
|
for (int ch_y = 0; ch_y < ch_height; ++ch_y) {
|
||||||
for (int ch_x = 0; ch_x < ch_width; ++ch_x) {
|
for (int ch_x = 0; ch_x < ch_width; ++ch_x) {
|
||||||
bool ch
|
bool ch = charset[value][ch_y][ch_x];
|
||||||
= charset[value] >> (ch_y * ch_width + (ch_width - ch_x - 1))
|
|
||||||
& 1;
|
|
||||||
|
|
||||||
for (int px_y = 0; px_y < px_height; ++px_y) {
|
for (int px_y = 0; px_y < px_height; ++px_y) {
|
||||||
for (int px_x = 0; px_x < px_width; ++px_x) {
|
for (int px_x = 0; px_x < px_width; ++px_x) {
|
||||||
@ -388,10 +385,6 @@ int main(void)
|
|||||||
int main_loop = label_ids++;
|
int main_loop = label_ids++;
|
||||||
int interrupt_table = label_ids++;
|
int interrupt_table = label_ids++;
|
||||||
int keyboard_interrupt = label_ids++;
|
int keyboard_interrupt = label_ids++;
|
||||||
int keyboard_interrupt_0 = label_ids++;
|
|
||||||
int keyboard_interrupt_1 = label_ids++;
|
|
||||||
int keyboard_interrupt_2 = label_ids++;
|
|
||||||
int keyboard_interrupt_3 = label_ids++;
|
|
||||||
int screen_x = label_ids++;
|
int screen_x = label_ids++;
|
||||||
int screen_y = label_ids++;
|
int screen_y = label_ids++;
|
||||||
|
|
||||||
@ -433,15 +426,6 @@ int main(void)
|
|||||||
s_in_i(R0, 0),
|
s_in_i(R0, 0),
|
||||||
s_add_i(R0, R0, 'A' - 4),
|
s_add_i(R0, R0, 'A' - 4),
|
||||||
|
|
||||||
s_cmp_i(R0, 105),
|
|
||||||
s_mov16_r_r(R1, Rfl),
|
|
||||||
s_and_i(R1, R1, 1 << Fl_Eq),
|
|
||||||
s_jnz_l(R1, keyboard_interrupt_0),
|
|
||||||
s_jmp_l(keyboard_interrupt_1),
|
|
||||||
L(keyboard_interrupt_0),
|
|
||||||
s_mov16_r_i(R0, ' '),
|
|
||||||
s_jmp_l(keyboard_interrupt_1),
|
|
||||||
L(keyboard_interrupt_1),
|
|
||||||
s_mov16_r_ml(R1, screen_x),
|
s_mov16_r_ml(R1, screen_x),
|
||||||
s_add_i(R1, R1, 0x0c00),
|
s_add_i(R1, R1, 0x0c00),
|
||||||
s_mov8_mr_r(R1, R0),
|
s_mov8_mr_r(R1, R0),
|
||||||
@ -493,32 +477,278 @@ const char* __asan_default_options(void)
|
|||||||
return "detect_leaks=0";
|
return "detect_leaks=0";
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint64_t charset[] = {
|
#define _ false,
|
||||||
[' '] = 0x0000000000000000,
|
#define t true,
|
||||||
['A'] = 0x66667E66667E1800,
|
|
||||||
['B'] = 0x7C7E667C667E7800,
|
const bool charset[][ch_height][ch_width] = {
|
||||||
['C'] = 0x3C7E6060607E3C00,
|
[' '] = {
|
||||||
['D'] = 0x7C7E6666667E7C00,
|
{ _ _ _ _ _ _ _ _ },
|
||||||
['E'] = 0x7E7E607E607E7E00,
|
{ _ _ _ _ _ _ _ _ },
|
||||||
['F'] = 0x60607878607E7E00,
|
{ _ _ _ _ _ _ _ _ },
|
||||||
['G'] = 0x7E7E666E607E7E00,
|
{ _ _ _ _ _ _ _ _ },
|
||||||
['H'] = 0x6666667E7E666600,
|
{ _ _ _ _ _ _ _ _ },
|
||||||
['I'] = 0x7E7E1818187E7E00,
|
{ _ _ _ _ _ _ _ _ },
|
||||||
['J'] = 0x3C7E6606067E7E00,
|
{ _ _ _ _ _ _ _ _ },
|
||||||
['K'] = 0x666E7C7C6E666600,
|
{ _ _ _ _ _ _ _ _ },
|
||||||
['L'] = 0x7E7E606060606000,
|
},
|
||||||
['M'] = 0xC3C3C3C3DBFFE700,
|
['A'] = {
|
||||||
['N'] = 0x6666666E7E766600,
|
{ _ _ _ _ _ _ _ _ },
|
||||||
['O'] = 0x3C66666666663C00,
|
{ _ _ _ t t _ _ _ },
|
||||||
['P'] = 0x60607C7E667C7C00,
|
{ _ t t t t t t _ },
|
||||||
['Q'] = 0x3F7E6E66667E3C00,
|
{ _ t t _ _ t t _ },
|
||||||
['R'] = 0x666C7C7E667E7C00,
|
{ _ t t _ _ t t _ },
|
||||||
['S'] = 0x3C66063C60663C00,
|
{ _ t t t t t t _ },
|
||||||
['T'] = 0x18181818187E7E00,
|
{ _ t t _ _ t t _ },
|
||||||
['U'] = 0x3C7E666666666600,
|
{ _ t t _ _ t t _ },
|
||||||
['V'] = 0x183C7E6666666600,
|
},
|
||||||
['W'] = 0xE7FFDBDBC3C3C300,
|
['B'] = {
|
||||||
['X'] = 0x6666663C3C666600,
|
{ _ _ _ _ _ _ _ _ },
|
||||||
['Y'] = 0x181818183C666600,
|
{ _ t t t t _ _ _ },
|
||||||
['Z'] = 0x7E7E30180C7E7E00,
|
{ _ t t t t t t _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t t t t _ _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
{ _ t t t t t _ _ },
|
||||||
|
},
|
||||||
|
['C'] = {
|
||||||
|
{ _ _ _ _ _ _ _ _ },
|
||||||
|
{ _ _ t t t t _ _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
{ _ t t _ _ _ _ _ },
|
||||||
|
{ _ t t _ _ _ _ _ },
|
||||||
|
{ _ t t _ _ _ _ _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
{ _ _ t t t t _ _ },
|
||||||
|
},
|
||||||
|
['D'] = {
|
||||||
|
{ _ _ _ _ _ _ _ _ },
|
||||||
|
{ _ t t t t t _ _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
{ _ t t t t t _ _ },
|
||||||
|
},
|
||||||
|
['E'] = {
|
||||||
|
{ _ _ _ _ _ _ _ _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
{ _ t t _ _ _ _ _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
{ _ t t _ _ _ _ _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
},
|
||||||
|
['F'] = {
|
||||||
|
{ _ _ _ _ _ _ _ _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
{ _ t t _ _ _ _ _ },
|
||||||
|
{ _ t t t t _ _ _ },
|
||||||
|
{ _ t t t t _ _ _ },
|
||||||
|
{ _ t t _ _ _ _ _ },
|
||||||
|
{ _ t t _ _ _ _ _ },
|
||||||
|
},
|
||||||
|
['G'] = {
|
||||||
|
{ _ _ _ _ _ _ _ _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
{ _ t t _ _ _ _ _ },
|
||||||
|
{ _ t t _ t t t _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
},
|
||||||
|
['H'] = {
|
||||||
|
{ _ _ _ _ _ _ _ _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
},
|
||||||
|
['I'] = {
|
||||||
|
{ _ _ _ _ _ _ _ _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
{ _ _ _ t t _ _ _ },
|
||||||
|
{ _ _ _ t t _ _ _ },
|
||||||
|
{ _ _ _ t t _ _ _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
},
|
||||||
|
['J'] = {
|
||||||
|
{ _ _ _ _ _ _ _ _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
{ _ _ _ _ _ t t _ },
|
||||||
|
{ _ _ _ _ _ t t _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
{ _ _ t t t t _ _ },
|
||||||
|
},
|
||||||
|
['K'] = {
|
||||||
|
{ _ _ _ _ _ _ _ _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t _ t t t _ },
|
||||||
|
{ _ t t t t t _ _ },
|
||||||
|
{ _ t t t t t _ _ },
|
||||||
|
{ _ t t _ t t t _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
},
|
||||||
|
['L'] = {
|
||||||
|
{ _ _ _ _ _ _ _ _ },
|
||||||
|
{ _ t t _ _ _ _ _ },
|
||||||
|
{ _ t t _ _ _ _ _ },
|
||||||
|
{ _ t t _ _ _ _ _ },
|
||||||
|
{ _ t t _ _ _ _ _ },
|
||||||
|
{ _ t t _ _ _ _ _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
},
|
||||||
|
['M'] = {
|
||||||
|
{ _ _ _ _ _ _ _ _ },
|
||||||
|
{ t t t _ _ t t t },
|
||||||
|
{ t t t t t t t t },
|
||||||
|
{ t t _ t t _ t t },
|
||||||
|
{ t t _ _ _ _ t t },
|
||||||
|
{ t t _ _ _ _ t t },
|
||||||
|
{ t t _ _ _ _ t t },
|
||||||
|
{ t t _ _ _ _ t t },
|
||||||
|
},
|
||||||
|
['N'] = {
|
||||||
|
{ _ _ _ _ _ _ _ _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t t _ t t _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
{ _ t t _ t t t _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
},
|
||||||
|
['O'] = {
|
||||||
|
{ _ _ _ _ _ _ _ _ },
|
||||||
|
{ _ _ t t t t _ _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ _ t t t t _ _ },
|
||||||
|
},
|
||||||
|
['P'] = {
|
||||||
|
{ _ _ _ _ _ _ _ _ },
|
||||||
|
{ _ t t t t t _ _ },
|
||||||
|
{ _ t t t t t _ _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
{ _ t t t t t _ _ },
|
||||||
|
{ _ t t _ _ _ _ _ },
|
||||||
|
{ _ t t _ _ _ _ _ },
|
||||||
|
},
|
||||||
|
['Q'] = {
|
||||||
|
{ _ _ _ _ _ _ _ _ },
|
||||||
|
{ _ _ t t t t _ _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t _ t t t _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
{ _ _ t t t t t t },
|
||||||
|
},
|
||||||
|
['R'] = {
|
||||||
|
{ _ _ _ _ _ _ _ _ },
|
||||||
|
{ _ t t t t t _ _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
{ _ t t t t t _ _ },
|
||||||
|
{ _ t t _ t t _ _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
},
|
||||||
|
['S'] = {
|
||||||
|
{ _ _ _ _ _ _ _ _ },
|
||||||
|
{ _ _ t t t t _ _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t _ _ _ _ _ },
|
||||||
|
{ _ _ t t t t _ _ },
|
||||||
|
{ _ _ _ _ _ t t _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ _ t t t t _ _ },
|
||||||
|
},
|
||||||
|
['T'] = {
|
||||||
|
{ _ _ _ _ _ _ _ _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
{ _ _ _ t t _ _ _ },
|
||||||
|
{ _ _ _ t t _ _ _ },
|
||||||
|
{ _ _ _ t t _ _ _ },
|
||||||
|
{ _ _ _ t t _ _ _ },
|
||||||
|
{ _ _ _ t t _ _ _ },
|
||||||
|
},
|
||||||
|
['U'] = {
|
||||||
|
{ _ _ _ _ _ _ _ _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
{ _ _ t t t t _ _ },
|
||||||
|
},
|
||||||
|
['V'] = {
|
||||||
|
{ _ _ _ _ _ _ _ _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
{ _ _ t t t t _ _ },
|
||||||
|
{ _ _ _ t t _ _ _ },
|
||||||
|
},
|
||||||
|
['W'] = {
|
||||||
|
{ _ _ _ _ _ _ _ _ },
|
||||||
|
{ t t _ _ _ _ t t },
|
||||||
|
{ t t _ _ _ _ t t },
|
||||||
|
{ t t _ _ _ _ t t },
|
||||||
|
{ t t _ t t _ t t },
|
||||||
|
{ t t _ t t _ t t },
|
||||||
|
{ t t t t t t t t },
|
||||||
|
{ t t t _ _ t t t },
|
||||||
|
},
|
||||||
|
['X'] = {
|
||||||
|
{ _ _ _ _ _ _ _ _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ _ t t t t _ _ },
|
||||||
|
{ _ _ t t t t _ _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
},
|
||||||
|
['Y'] = {
|
||||||
|
{ _ _ _ _ _ _ _ _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ t t _ _ t t _ },
|
||||||
|
{ _ _ t t t t _ _ },
|
||||||
|
{ _ _ _ t t _ _ _ },
|
||||||
|
{ _ _ _ t t _ _ _ },
|
||||||
|
{ _ _ _ t t _ _ _ },
|
||||||
|
{ _ _ _ t t _ _ _ },
|
||||||
|
},
|
||||||
|
['Z'] = {
|
||||||
|
{ _ _ _ _ _ _ _ _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
{ _ _ _ _ t t _ _ },
|
||||||
|
{ _ _ _ t t _ _ _ },
|
||||||
|
{ _ _ t t _ _ _ _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
{ _ t t t t t t _ },
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
27
vm/vm.c
27
vm/vm.c
@ -96,7 +96,6 @@ void vm_start(Drive* boot_drive, IODevice* io_device)
|
|||||||
case Op_Jnz: {
|
case Op_Jnz: {
|
||||||
uint16_t op1 = ins_op1(vm, ins);
|
uint16_t op1 = ins_op1(vm, ins);
|
||||||
uint16_t op2 = ins_op2_or_imm(vm, ins);
|
uint16_t op2 = ins_op2_or_imm(vm, ins);
|
||||||
|
|
||||||
if (op1 != 0) {
|
if (op1 != 0) {
|
||||||
*rip = op2;
|
*rip = op2;
|
||||||
}
|
}
|
||||||
@ -104,33 +103,15 @@ void vm_start(Drive* boot_drive, IODevice* io_device)
|
|||||||
}
|
}
|
||||||
case Op_Test: {
|
case Op_Test: {
|
||||||
uint16_t op1 = ins_op1(vm, ins);
|
uint16_t op1 = ins_op1(vm, ins);
|
||||||
|
*rfl &= (uint16_t)~((op1 == 0 ? 1 : 0) << Fl_Zero);
|
||||||
if (op1 == 0) {
|
|
||||||
*rfl |= 1u << Fl_Zero;
|
|
||||||
} else {
|
|
||||||
*rfl &= (uint16_t)~(1u << Fl_Zero);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Op_Cmp: {
|
case Op_Cmp: {
|
||||||
uint16_t op1 = ins_op1(vm, ins);
|
uint16_t op1 = ins_op1(vm, ins);
|
||||||
uint16_t op2 = ins_op2_or_imm(vm, ins);
|
uint16_t op2 = ins_op2_or_imm(vm, ins);
|
||||||
|
*rfl &= (uint16_t)~((op1 == op2 ? 1 : 0) << Fl_Eq
|
||||||
if (op1 == op2) {
|
& (op1 < op2 ? 1 : 0) << Fl_Be
|
||||||
*rfl |= 1u << Fl_Eq;
|
& ((int16_t)op1 < (int16_t)op2 ? 1 : 0) << Fl_Lt);
|
||||||
} else {
|
|
||||||
*rfl &= (uint16_t)~(1u << Fl_Eq);
|
|
||||||
}
|
|
||||||
if (op1 < op2) {
|
|
||||||
*rfl |= 1u << Fl_Be;
|
|
||||||
} else {
|
|
||||||
*rfl &= (uint16_t)~(1u << Fl_Be);
|
|
||||||
}
|
|
||||||
if ((int16_t)op1 < (int16_t)op2) {
|
|
||||||
*rfl |= 1u << Fl_Lt;
|
|
||||||
} else {
|
|
||||||
*rfl &= (uint16_t)~(1u << Fl_Lt);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Op_Mov8: {
|
case Op_Mov8: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user