Login
Back to forumReply to this topicGo to last reply

Posted By

cryptoboy
on 2017-08-10
00:42:43
 Plus/4: reading the basic ROM from a basic program

I've just started playing with the plus/4. I noticed that using the built-in MONITOR, you can view the BASIC ROM. But due to bank switching, you can't see the BASIC ROM from a BASIC program, as it just appears as usable RAM (initialized to zero). How can I bank switch the ROM back in so I can see it from a BASIC program?

Posted By

cryptoboy
on 2017-08-10
01:10:17
 Re: Plus/4: reading the basic ROM from a basic program

For instance:

MONITOR
M BC20 BC30

Reveals the ROM text:

FRED B
TERRY R
MIKE I

But it's not revealed by:

10 a=48160
20 fort=0to22
30 printchr$(peek(a+t));
40 nextt

since from BASIC, you see RAM (all zeros), not ROM.

Posted By

KiCHY
on 2017-08-10
04:11:02
 Re: Plus/4: reading the basic ROM from a basic program

If you write $2c to memory address $498, the peek command will read byte from ROM. I suggest to restore it to its original value ($8d) as soon as possible, perhaps other parts of basic interpreter use this feature and will read basic program datas/variables from ROM instead of RAM which will lead all kind of strange behavior.

There is a small program at location $494 which turns off ROM, reads RAM then turns ROM on. The peek command calls this subroutine. With modifying this program you can force the peek to read ROM instead of RAM.

Posted By

JamesC
on 2017-08-10
08:04:52
 Re: Plus/4: reading the basic ROM from a basic program

If you aren't into machine language yet, add the following lines to your BASIC program.

5 POKE 1177,62
45 POKE 1177,63

This is the method suggested on page 201 of the Programmer's Reference Guide.

Posted By

SVS
on 2017-08-10
08:24:28
 Re: Plus/4: reading the basic ROM from a basic program

The 2 modes (KiCHY's and JamesC') are both working. When active, you have to care to the use of variables. If they are stored below $8000 there is no problem, but if not (like strings for example) you could obtain strange behaviors.

A final advice: the Monitor commands read from RAM if you write an $80 at cell memory $07F8.

Posted By

cryptoboy
on 2017-08-10
23:44:08
 Re: Plus/4: reading the basic ROM from a basic program

Thanks all! That's exactly what I needed. happy

I had been chasing down other leads (The Ultimate Plus/4 map, searching for all occurrences of "bank" in the Programmer's Reference Guide, etc.) but wasn't getting anywhere.

Posted By

cryptoboy
on 2017-08-11
00:03:17
 Re: Plus/4: reading the basic ROM from a basic program

Cool, that made this work for me as well:

5 poke 1177,62
10 m = 85: rem xor mask 01010101
20 for i = 33 to 1 step -1
30 c = peek(52617+i)
40 p = (c or m) - (c and m)
50 print chr$(p);
60 next i
65 poke 1177,63

Posted By

Charlemagne
on 2017-09-15
17:45:27
 Re: Plus/4: reading the basic ROM from a basic program

I had recognized this problem (PEEK(X) where X>0x7FFF doesn't work) a lot of years ago...

So I made a little program:
Memória Nézegető

Have a closer look at the 100th and 320th lines of this BASIC program!

It rewrites a little assembly program (LDA $XXXX STA $02 RTS) with POKE at 32000 ($7D00) and calling with SYS then PEEK(2)



Back to topReply to this topic


Copyright © Plus/4 World Team, 2001-2024. Support Plus/4 World on Patreon