Jump to content
IGNORED

Detecting 32k in Extended BASIC


OLD CS1

Recommended Posts

Another post indicates that checking the value at -31952 (>8330, I believe) will indicate the absence of 32k RAM if the return is 55.

 

However, I have now tested this on real hardware and in Classic99 and I get 255 for 32k RAM present but that changes to a different value once a program is loaded.  Classic99 returned 55 then 29 after a program loaded (32k disabled,) while one console returns 63 with no 32k attached.

 

I assume there is an accepted "standard" for detecting 32k from Extended BASIC -- remembering that I can neither LOAD values into 32k space nor CALL INIT without incurring a fatal error.

 

I tried catching a CALL INIT error with ON ERROR, but the RETURN sends execution right back to the bad statement.

 

I also tried some other fancy shenanigans to no avail.

1 ON ERROR 100 :: ON BREAK NEXT
2 CALL INIT
3 PRINT "SUCCESS"
4 STOP
100 CALL ERR(A,B,C,D):: PRINT A;B;C;D :: BREAK 2 :: RETURN

Arrrr Extended BASIC... she be a harsh mistress.

  • Like 2
Link to comment
Share on other sites

CALL PEEK(-31860,A,B)  CALL PEEK(-31868,A,B)

Should be 255,231 with memory expansion; 0,0 if no memory

CALL INIT

CALL LOAD(-31868,0,0,0,0) turns off memory expansion as far as XB is concerned. Programs will run from VDP memory, but you can still load assembly support!

 

(Edit) It is -31868. You really only need to look at the first byte. If A=0 then no memory expansion.

Edited by senior_falcon
  • Like 1
Link to comment
Share on other sites

1 hour ago, TheBF said:

Man, where was this document in 1985? :)

 

Scattered around various user group newsletters.  I recall a few example programs in ours.  But it appears the only two PEEKs in the document regarding 32k detection are incorrect.

  • Like 1
Link to comment
Share on other sites

I think this works the way you wanted your example program to work?  

 

1 ON ERROR 100
2 CALL INIT
3 PRINT "SUCCESS"
4 STOP
100 CALL ERR(A,B,C,D)::PRINT A;B;C;D::RETURN NEXT

On real hardware, without 32K, this prints the 4 error numbers, then prints "SUCCESS" and stops.  With 32K, it only prints SUCCESS. 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

2 hours ago, Casey said:

RETURN NEXT

Sunnuva gun!  I completely forgot about that construct.  Yes, that would work as well to set a flag for the 32k present or not (the assumption being that CALL INIT will return a * SYNTAX ERROR.)

  • Like 3
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...