Use conversion functions for (h)word to and from bytes instead of bit shifting

Wasn't very secure for endianness, and using these helpers abstracts
the details away a bit in case I want to enforce a certain system.
This commit is contained in:
2023-10-22 20:29:02 +01:00
parent aa3d1cb85f
commit 073a23152e
2 changed files with 33 additions and 29 deletions

View File

@@ -83,6 +83,10 @@ static const push_reg_f PUSH_REG_ROUTINES[] = {
[OP_PUSH_REGISTER_WORD] = vm_push_word_register,
};
data_t vm_pop_byte(vm_t *);
data_t vm_pop_hword(vm_t *);
data_t vm_pop_word(vm_t *);
data_t vm_mov_byte(vm_t *, byte);
data_t vm_mov_hword(vm_t *, byte);
data_t vm_mov_word(vm_t *, byte);
@@ -94,9 +98,6 @@ static const mov_f MOV_ROUTINES[] = {
[OP_MOV_WORD] = vm_mov_word,
};
data_t vm_pop_byte(vm_t *);
data_t vm_pop_hword(vm_t *);
data_t vm_pop_word(vm_t *);
void vm_not_byte(vm_t *);
void vm_not_hword(vm_t *);