Fixed.
h3rald h3rald@h3rald.com
Thu, 04 Dec 2025 09:10:06 +0100
1 files changed,
17 insertions(+),
25 deletions(-)
jump to
M
xywrun.c
→
xywrun.c
@@ -84,34 +84,30 @@ {
if (addr >= DEVICE_AREA_START) { xyw_byte dev_num = get_device(addr); - if (dev_num >= XYW_TOTAL_DEVICES || !xyw_devices[dev_num].input) + if (xyw_devices[dev_num].input) { - *error = XYW_ERROR_DEVICE_UNAVAILABLE; - return (xyw_word)-1; + xyw_byte dev_addr = get_device_address(addr); + // Read two bytes from device + xyw_byte high = xyw_devices[dev_num].input(get_device_data(addr), dev_addr, error); + xyw_byte low = xyw_devices[dev_num].input(get_device_data(addr), dev_addr + 1, error); + return (xyw_word)((high << 8) | low); } - xyw_byte dev_addr = get_device_address(addr); - // Read two bytes from device - xyw_byte high = xyw_devices[dev_num].input(get_device_data(addr), dev_addr, error); - xyw_byte low = xyw_devices[dev_num].input(get_device_data(addr), dev_addr + 1, error); - return (xyw_word)((high << 8) | low); } return XYW_PEEKW(&xyw_memory[addr]); } static inline void writew(xyw_word addr, xyw_word val) { + XYW_POKEW(&xyw_memory[addr], val); if (addr >= DEVICE_AREA_START) { xyw_byte dev_num = get_device(addr); - if (dev_num >= XYW_TOTAL_DEVICES || !xyw_devices[dev_num].output) + if (xyw_devices[dev_num].output) { - *error = XYW_ERROR_DEVICE_UNAVAILABLE; - return; + xyw_byte dev_addr = get_device_address(addr); + xyw_devices[dev_num].output(get_device_data(addr), dev_addr, error); } - xyw_byte dev_addr = get_device_address(addr); - xyw_devices[dev_num].output(get_device_data(addr), dev_addr, error); } - XYW_POKEW(&xyw_memory[addr], val); } static inline xyw_byte read(xyw_word addr)@@ -119,31 +115,27 @@ {
if (addr >= DEVICE_AREA_START) { xyw_byte dev_num = get_device(addr); - if (dev_num >= XYW_TOTAL_DEVICES || !xyw_devices[dev_num].input) + if (xyw_devices[dev_num].input) { - *error = XYW_ERROR_DEVICE_UNAVAILABLE; - return (xyw_byte)-1; + xyw_byte dev_addr = get_device_address(addr); + return xyw_devices[dev_num].input(get_device_data(addr), dev_addr, error); } - xyw_byte dev_addr = get_device_address(addr); - return xyw_devices[dev_num].input(get_device_data(addr), dev_addr, error); } return xyw_memory[addr]; } static inline void write(xyw_word addr, xyw_byte val) { + xyw_memory[addr] = val; if (addr >= DEVICE_AREA_START) { xyw_byte dev_num = get_device(addr); - if (dev_num >= XYW_TOTAL_DEVICES || !xyw_devices[dev_num].output) + if (xyw_devices[dev_num].output) { - *error = XYW_ERROR_DEVICE_UNAVAILABLE; - return; + xyw_byte dev_addr = get_device_address(addr); + xyw_devices[dev_num].output(get_device_data(addr), dev_addr, error); } - xyw_byte dev_addr = get_device_address(addr); - xyw_devices[dev_num].output(get_device_data(addr), dev_addr, error); } - xyw_memory[addr] = val; } //// Device dispatchers