Fix a few formatting things
This commit is contained in:
parent
23478340d2
commit
3608796e88
14
src/cpu.c
14
src/cpu.c
|
@ -521,11 +521,11 @@ static uint32_t vm_read_across(vm_t *vm, uint32_t address, int size) {
|
||||||
void vm_write_across(vm_t *vm, uint32_t address, int size, uint32_t value) {
|
void vm_write_across(vm_t *vm, uint32_t address, int size, uint32_t value) {
|
||||||
// write the first page
|
// write the first page
|
||||||
|
|
||||||
int bytes = 0x1000 - (address&0xFFF);
|
int bytes = 0x1000 - (address & 0x00000FFF);
|
||||||
uint8_t *ptr = vm_findmemory(vm, address, bytes, true);
|
uint8_t *ptr = vm_findmemory(vm, address, bytes, true);
|
||||||
|
|
||||||
while (bytes) {
|
while (bytes) {
|
||||||
*ptr = value&0xFF;
|
*ptr = value & 0xFF;
|
||||||
value >>= 8;
|
value >>= 8;
|
||||||
|
|
||||||
ptr++;
|
ptr++;
|
||||||
|
@ -534,13 +534,13 @@ void vm_write_across(vm_t *vm, uint32_t address, int size, uint32_t value) {
|
||||||
|
|
||||||
// write the second page
|
// write the second page
|
||||||
|
|
||||||
bytes = (address+size)&0xFFF;
|
bytes = (address + size) & 0x00000FFF;
|
||||||
address = (address+size)&0xFFFFF000;
|
address = (address + size) & 0xFFFFF000;
|
||||||
|
|
||||||
ptr = vm_findmemory(vm, address, bytes, true);
|
ptr = vm_findmemory(vm, address, bytes, true);
|
||||||
|
|
||||||
while (bytes) {
|
while (bytes) {
|
||||||
*ptr = value&0xFF;
|
*ptr = value & 0xFF;
|
||||||
value >>= 8;
|
value >>= 8;
|
||||||
|
|
||||||
ptr++;
|
ptr++;
|
||||||
|
@ -549,7 +549,7 @@ void vm_write_across(vm_t *vm, uint32_t address, int size, uint32_t value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#define VM_READ_BODY(_ptr_get, _size) \
|
#define VM_READ_BODY(_ptr_get, _size) \
|
||||||
if ((address&0xFFFFF000) == ((address+_size-1)&0xFFFFF000)) { \
|
if ((address & 0xFFFFF000) == ((address + _size - 1) & 0xFFFFF000)) { \
|
||||||
return _ptr_get(vm_findmemory(vm, address, _size, false)); \
|
return _ptr_get(vm_findmemory(vm, address, _size, false)); \
|
||||||
} else { \
|
} else { \
|
||||||
return vm_read_across(vm, address, _size); \
|
return vm_read_across(vm, address, _size); \
|
||||||
|
@ -566,7 +566,7 @@ static uint32_t vm_read32(vm_t *vm, uint32_t address) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#define VM_WRITE_BODY(_ptr_set, _size) \
|
#define VM_WRITE_BODY(_ptr_set, _size) \
|
||||||
if ((address&0xFFFFF000) == ((address+_size-1)&0xFFFFF000)) { \
|
if ((address & 0xFFFFF000) == ((address + _size - 1) & 0xFFFFF000)) { \
|
||||||
return _ptr_set(vm_findmemory(vm, address, _size, true), value); \
|
return _ptr_set(vm_findmemory(vm, address, _size, true), value); \
|
||||||
} else { \
|
} else { \
|
||||||
return vm_write_across(vm, address, _size, value); \
|
return vm_write_across(vm, address, _size, value); \
|
||||||
|
|
Loading…
Reference in New Issue
Block a user