Human68k CUI emulator with sound.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

v68ipl.c 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #include <stdint.h>
  2. #include "v68ipl.h"
  3. #include "v68.h"
  4. uint8_t iplrom[IPL_ROM_SIZE];
  5. static void write_ipl_16(uint32_t addr, const uint16_t *data, int data_len) {
  6. uint8_t *p = iplrom + addr - IPL_ROM_START;
  7. const uint16_t *d = data;
  8. for(int i = 0; i < data_len; i++) {
  9. *p++ = *d >> 8;
  10. *p++ = *d & 0xff;
  11. d++;
  12. }
  13. }
  14. void v68_ipl_init() {
  15. const uint16_t fake_ipl[] = {
  16. #include "fake_ipl.inc"
  17. };
  18. write_ipl_16(0xff0000, fake_ipl, sizeof(fake_ipl) / sizeof(fake_ipl[0]));
  19. /* IOCS work setting */
  20. m68k_write_memory_16(0x970, 79); /* Number of columns on screen -1 */
  21. m68k_write_memory_16(0x972, 24); /* Number of lines on screen -1 */
  22. }
  23. uint8_t v68_ipl_read_8(uint32_t addr) {
  24. addr -= 0xfe0000;
  25. return iplrom[addr];
  26. }
  27. uint16_t v68_ipl_read_16(uint32_t addr) {
  28. addr -= 0xfe0000;
  29. return (iplrom[addr] << 8) | iplrom[addr + 1];
  30. }
  31. uint32_t v68_ipl_read_32(uint32_t addr) {
  32. addr -= 0xfe0000;
  33. return (iplrom[addr] << 24) | (iplrom[addr + 1] << 16) | (iplrom[addr + 2] << 8) | iplrom[addr + 3];
  34. }