Re: BASIC: Find out if an Interface 1 is attached.
Posted: Sat Sep 21, 2019 6:03 am
There are some more suggestions from J.G. Hartson
His machine code approach is pretty versatile, and uses hook code 0x31 to initialize the IF1
It also traps for the non existence of the IF1 and will trigger a clean return to BASIC in either instance
There are other interfaces (Disciple and Plus D) that mirror the IF1 hook codes
Pretending I hadn't read what Seven.FFF had said about magic numbers(!),
you can potentially determine what interface (and version) has responded to hook code 0x31 by inspecting register pairs once control has returned to your own code...
For example, with an IF1 Version 2
de will be set at 0x0700 - the UNPAGE location that leaves the shadow ROM
hl will be set at 0x1e98 - the HOOK-31 location
With an IF1 Version 1, de will still be 0x0700, but hl will be set at a different location of 0x19a8 for HOOK-31
His machine code approach is pretty versatile, and uses hook code 0x31 to initialize the IF1
It also traps for the non existence of the IF1 and will trigger a clean return to BASIC in either instance
There are other interfaces (Disciple and Plus D) that mirror the IF1 hook codes
Pretending I hadn't read what Seven.FFF had said about magic numbers(!),
you can potentially determine what interface (and version) has responded to hook code 0x31 by inspecting register pairs once control has returned to your own code...
For example, with an IF1 Version 2
de will be set at 0x0700 - the UNPAGE location that leaves the shadow ROM
hl will be set at 0x1e98 - the HOOK-31 location
With an IF1 Version 1, de will still be 0x0700, but hl will be set at a different location of 0x19a8 for HOOK-31