MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / ide_read_byte2

Function ide_read_byte2

src/idecontrollers.cpp:707–1168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

705}
706
707static uae_u32 ide_read_byte2(struct ide_board *board, uaecptr addr)
708{
709 uaecptr oaddr = addr;
710 uae_u8 v = 0xff;
711
712 addr &= board->mask;
713
714 if (addr < 0x40 && !board->flashenabled && (!board->configured || board->keepautoconfig))
715 return board->acmemory[addr];
716
717 if (board->type == BUDDHA_IDE) {
718
719 int portnum;
720 int flashoffset = -1;
721 bool p1 = (board->aci->rc->device_settings & 3) == 1;
722 int regnum = get_buddha_reg(addr, board, &portnum, &flashoffset);
723 if (flashoffset >= 0) {
724 v = flash_read(board->flashrom, flashoffset);
725 } else if (regnum >= 0) {
726 if (board->ide[portnum])
727 v = get_ide_reg_multi(board, regnum, portnum, 1);
728 } else if (addr >= 0xf00 && addr < 0x1000) {
729 if ((addr & ~3) == 0xf00) {
730 v = ide_irq_check(board->ide[0], false) ? 0x80 : 0x00;
731 } else if ((addr & ~3) == 0xf40) {
732 v = ide_irq_check(board->ide[1], false) ? 0x80 : 0x00;
733 } else if ((addr & ~3) == 0xf80 && !p1) {
734 v = ide_irq_check(board->ide[2], false) ? 0x80 : 0x00;
735 } else {
736 v = 0;
737 }
738 if (p1) {
739 if (addr == 0xf42 && board->hardreset) {
740 v |= 0x80;
741 }
742 if (addr & 2) {
743 v |= 1 << 5;
744 }
745 }
746 } else if (addr >= 0x7fc && addr <= 0x7ff) {
747 v = board->userdata;
748 } else if (!(addr & 1)) {
749 int offset = (addr >> 1) & board->rom_mask;
750 if (p1 && (board->userdata & 0x100)) {
751 offset += 0x8000;
752 }
753 v = board->rom[offset];
754 }
755
756 } else if (board->type == XSURF_IDE) {
757
758 int portnum;
759 int regnum = get_xsurf_reg(addr, board, &portnum);
760 if (regnum >= 0) {
761 if (board->ide[portnum]) {
762 v = get_ide_reg_multi(board, regnum, portnum, 1);
763 }
764 } else if ((addr & 0x80ff) == 0x7e) {

Callers 1

ide_read_byteFunction · 0.85

Calls 15

get_buddha_regFunction · 0.85
flash_readFunction · 0.85
get_ide_reg_multiFunction · 0.85
ide_irq_checkFunction · 0.85
get_xsurf_regFunction · 0.85
get_alf_regFunction · 0.85
get_ide_regFunction · 0.85
golemfast_ncr9x_scsi_getFunction · 0.85
getidenumFunction · 0.85
get_golemfast_regFunction · 0.85
ide_drq_checkFunction · 0.85
masoboshi_ncr9x_scsi_getFunction · 0.85

Tested by

no test coverage detected