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
BASIC: Find out if an Interface 1 is attached.
Re: BASIC: Find out if an Interface 1 is attached.
Wow, it doesn't seem that easy to retrieve that information from your Speccy..
I'm still trying to make a test with pure Sinclair BASIC - maybe something from all your suggestions can be used. If that's really impossible, I'll give this or that method using some assembler a try - but that will be the last resort.
Thanks for all your suggestions and tips!
I'm still trying to make a test with pure Sinclair BASIC - maybe something from all your suggestions can be used. If that's really impossible, I'll give this or that method using some assembler a try - but that will be the last resort.
Thanks for all your suggestions and tips!
48K/+/+/+/+128K/Vega/Next&80/81&88
Re: BASIC: Find out if an Interface 1 is attached.
It is surprising to realise there's not a very easy IF PEEK xyz <> abc , or something similar like IF PEEK xyz = abc etc
Logic would say there should be, I can see it moves things about a bit, trouble is the contents of what has moved is variable anyway in its nature and content.
I don't *think* the following will be useful but...
23653-23654 STACKEND:
EDIT... No the above usually on a reset returns 41532 regardless and CLEAR is going to make that jump about. Hmm. There might be something similar that can be used. Have you looked at all the system variables in the Speccy Manual ?
RAMTOP is at 23730-23731
I don't (think) FLAGS at 23611 is going to be any help.
That's about as much erm 'sane' thoughts as I can put into this.
Logic would say there should be, I can see it moves things about a bit, trouble is the contents of what has moved is variable anyway in its nature and content.
I don't *think* the following will be useful but...
23653-23654 STACKEND:
Try: PRINT PEEK 23730 + 256*PEEK 23731 - PEEK 23653 - 256*PEEK 23654 , with both an IF one connected *and* without it connected.This system variable contains the address of where the spare part of memory starts. From reading this we can gain an idea of how much memory we have left by subtracting it from RAMtop
EDIT... No the above usually on a reset returns 41532 regardless and CLEAR is going to make that jump about. Hmm. There might be something similar that can be used. Have you looked at all the system variables in the Speccy Manual ?
RAMTOP is at 23730-23731
I don't (think) FLAGS at 23611 is going to be any help.
That's about as much erm 'sane' thoughts as I can put into this.
Re: BASIC: Find out if an Interface 1 is attached.
I tested Jonathan's rather short Sinclair BASIC variant - indeed a test in the system variable area:
Code: Select all
10 CLOSE#0:LET inf1=(PEEK 23734<>244)
20 IF inf1 THEN PRINT "ZX Interface 1 detected."
48K/+/+/+/+128K/Vega/Next&80/81&88