Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Soft Switch BASIC program

246 views
Skip to first unread message

Anthony Ortiz

unread,
Nov 6, 2017, 6:01:43 PM11/6/17
to
For the first time since I was 16 (44 now) I've programmed a BASIC program on the Apple II (er, that is, as emulated within AppleWin). Coding this without a proper editor and within the constraints of BASIC while re-learning what I'd forgotten was certainly challenging and I've got to say that once you work with a modern IDE and a modern language (if else, functions, parameters, long variable names, etc...) it's hard to go back. I created this program in order to test what I've learned from the Sather's book and was hoping you guys can test it out and see if there's anything wrong with the logic. I saved this to a beagle-bros img I found online but don't know how to post it online. How should I go about posting my basic program within AppleWin for you guys to critique?

Anthony Ortiz

unread,
Nov 6, 2017, 6:06:20 PM11/6/17
to
On Monday, November 6, 2017 at 6:01:43 PM UTC-5, Anthony Ortiz wrote:
> For the first time since I was 16 (44 now) I've programmed a BASIC program on the Apple II (er, that is, as emulated within AppleWin). Coding this without a proper editor and within the constraints of BASIC while re-learning what I'd forgotten was certainly challenging and I've got to say that once you work with a modern IDE and a modern language (if else, functions, parameters, long variable names, etc...) it's hard to go back. I created this program in order to test what I've learned from the Sather's book and was hoping you guys can test it out and see if there's anything wrong with the logic. I saved this to a beagle-bros img I found online but don't know how to post it online. How should I go about posting my basic program within AppleWin for you guys to critique?

I don't know what the preferred method is but for now I'll just post a link to my google drive upload : https://drive.google.com/file/d/1-vxR0rA3exFwj9r7XBgPYnLTNsrnO23m/view?usp=sharing

Anthony Ortiz

unread,
Nov 6, 2017, 6:18:41 PM11/6/17
to
> I don't know what the preferred method is but for now I'll just post a link to my google drive upload : https://drive.google.com/file/d/1-vxR0rA3exFwj9r7XBgPYnLTNsrnO23m/view?usp=sharing

The program is called "Hello" and the interface is described at the bottom of the screen with the keys to press in inverse mode. I would appreciate critique/corrections if I've made a mistake.

Michael 'AppleWin Debugger Dev'

unread,
Nov 6, 2017, 6:35:32 PM11/6/17
to
On Monday, November 6, 2017 at 3:01:43 PM UTC-8, Anthony Ortiz wrote:
> How should I go about posting my basic program within AppleWin for you guys

Listed by priority:

1. DSK image
2. Raw text that we can copy/paste into emulators

> to critique?

Wow, you like living dangerously I see. :-)

Anthony Ortiz

unread,
Nov 6, 2017, 6:40:39 PM11/6/17
to
Haha, well, not looking for code critique, it's obviously bad lol. The code embodies what I think is going on with the soft-switches so I'm hoping you experts can spot any flaws in the logic by using this program. Many thanks in advance!

Michael 'AppleWin Debugger Dev'

unread,
Nov 6, 2017, 6:47:27 PM11/6/17
to
On Monday, November 6, 2017 at 3:18:41 PM UTC-8, Anthony Ortiz wrote:
> > I don't know what the preferred method is but for now I'll just post a link to my google drive upload : https://drive.google.com/file/d/1-vxR0rA3exFwj9r7XBgPYnLTNsrnO23m/view?usp=sharing
>
> The program is called "Hello" and the interface is described at the bottom of the screen with the keys to press in inverse mode. I would appreciate critique/corrections if I've made a mistake.

W.R.T. Applesoft, I can share some tips

1. Place your data statments near the beginning
i.e.
0 DIM CL(3) ... : GOTO 100
1 DATA " ROM ", " RAM B1 ", etc...

2. Leave off the var names for NEXT statements
3. Place all common GOSUB targets near the beginning
4. All the string constants assigned to RT$ could be saved into an array / DIM.
5. Bit of flicker when modes change due to drawing the entire screen -- not sure if you want to take the time to fix it to make it look more professional ?

As far as functionality I took a quick look at it looks ok.

What's the quit key ? ESC would be nice ;-)

One suggestion is that it would be nice to see a "VIEW" tat in $2000 / $400 areas above for Pages 1 /2 as a visual indicator what page is visible.

i.e.

$2000 | VIEW |
|________|
$0400 | |
|________|

or

$2000 | |
|________|
$0400 | VIEW |
|________|



Another suggestion might be to add a 3rd row and include $C050/$C051 CLRTEXT status.


Current version looks good!

Michael 'AppleWin Debugger Dev'

unread,
Nov 6, 2017, 6:51:46 PM11/6/17
to
Another suggestion:

Instead of having just a single line: RAM or AUX

That, if you have room, is to use spatial positioning to make it visually easier to tell which one is active.
i.e.

|MAIN/---|
|----/AUX|

Michael 'AppleWin Debugger Dev'

unread,
Nov 6, 2017, 6:56:50 PM11/6/17
to
On Monday, November 6, 2017 at 3:40:39 PM UTC-8, Anthony Ortiz wrote:
> Haha, well, not looking for code critique, it's obviously bad lol. The code embodies what I think is going on with the soft-switches so I'm hoping you experts can spot any flaws in the logic by using this program. Many thanks in advance!

I believe you have a bug with 80STORE = 0 and RAMRD=1 (along with RAMWRT=1)

You have $2000 as RAM in the RW column but shouldn't it be AUX ?

Anthony Ortiz

unread,
Nov 6, 2017, 7:01:01 PM11/6/17
to
> W.R.T. Applesoft, I can share some tips
>
> 1. Place your data statments near the beginning
> i.e.
> 0 DIM CL(3) ... : GOTO 100
> 1 DATA " ROM ", " RAM B1 ", etc...
>
> 2. Leave off the var names for NEXT statements
> 3. Place all common GOSUB targets near the beginning
> 4. All the string constants assigned to RT$ could be saved into an array / DIM.
> 5. Bit of flicker when modes change due to drawing the entire screen -- not sure if you want to take the time to fix it to make it look more professional ?

This was just a disposable program I wrote to see if what I *think* I've learned from Sather's is what's *actually* going on, and no better way then to create a visual that the experts are able to easily use and quickly determine whether the logic is sound. Therefore, the state of the code was not of a major concern to me though I tried to keep things tidy as much as I could without cutting into my time. That being said I plan on expanding this with more switches in the future so if this actually turns out to be something that others find useful then I can refactor, though I would much rather do this in an actual editor... doing BASIC from the prompt is pretty painful now, lol!

> As far as functionality I took a quick look at it looks ok.
>
> What's the quit key ? ESC would be nice ;-)

The quit key is : CRL-C :P

> One suggestion is that it would be nice to see a "VIEW" tat in $2000 / $400 areas above for Pages 1 /2 as a visual indicator what page is visible.
>
> i.e.
>
> $2000 | VIEW |
> |________|
> $0400 | |
> |________|
>
> or
>
> $2000 | |
> |________|
> $0400 | VIEW |
> |________|
>

Oh, you mean which graphics/text page (1 or 2) is visible?

> Another suggestion might be to add a 3rd row and include $C050/$C051 CLRTEXT status.

I'll have to see what CLRTEXT does.

Thanks for the feedback!

Anthony Ortiz

unread,
Nov 6, 2017, 7:04:16 PM11/6/17
to
I'll take a look. From what I understand 80store controls the 400-7ff and 2000-3fff regions, so setting 80store and page2 will make 400-7ff be AUX, and setting 80store, page2, and hires will make 2000-3FFF be AUX; otherwise they will be RAM, no?

Michael 'AppleWin Debugger Dev'

unread,
Nov 6, 2017, 7:38:35 PM11/6/17
to
You are handling 80STORE=1 correctly -- since that over-rides RAMRD and RAMWRT

Unless I'm mistaken the bug is when 80STORE=0 ... I don't think you are displaying the correct label when RAMRD and/or RAMWRT are active.

Anthony Ortiz

unread,
Nov 6, 2017, 9:43:54 PM11/6/17
to
I think I see what you're saying now as I'm reading through Sather's book; have to re-read this over a few times to make sure but I'm inclined to think you may be right.

Michael 'AppleWin Debugger Dev'

unread,
Nov 6, 2017, 11:47:16 PM11/6/17
to
On Monday, November 6, 2017 at 6:43:54 PM UTC-8, Anthony Ortiz wrote:
> I think I see what you're saying now as I'm reading through Sather's book; have to re-read this over a few times to make sure but I'm inclined to think you may be right.

This tech note, The Apple IIe #3, section "Using the Auxiliary Memory", might help:

Double High-Resolution Graphics
http://www.1000bit.it/support/manuali/apple/technotes/aiie/tn.aiie.03.html

Anthony Ortiz

unread,
Nov 7, 2017, 1:13:32 AM11/7/17
to
Thanks Michael.

Here's a link to version 2 : https://drive.google.com/open?id=1ysZVnjmfS-Qfgpi5jtjKn1b_npLridJU

Should fix the issue you described and added ESC key to quit. PLease let me know if there's any more issues.

Refactoring is a pain in the basic monitor so I had to hack my fix in... what methods do you guys use to lessen the pain? Is it possible for me to copy/paste between windows and applewin? That is, can I edit this within a windows editor and paste it into basic monitor? Not being to scroll and running out of space between line numbers is killer.

Michael 'AppleWin Debugger Dev'

unread,
Nov 7, 2017, 1:16:40 AM11/7/17
to
Use Ctrl-shift-Ins to paste into AppleWin
(Or in the debugger you can use Ctrl-V)

John Brooks

unread,
Nov 7, 2017, 10:52:16 AM11/7/17
to
For refactoring basic code I list it to a text file, then edit it in Merlin or the Kyan Pascal editor, or move it out to Visual Studio Code on the Mac.

To run I exec the file.

Virtual ][ is also pretty nice for moving text in back and forth. I print to the Mac clipboard and then paste it into VS Code, and copy text from VS Code and paste it into Virtual ][ which sends it to the emulated Apple II as keystrokes.

-JB
@JBrooksBSI

Anthony Ortiz

unread,
Nov 7, 2017, 11:00:34 AM11/7/17
to
Is there a way to move it out once it's already in Applesoft? I wrote the whole thing in the basic monitor and would like to get my listing and modify it on my windows editor and then paste it back in.

Anthony Ortiz

unread,
Nov 7, 2017, 11:11:18 AM11/7/17
to
Whoa, just found out about WASP (Windows AppleSoft Programming tool). Anyone use this? I'm not sure if it still works but I'm going to see if I can download it from somewhere as the original link is down.

Anthony Ortiz

unread,
Nov 7, 2017, 11:33:04 AM11/7/17
to
Woohoo! Found it here : http://noboot.com/charlie/software/wasp.htm

Seem to work on Windows 10, was able to load in my basic program from a dsk file. Now we're talking! I'd like to run this through a renumbering program though... I remember having one as a kid, I think it was from Beagle Bros but not sure.

Bobbi

unread,
Nov 7, 2017, 1:00:51 PM11/7/17
to
There is a renumber utility on the DOS3.3 System Master. (Uses the Applesoft ampersand extension mechanism.)

Michael J. Mahon

unread,
Nov 7, 2017, 2:48:58 PM11/7/17
to
Use Program Writer to write and edit Applesoft programs. It makes things
much easier (but, of course, at the cost of learning another editor ;-).

--
-michael - NadaNet 3.1 and AppleCrate II: http://michaeljmahon.com

Michael J. Mahon

unread,
Nov 7, 2017, 2:48:58 PM11/7/17
to
...all available in Program Writer.

Bill Garber

unread,
Nov 7, 2017, 4:50:02 PM11/7/17
to
"Michael J. Mahon" wrote in message
news:UJGdnW0-icK5k5_H...@giganews.com...
Program Writer is a lot like Notepad... Very easy to learn and use, too.

Bill Garber * http://www.sepa-electronics.com *


Anthony Ortiz

unread,
Nov 7, 2017, 9:23:41 PM11/7/17
to
I'll check out program writer. If you guys can give run my program and confirm that the logic is right or wrong I'd appreciate it. Thx!

James Davis

unread,
Nov 7, 2017, 9:26:06 PM11/7/17
to
For Applesoft, IMOO, Beagle Bros best program editor is their Global Program Line Editor (G.P.L.E.). IIRC, it renumbers also.

James Davis

unread,
Nov 7, 2017, 9:29:26 PM11/7/17
to
You can extract Apple II files to Windows text files and vice-versa with CiderPress from/to disk images or shrink-it files.

James Davis

unread,
Nov 7, 2017, 9:59:20 PM11/7/17
to
On Tuesday, November 7, 2017 at 6:29:26 PM UTC-8, James Davis wrote:
> You can extract Apple II files to Windows text files and vice-versa with CiderPress from/to disk images or shrink-it files.

Here are the two versions of your hello as I extracted them with CiderPress from your two disk images:


BeagleBrosDOSBossMyCopy1HELLO.txt

0 DIM CL(3):CL(0) = 7:CL(1) = 18:CL(2) = 29
10 REM AZ=ALTZP
20 REM P2=PAGE2
30 REM S8=80STORE
40 REM HI=HIRES
50 REM RR=RAMRD
60 REM RW=RAMWRT
70 REM HR=HRAMRD
80 REM HW=HRAMWRT
90 REM B1=BANK1
100 GOSUB 2230 REM DISPLAY SCREEN BACKDROP
105 GOSUB 2500 REM UPDATE SCREEN WITH DATA
110 GOSUB 2405 REM PROCESS KEYPRESS
115 GOTO 105
999 RETURN
1000 REM *** DETERMINE HIGH READ
1010 IF AD < 53248 THEN RT$ = "": RETURN
1015 IF HR = 0 THEN GOTO 1055
1020 IF AD < 57344 THEN GOTO 1035
1025 IF AZ = 1 THEN RT$ = " AUX ": RETURN
1030 RT$ = " RAM ": RETURN
1035 IF AZ = 1 AND B1 = 0 THEN RT$ = " AUX B2 ": RETURN
1040 IF AZ = 1 AND B1 = 1 THEN RT$ = " AUX B1 ": RETURN
1045 IF AZ = 0 AND B1 = 0 THEN RT$ = " RAM B2 ": RETURN
1050 IF AZ = 0 AND B1 = 1 THEN RT$ = " RAM B1 ": RETURN
1055 RT$ = " ROM ": RETURN
1100 REM *** DETERMINE HIGH WRITE
1110 IF AD < 53248 THEN RT$ = "": RETURN
1115 IF HW = 1 THEN GOTO 1055
1120 GOTO 1020
1200 REM *** DETERMINE RAM READ
1205 IF AD < 512 OR AD > = 49152 THEN RT$ = "": RETURN
1210 IF RR = 1 THEN RT$ = " AUX ": RETURN
1215 RT$ = " RAM ": RETURN
1300 REM *** DETERMINE RAM WRITE
1305 IF AD < 512 OR AD > = 49152 THEN RT$ = "": RETURN
1310 IF RW = 1 THEN RT$ = " AUX ": RETURN
1315 RT$ = " RAM ": RETURN
1400 REM *** DETERMINE RW RAM
1405 IF AD > = 512 THEN GOTO 1420
1410 RT = 1: IF AZ = 1 THEN RT$ = " AUX ": RETURN
1415 RT$ = " RAM ": RETURN
1420 IF AD < 1024 OR AD > = 2048 THEN GOTO 1435
1425 RT = 2: IF P2 = 1 AND S8 = 1 THEN RT$ = " AUX ": RETURN
1430 RT$ = " RAM ": RETURN
1435 IF AD < 8192 OR AD > = 16384 THEN RT$ = "": RETURN
1440 RT = 3: IF HI = 1 AND P2 = 1 AND S8 = 1 THEN RT$ = " AUX ": RETURN
1445 RT$ = " RAM ": RETURN
1500 REM *** DETERMINE HIGH RAM READ
2000 REM *** DRAW HORIZONAL LINE ***
2005 VTAB 5: HTAB 5
2010 FOR II = 1 TO 10: PRINT "_";: NEXT II: RETURN
2020 REM *** DRAW VERTICAL LINE ***
2021 REM *** PARAM H : HTAB OF VERTICAL LINE
2025 VTAB 5: HTAB 4
2030 FOR II = 2 TO 5: HTAB H: PRINT "|": NEXT II: PRINT : FOR II = 7 TO 18: HTAB H: PRINT "|": NEXT II
2040 REM *** PRINT ADDRESSES ***
2050 VTAB 2: HTAB 1: PRINT "$FFFF"
2060 PRINT "$E000": PRINT
2070 PRINT "$D000": PRINT
2080 PRINT "$BFFF": PRINT
2090 PRINT "$3FFF"
2100 PRINT "$2000": PRINT : PRINT
2110 PRINT "$07FF"
2120 PRINT "$0400": PRINT : PRINT
2130 PRINT "$01FF"
2140 PRINT "$0000"
2150 RETURN
2160 REM *** PRINT TITLES
2170 VTAB 1: HTAB 11: PRINT "RW";: HTAB 21: PRINT "READ";: HTAB 32: PRINT "WRITE": RETURN
2180 REM *** PRINT SOFT SWITCHES ***
2190 VTAB 23: HTAB 1
2200 INVERSE : PRINT "P";: NORMAL : PRINT "AGE2 RAM";: INVERSE : PRINT "R";: NORMAL : PRINT "D ";: INVERSE : PRINT "A";: NORMAL : PRINT "LTZP HRAMR";: INVERSE : PRINT "D";: HTAB 35: PRINT "B";: NORMAL : PRINT "ANK1"
2210 INVERSE : PRINT "H";: NORMAL : PRINT "IRES RAM";: INVERSE : PRINT "W";: NORMAL : PRINT "RT ";: INVERSE : PRINT "8";: NORMAL : PRINT "0STORE HRAMWR";: INVERSE : PRINT "T";: NORMAL : PRINT "' RE";: INVERSE : PRINT "S";: NORMAL : PRINT "ET";: RETURN
2220 REM *** PRINT SCREEN ***"
2230 HOME : GOSUB 2050
2240 FOR I = 0 TO 3: READ H: VTAB 2: GOSUB 2030: NEXT I
2250 FOR I = 1 TO 10: READ V: VTAB V: HTAB 7: GOSUB 2010: HTAB 18: GOSUB 2010: HTAB 29: GOSUB 2010: NEXT I
2260 GOSUB 2170: GOSUB 2190: VTAB 1: RETURN
2300 REM *** RESET
2310 AZ = 0:P2 = 0:S8 = 0:HI = 0:RR = 0:RW = 0:HR = 0:HW = 0:B1 = 0
2315 RETURN
2400 REM *** READ KEY
2405 K = PEEK (49152): IF K < = 127 THEN GOTO 2405
2410 POKE 49168,0
2415 K$ = CHR$ (K - 128)
2420 IF K$ = "P" OR K$ = "p" THEN P2 = 1 - P2: RETURN
2425 IF K$ = "H" OR K$ = "h" THEN HI = 1 - HI: RETURN
2430 IF K$ = "R" OR K$ = "r" THEN RR = 1 - RR: RETURN
2435 IF K$ = "W" OR K$ = "w" THEN RW = 1 - RW: RETURN
2440 IF K$ = "A" OR K$ = "a" THEN AZ = 1 - AZ: RETURN
2445 IF K$ = "8" THEN S8 = 1 - S8: RETURN
2450 IF K$ = "D" OR K$ = "d" THEN HR = 1 - HR: RETURN
2455 IF K$ = "T" OR K$ = "t" THEN HW = 1 - HW: RETURN
2460 IF K$ = "B" OR K$ = "b" THEN B1 = 1 - B1: RETURN
2465 IF K$ = "S" OR K$ = "s" THEN GOSUB 2310: RETURN
2470 PRINT CHR$ (7): GOTO 2405
2500 REM *** UPDATE SCREEN WITH DATA
2501 GOSUB 2905
2505 AD = 0: GOSUB 1400: IF RT$ = "" THEN GOTO 4000
2510 C = 0:R = 17: GOSUB 2810
2515 AD = 1024: GOSUB 1400: IF RT$ = "" THEN GOTO 4000
2520 C = 0:R = 13: GOSUB 2810
2525 AD = 8192: GOSUB 1400: IF RT$ = "" THEN GOTO 4000
2530 R = 9: GOSUB 2810
2531 AD = 512:R = 15: GOSUB 2535
2532 AD = 2048:R = 11: GOSUB 2535
2533 AD = 16384:R = 7: GOSUB 2535
2534 GOTO 2565
2535 GOSUB 1200: IF RT$ = "" THEN GOTO 4000
2540 TR$ = RT$: GOSUB 1300: IF RT$ = "" THEN GOTO 4000
2545 TW$ = RT$: GOSUB 2710: IF TR$ = TW$ THEN C = 0: GOSUB 2810: RETURN
2550 C = 1:RT$ = TR$: GOSUB 2810
2555 C = 2:RT$ = TW$: GOSUB 2810
2560 RETURN
2565 AD = 53248:R = 4: GOSUB 2600
2570 AD = 57344:R = 2: GOSUB 2600
2600 GOSUB 1000: IF RT$ = "" THEN GOTO 4000
2605 TR$ = RT$: GOSUB 1100: IF RT$ = "" THEN GOTO 4000
2610 TW$ = RT$: GOSUB 2710: IF TR$ = TW$ THEN C = 0: GOSUB 2810: RETURN
2615 GOTO 2550
2700 REM *** CLEAR DATA IN ROW
2705 REM *** PARAM R=ROW
2710 FOR I = 0 TO 2: VTAB R: HTAB CL(I): PRINT " ";: NEXT I: RETURN
2800 REM *** DISPLAY DATA IN COLUMN
2805 REM *** PARAM R=ROW, C=COL, RT$=DATA
2810 VTAB R: HTAB CL(C): PRINT RT$;: RETURN
2900 REM *** DISPLAY SOFT SWITCH VALUES
2905 INVERSE : VTAB 23: HTAB 6: PRINT P2;: HTAB 14: PRINT RR;: HTAB 23: PRINT AZ;: HTAB 33: PRINT HR;: HTAB 40: PRINT B1;
2910 VTAB 24: HTAB 6: PRINT HI;: HTAB 14: PRINT RW;: HTAB 23: PRINT S8;: HTAB 33: PRINT HW;: NORMAL : RETURN
4000 VTAB 1: PRINT "ERROR"
5000 DATA 6,17,28,39
5010 DATA 1,3,5,6,8,10,12,14,16,18


BeagleBrosDOSBossMyCopy2HELLO.txt

0 DIM CL(3):CL(0) = 7:CL(1) = 18:CL(2) = 29
10 REM AZ=ALTZP
20 REM P2=PAGE2
30 REM S8=80STORE
40 REM HI=HIRES
50 REM RR=RAMRD
60 REM RW=RAMWRT
70 REM HR=HRAMRD
80 REM HW=HRAMWRT
90 REM B1=BANK1
100 GOSUB 2230 REM DISPLAY SCREEN BACKDROP
105 GOSUB 2500 REM UPDATE SCREEN WITH DATA
110 GOSUB 2405 REM PROCESS KEYPRESS
115 GOTO 105
999 RETURN
1000 REM *** DETERMINE HIGH READ
1010 IF AD < 53248 THEN RT$ = "": RETURN
1015 IF HR = 0 THEN GOTO 1055
1020 IF AD < 57344 THEN GOTO 1035
1025 IF AZ = 1 THEN RT$ = " AUX ": RETURN
1030 RT$ = " RAM ": RETURN
1035 IF AZ = 1 AND B1 = 0 THEN RT$ = " AUX B2 ": RETURN
1040 IF AZ = 1 AND B1 = 1 THEN RT$ = " AUX B1 ": RETURN
1045 IF AZ = 0 AND B1 = 0 THEN RT$ = " RAM B2 ": RETURN
1050 IF AZ = 0 AND B1 = 1 THEN RT$ = " RAM B1 ": RETURN
1055 RT$ = " ROM ": RETURN
1100 REM *** DETERMINE HIGH WRITE
1110 IF AD < 53248 THEN RT$ = "": RETURN
1115 IF HW = 1 THEN GOTO 1055
1120 GOTO 1020
1200 REM *** DETERMINE RAM READ
1201 IF RR = 0 THEN GOTO 1215
1202 IF ((AD > = 1024 AND AD < 2048) OR (AD > = 8192 AND AD < 16384)) THEN GOTO 1210
1204 IF AD < 512 OR AD > = 49152 THEN RT$ = "": RETURN
1205 RT$ = " AUX ": RETURN
1210 IF S8 = 0 THEN GOTO 1205
1215 RT$ = " RAM ": RETURN
1300 REM *** DETERMINE RAM WRITE
1301 IF RW = 0 THEN GOTO 1315
1302 IF ((AD > = 1024 AND AD < 2048) OR (AD > = 8192 AND AD < 16384)) THEN GOTO 1310
1304 IF AD < 512 OR AD > = 49152 THEN RT$ = "": RETURN
1305 RT$ = " AUX ": RETURN
1310 IF S8 = 0 THEN GOTO 1305
1315 RT$ = " RAM ": RETURN
1400 REM *** DETERMINE RW RAM
1405 IF AD > = 512 THEN GOTO 1420
1410 RT = 1: IF AZ = 1 THEN RT$ = " AUX ": RETURN
1415 RT$ = " RAM ": RETURN
1420 IF AD < 1024 OR AD > = 2048 THEN GOTO 1435
1425 RT = 2: IF P2 = 1 AND S8 = 1 THEN RT$ = " AUX ": RETURN
1430 RT$ = " RAM ": RETURN
1435 IF AD < 8192 OR AD > = 16384 THEN RT$ = "": RETURN
1440 RT = 3: IF HI = 1 AND P2 = 1 AND S8 = 1 THEN RT$ = " AUX ": RETURN
1445 RT$ = " RAM ": RETURN
2000 REM *** DRAW HORIZONAL LINE ***
2005 VTAB 5: HTAB 5
2010 FOR II = 1 TO 10: PRINT "_";: NEXT II: RETURN
2020 REM *** DRAW VERTICAL LINE ***
2021 REM *** PARAM H : HTAB OF VERTICAL LINE
2025 VTAB 5: HTAB 4
2030 FOR II = 2 TO 5: HTAB H: PRINT "|": NEXT II: PRINT : FOR II = 7 TO 18: HTAB H: PRINT "|": NEXT II
2040 REM *** PRINT ADDRESSES ***
2050 VTAB 2: HTAB 1: PRINT "$FFFF"
2060 PRINT "$E000": PRINT
2070 PRINT "$D000": PRINT
2080 PRINT "$BFFF": PRINT
2090 PRINT "$3FFF"
2100 PRINT "$2000": PRINT : PRINT
2110 PRINT "$07FF"
2120 PRINT "$0400": PRINT : PRINT
2130 PRINT "$01FF"
2140 PRINT "$0000"
2150 RETURN
2160 REM *** PRINT TITLES
2170 VTAB 1: HTAB 11: PRINT "RW";: HTAB 21: PRINT "READ";: HTAB 32: PRINT "WRITE": RETURN
2180 REM *** PRINT SOFT SWITCHES ***
2190 VTAB 23: HTAB 1
2200 INVERSE : PRINT "P";: NORMAL : PRINT "AGE2 RAM";: INVERSE : PRINT "R";: NORMAL : PRINT "D ";: INVERSE : PRINT "A";: NORMAL : PRINT "LTZP HRAMR";: INVERSE : PRINT "D";: HTAB 35: PRINT "B";: NORMAL : PRINT "ANK1"
2210 INVERSE : PRINT "H";: NORMAL : PRINT "IRES RAM";: INVERSE : PRINT "W";: NORMAL : PRINT "RT ";: INVERSE : PRINT "8";: NORMAL : PRINT "0STORE HRAMWR";: INVERSE : PRINT "T";: NORMAL : PRINT "' RE";: INVERSE : PRINT "S";: NORMAL : PRINT "ET";: RETURN
2220 REM *** PRINT SCREEN ***"
2230 HOME : GOSUB 2050
2240 FOR I = 0 TO 3: READ H: VTAB 2: GOSUB 2030: NEXT I
2250 FOR I = 1 TO 10: READ V: VTAB V: HTAB 7: GOSUB 2010: HTAB 18: GOSUB 2010: HTAB 29: GOSUB 2010: NEXT I
2260 GOSUB 2170: GOSUB 2190: VTAB 1: RETURN
2300 REM *** RESET
2310 AZ = 0:P2 = 0:S8 = 0:HI = 0:RR = 0:RW = 0:HR = 0:HW = 0:B1 = 0
2315 RETURN
2400 REM *** READ KEY
2405 K = PEEK (49152): IF K < = 127 THEN GOTO 2405
2410 POKE 49168,0
2415 K$ = CHR$ (K - 128)
2420 IF K$ = "P" OR K$ = "p" THEN P2 = 1 - P2: RETURN
2425 IF K$ = "H" OR K$ = "h" THEN HI = 1 - HI: RETURN
2430 IF K$ = "R" OR K$ = "r" THEN RR = 1 - RR: RETURN
2435 IF K$ = "W" OR K$ = "w" THEN RW = 1 - RW: RETURN
2440 IF K$ = "A" OR K$ = "a" THEN AZ = 1 - AZ: RETURN
2445 IF K$ = "8" THEN S8 = 1 - S8: RETURN
2450 IF K$ = "D" OR K$ = "d" THEN HR = 1 - HR: RETURN
2455 IF K$ = "T" OR K$ = "t" THEN HW = 1 - HW: RETURN
2460 IF K$ = "B" OR K$ = "b" THEN B1 = 1 - B1: RETURN
2465 IF K$ = "S" OR K$ = "s" THEN GOSUB 2310: RETURN
2468 IF K$ = CHR$ (27) THEN HOME : END
2470 PRINT CHR$ (7): GOTO 2405
2500 REM *** UPDATE SCREEN WITH DATA
2501 GOSUB 2905
2505 AD = 0: GOSUB 1400: IF RT$ = "" THEN GOTO 4000
2510 C = 0:R = 17: GOSUB 2810
2511 AD = 1024:R = 13: GOSUB 2535: IF TR$ = TW$ AND TR$ = " RAM " THEN RT$ = " ":C = 0: GOSUB 2810: GOTO 2515
2512 IF TR$ = " RAM " THEN GOSUB 1400:C = 1:R = 13: GOSUB 2810
2513 IF TW$ = " RAM " THEN GOSUB 1400:C = 2:R = 13: GOSUB 2810
2514 GOTO 2521
2515 AD = 1024: GOSUB 1400: IF RT$ = "" THEN GOTO 4000
2520 C = 0:R = 13: GOSUB 2810
2521 AD = 8192:R = 9: GOSUB 2535: IF TR$ = TW$ AND TR$ = " RAM " THEN RT$ = " ":C = 0: GOSUB 2810: GOTO 2525
2522 IF TR$ = " RAM " THEN GOSUB 1400:C = 1:R = 13: GOSUB 2810
2523 IF TW$ = " RAM " THEN GOSUB 1400:C = 2:R = 13: GOSUB 2810
2524 GOTO 2531
2525 AD = 8192: GOSUB 1400: IF RT$ = "" THEN GOTO 4000
2530 C = 0:R = 9: GOSUB 2810
2531 AD = 512:R = 15: GOSUB 2535
2532 AD = 2048:R = 11: GOSUB 2535
2533 AD = 16384:R = 7: GOSUB 2535
2534 GOTO 2565
2535 GOSUB 1200: IF RT$ = "" THEN GOTO 4000
2540 TR$ = RT$: GOSUB 1300: IF RT$ = "" THEN GOTO 4000
2545 TW$ = RT$: GOSUB 2710: IF TR$ = TW$ THEN C = 0: GOSUB 2810: RETURN
2550 C = 1:RT$ = TR$: GOSUB 2810
2555 C = 2:RT$ = TW$: GOSUB 2810
2560 RETURN
2561 AD = 1024:R = 13:




2565 AD = 53248:R = 4: GOSUB 2600
2570 AD = 57344:R = 2: GOSUB 2600
2600 GOSUB 1000: IF RT$ = "" THEN GOTO 4000
2605 TR$ = RT$: GOSUB 1100: IF RT$ = "" THEN GOTO 4000
2610 TW$ = RT$: GOSUB 2710: IF TR$ = TW$ THEN C = 0: GOSUB 2810: RETURN
2615 GOTO 2550
2700 REM *** CLEAR DATA IN ROW
2705 REM *** PARAM R=ROW
2710 FOR I = 0 TO 2: VTAB R: HTAB CL(I): PRINT " ";: NEXT I: RETURN
2800 REM *** DISPLAY DATA IN COLUMN
2805 REM *** PARAM R=ROW, C=COL, RT$=DATA
2810 VTAB R: HTAB CL(C): PRINT RT$;: RETURN
2900 REM *** DISPLAY SOFT SWITCH VALUES
2905 INVERSE : VTAB 23: HTAB 6: PRINT P2;: HTAB 14: PRINT RR;: HTAB 23: PRINT AZ;: HTAB 33: PRINT HR;: HTAB 40: PRINT B1;
2910 VTAB 24: HTAB 6: PRINT HI;: HTAB 14: PRINT RW;: HTAB 23: PRINT S8;: HTAB 33: PRINT HW;: NORMAL : RETURN
4000 VTAB 1: PRINT "ERROR"
5000 DATA 6,17,28,39
5010 DATA 1,3,5,6,8,10,12,14,16,18


You can view the differenced with ExamDiff.

BTW, could you add some instructions? I ran these in AppleWin, pressing all the highlighted letters and I did not see any changes on the display screen. What is this program supposed to do exactly? I ask, not having looked at the code much.

Anthony Ortiz

unread,
Nov 7, 2017, 10:08:35 PM11/7/17
to
> BTW, could you add some instructions? I ran these in AppleWin, pressing all the highlighted letters and I did not see any changes on the display screen. What is this program supposed to do exactly? I ask, not having looked at the code much.

Hi James,

The BASIC program I wrote displays a map of the Apple II memory from $0000 to $FFFF. The bottom part of the screen displays the soft-switches that activates certain parts of memory, and the highlighted letters are the keys you're supposed to press to toggle them between 0 and 1. As you toggle the soft-switches you should see the memory map update with text indicating whether that region is RAM, ROM, or AUX.

I have been able to run this program just fine from AppleWin and Michael has had success as well, so I have no idea why it would not be responding to your keypresses. Does anyone have any idea why he would be experiencing this?

Anthony

James Davis

unread,
Nov 8, 2017, 3:47:16 AM11/8/17
to
They work now!

The first time I ran them in AppleWin, I set 80 columns with PR#3 then loaded, listed, and ran them. One line in each listing had glitches (strange characters at the end of the line). The glitches are not in the CiderPress extracts.

This time I just typed ]RUN HELLO and they worked in 40 columns.

They did not work under ProDOS. Pasted text, listed, and ran. Out of data?/memory?/something error.

Brian Patrie

unread,
Nov 8, 2017, 4:29:21 AM11/8/17
to
On 2017-11-07 00:13, Anthony Ortiz wrote:
> Here's a link to version 2 : https://drive.google.com/open?id=1ysZVnjmfS-Qfgpi5jtjKn1b_npLridJU

I added a little friendliness for 80-column users:

force 40-columns during run:
2230 HOME : PRINT CHR$(17); : GOSUB 2050

And return to 80-columns when done
2468 IF K$ = CHR$(27) THEN HOME : PRINT CHR$(18); : END

Anthony Ortiz

unread,
Nov 8, 2017, 10:33:00 AM11/8/17
to
That's strange, I run this in 80 column mode and it runs fine in my version of AppleWin (1.26.1.1). It's meant for 40-column mode however so I guess I should force it to 40-col at start, but I still don't understand why this would be a problem at all as it runs on mine in either mode.

James Davis

unread,
Nov 8, 2017, 12:12:28 PM11/8/17
to
On Wednesday, November 8, 2017 at 7:33:00 AM UTC-8, Anthony Ortiz wrote:

> That's strange, I run this in 80 column mode and it runs fine in my version of AppleWin (1.26.1.1). It's meant for 40-column mode however so I guess I should force it to 40-col at start, but I still don't understand why this would be a problem at all as it runs on mine in either mode.

I ran them again in 80 column mode and they ran fine in my version of AppleWin (1.26.2.3). I did not retest 80 column mode the last time. I did not think to do it, then.

James Davis

unread,
Nov 8, 2017, 12:24:42 PM11/8/17
to
Under ProDOS, I get "?OUT OF DATA ERROR IN 2240"! Why doesn't it run under ProDOS? What is the difference between ProDOS Applesoft and DOS Boss Applesoft?!

James Davis

unread,
Nov 8, 2017, 12:33:37 PM11/8/17
to
On Wednesday, November 8, 2017 at 9:24:42 AM UTC-8, James Davis wrote:
> Under ProDOS, I get "?OUT OF DATA ERROR IN 2240"! Why doesn't it run under ProDOS? What is the difference between ProDOS Applesoft and DOS Boss Applesoft?!

This "*** PRINT SOFT SWITCHES ***" subroutine looks recursive. Must be running out of data space!

Anthony Ortiz

unread,
Nov 8, 2017, 12:55:35 PM11/8/17
to
Hi James,

You seem to be getting many errors that we're not getting; I'm assuming this is due to an incorrect xfer. The soft-switch section is just a sub-routine with a return at the end.

How are you running the program? What I do is I load the dsk in drive 1, restart via AppleWin, and when it finished booting I type in "RUN HELLO" and it runs fine.

Anthony

James Davis

unread,
Nov 8, 2017, 3:17:07 PM11/8/17
to
For me, it runs fine booting DOS BOSS and running Hello, just like you do, in 40 or 80 column modes. But, I am just running it in AppleWin. I have not succeeded in getting ADT to work for me yet, so I am not transferring anything to my real Apple II hardware yet, either.

The error occurs when I try to run it in Applesoft on AppleWin under ProDOS. What I do, is copy the Hello listing from within WordPad that I extracted with CiderPress and paste it into Applesoft under ProDOS, list it, save it, and/or just run it. Then I get the error message, "?OUT OF DATA ERROR IN 2240"!

Next, since copy and paste isn't working, I will try using CiderPress to un-extract it onto my HDD image and see if that works. I'll report back to you later about my results. I suspect that the paste is not working because of lines of code getting split into 2 or more lines with carriage returns.

Anthony Ortiz

unread,
Nov 8, 2017, 3:23:16 PM11/8/17
to
Ahhh, I believe something is going on during the copy and paste. In that case there's no need to run it on your Apple II. This program is just so that people can confirm that the soft-switch logic is working correctly. Thanks James!

Michael 'AppleWin Debugger Dev'

unread,
Nov 8, 2017, 6:08:26 PM11/8/17
to
On Wednesday, November 8, 2017 at 12:17:07 PM UTC-8, James Davis wrote:
> The error occurs when I try to run it in Applesoft on AppleWin under ProDOS. What I do, is copy the Hello listing from within WordPad that I extracted with CiderPress and paste it into Applesoft under ProDOS, list it, save it, and/or just run it. Then I get the error message, "?OUT OF DATA ERROR IN 2240"!

The program works just fine under ProDOS.

The BUG is caused by line 2210 being more then 256 characters. Remove the superfluous spacing and it will work.

i.e.

James Davis

unread,
Nov 8, 2017, 8:29:48 PM11/8/17
to
On Wednesday, November 8, 2017 at 12:17:07 PM UTC-8, James Davis wrote:
The BUG for copy/paste is long lines as Michael P. ('AWDD') said, but there is another BUG in line 2561 of the "Hello" program on the second DOS BOSS disk image I downloaded.--[Note the gap between lines 2561 and 2565 in the listing above (in a prior posting).]--ExamDiff shows the 3 invisible characters at the end of this line. They are after the last colon, and each looks like a lowercase "o" with a tangential arrow pointing up at a 45° angle to the right above it (the symbol for the male sex). I was able to fix this BUG by retyping the line without the ending colon, then re-saving the program. Before the fix, the program would load in ProDOS, but it would not run, nor would it list properly.--It inverted the display to white with black lettering and never stopped listing, essentially hanging AppleWin. Besides this BUG FIX, I was able to copy the programs from the DOS BOSS disk images to a ProDOS disk image (Anthony's.Stuff.PO) using CiderPress (to create the PO disk and to copy the programs, "HELLO1" & "HELLO2"). NOW, They run fine from ProDOS, too.

Brian Patrie

unread,
Nov 8, 2017, 8:36:29 PM11/8/17
to
Yeah, it runs fine in 80-column mode; it just looks a little silly,
being all over on one side of the screen. :)

Anthony Ortiz

unread,
Nov 8, 2017, 8:41:05 PM11/8/17
to
That line ending in a colon can be removed; it was something I started but ended up doing it somewhere else. I see that may have caused issues with ciderpress.

James Davis

unread,
Nov 8, 2017, 8:45:05 PM11/8/17
to
Yeah, but it would look cool if Anthony could show some Hi/Lo-Res graphics and text pages on the right half and how they are affected by the soft switches.
Message has been deleted

James Davis

unread,
Nov 8, 2017, 8:51:08 PM11/8/17
to
On Wednesday, November 8, 2017 at 5:41:05 PM UTC-8, Anthony Ortiz wrote:

> That line ending in a colon can be removed; it was something I started but ended up doing it somewhere else. I see that may have caused issues with ciderpress.

And with Applesoft under ProDOS!
Message has been deleted

James Davis

unread,
Nov 8, 2017, 9:03:51 PM11/8/17
to
Type in "D", "T", "R", and you are reading from RAM and writing to ROM in the top 12/16k of bank switched memory. Isn't writing to ROM impossible, or is it RAM in a slot?

James Davis

unread,
Nov 8, 2017, 9:28:09 PM11/8/17
to
Why did you leave out the slot ROM/RAM $C800~$CFFF space? Not because it is bank 1, I hope.--Hmmm, is it bank 1?--Confused again. IIRC, the A2E TRM also shows it below in one or two of the memory space columns in one or two of their diagrams.

You should show the soft switches in "the space between" (where they really are) rather than at the bottom of the page ("TRADITION"--Fiddler on the Roof). :-)

Anthony Ortiz

unread,
Nov 8, 2017, 10:08:50 PM11/8/17
to
On Wednesday, November 8, 2017 at 9:28:09 PM UTC-5, James Davis wrote:
> Why did you leave out the slot ROM/RAM $C800~$CFFF space? Not because it is bank 1, I hope.--Hmmm, is it bank 1?--Confused again. IIRC, the A2E TRM also shows it below in one or two of the memory space columns in one or two of their diagrams.
>
> You should show the soft switches in "the space between" (where they really are) rather than at the bottom of the page ("TRADITION"--Fiddler on the Roof). :-)

I didn't include that because the IO region doesn't get bank switched. The purpose of this program is to have a visual map of the bank-switched regions of the Apple II and the effect of the bank-switch soft-switches.

Michael 'AppleWin Debugger Dev'

unread,
Nov 9, 2017, 2:36:06 PM11/9/17
to
Hey Anthony

I really like were you are going with this.

One thing you might want to consider for the future is to

a) make it more data-driven along with a
b) (pardon the pun) basic MVC (View Model Controller) paradigm.

These two greatly simplifies the code. More on this in a bit.

I haven't (yet) had a chance to play around with your version 2 but you might be interested in the following:

BASIC gets a lot of crap for being a shitty programming language, and some of it is definitely justified, but inspired by your initial implementation I threw together a clean re-engineered version that:

a) Is data-driven
b) Shows HGR page 2, and TEXT page 2 memory spaces
c) Shows which page 1 / page 2 is visible via a "*" indicator on the right edge
d) Can toggle the address at the bottom status bar via SPACE BAR
e) Designated Language Card RAM from normal RAM, via RAM L/C, RAM B1, RAM B2
f) ESC quits

Source, Picture, Bootable ProDOS disk are available:
https://github.com/Michaelangel007/apple2_softswitch


Earlier I mentioned that we can simplify the code.

a) Use a state var S() to keep track of the 9 soft-switches states. I also use S("RESET") = S(10) to show the label descriptions or IO soft switch addresses.
b) Combine the soft switches into an enumerated bit mask. i.e. Z = sw2*4 + sw1*2 + sw0 paradigm.
c) Throw all the static text into an array

Examples:

350 Z=2*HI+P2*(1-S8)+1:REM 80STORE=1 MAKES PAGE2 BANK IN AUX
360 Y=10:C$=" *":GOSUB 9:REM G=1 P=1
370 Y=12:C$=" * ":GOSUB 9:REM G=1 P=0
380 Y=16:C$=" * ":GOSUB 9:REM G=0 P=1
390 Y=18:C$="* ":GOSUB 9:REM G=0 P=0
400 Y=2:Z=HR*4 + HW*2 + B1:X=INT(Z/2):REM *** $E000
410 IF X=0 THEN U=SPC:V=ROM:W=RLC
420 IF X=1 THEN U=ROM:V=SPC:W=SPC
430 IF X=2 THEN U=RLC:V=SPC:W=SPC
440 IF X=3 THEN U=SPC:V=RLC:W=ROM

You've noticed that I'm using short symbol names for the array index to specify which text should be displayed to make the code more readable. It sucks that Applesoft only checks the first 2 characters of variable names but C'est la vie. Or as Antoine might say: Tabernac Appelsoft. :-)

Let me know if you have any questions.

NOTE: I haven't double checked what addresses you are using for HRAMRD and RRAMWRT'.

Cheers
M.







Michael 'AppleWin Debugger Dev'

unread,
Nov 9, 2017, 2:49:48 PM11/9/17
to
On Wednesday, November 8, 2017 at 7:08:50 PM UTC-8, Anthony Ortiz wrote:
> On Wednesday, November 8, 2017 at 9:28:09 PM UTC-5, James Davis wrote:
> > Why did you leave out the slot ROM/RAM $C800~$CFFF space? Not because it is bank 1, I hope.--Hmmm, is it bank 1?--Confused again. IIRC, the A2E TRM also shows it below in one or two of the memory space columns in one or two of their diagrams.
> >
> > You should show the soft switches in "the space between" (where they really are) rather than at the bottom of the page ("TRADITION"--Fiddler on the Roof). :-)

I agree with Anthony's initial compact design. With only 24 lines of text there just isn't enough room to show the switches in the correct location.

> I didn't include that because the IO region doesn't get bank switched.

At the risk of being pedantic, that's not "entirely" accurate. Peripherals can/may bank in their own firmware @ $C800..$CFFF but that is neither here nor there.

The UI itself doesn't let us access any peripheral soft switches so what would be gained by this? Nothing visually would change. :-)

James, maybe you want to throw together an 80-col version?

> The purpose of this program is to have a visual map of the bank-switched regions of the Apple II and the effect of the bank-switch soft-switches.

Agreed.

I'm not sure why James is complaining ... with only 24 lines of text there is no room to show the $Cx00 space -- especially with my version that shows HGR2, and TEXT2 memory spaces.

Anthony Ortiz

unread,
Nov 9, 2017, 2:54:37 PM11/9/17
to
Awesome sauce! Can't wait to get home to try it out! As I said before, this was just a quick and dirty disposable program just to confirm whether my understanding was correct and not something I wanted to spend time on, but if you guys find it useful please feel free to run with it! Adding the ramworks bank counter should be easy and worth doing. I wonder if there are any other switches that should be added. Eventually it would be nice to add a IIgs mode or fork.

Anthony Ortiz

unread,
Nov 9, 2017, 3:35:54 PM11/9/17
to
Yup, knew you were going to get pedantic on me, lol. I don't consider the peripheral firmware to be bank switching since that's outside of our control and as you said, visually it doesn't do anything interesting to deserve displaying.

Anthony Ortiz

unread,
Nov 9, 2017, 7:25:19 PM11/9/17
to
> BASIC gets a lot of crap for being a shitty programming language, and some of it is definitely justified, but inspired by your initial implementation I threw together a clean re-engineered version

Hey this looks great! You just need to fix it so that Read and Write are empty and RW populated when RAM or AUX is set to both Read and Write; High Ram (LC) is working fine however.

Very nice!

Anthony Ortiz

unread,
Nov 9, 2017, 7:41:49 PM11/9/17
to
Ahhh, I think some of the logic got messed up during the translation. 80Store doesn't seem to have an effect, AltZP not affecting HighRam/ROM region, 0-1FF should not be affected by RAMRD/RAMWRT and should instead be set to AUX if AltZP is set and RAM if not set. That is, if I understand it correctly.

Michael 'AppleWin Debugger Dev'

unread,
Nov 9, 2017, 8:53:00 PM11/9/17
to
On Thursday, November 9, 2017 at 4:41:49 PM UTC-8, Anthony Ortiz wrote:
> Ahhh, I think some of the logic got messed up during the translation.

There definitely could be bugs. I based it off your org. ver 1, but it is possible I missed some edge cases.

> 80Store doesn't seem to have an effect,

It was my understanding that Page 2 needs to be active to bank in AUX ram when 80STORE is on.

Is 80STORE supposed to do something else?


> AltZP not affecting HighRam/ROM region,

It is supposed to? According to The //e Technical Manual, Chapter 4, Memory Organization, Page 84:

ALTZP, W, $C008: Off: use main bank, page 0, and page 1
AZTZP, W, $C009, On: use aux bank, page 0, and page 1

Where are you seeing that it it effects High RAM/ROM ?


> 0-1FF should not be affected by RAMRD/RAMWRT and should instead be set to AUX if AltZP is set and RAM if not set. That is, if I understand it correctly.

Ah, yes, that's definitely a bug! I've updated the repo. but to fix locally change line 680 so there is only 1 gosub.

680 Y=21:U=RAM:V=RAM:W=RAM:GOSUB 1:REM $0000

Anthony Ortiz

unread,
Nov 9, 2017, 9:16:36 PM11/9/17
to
> There definitely could be bugs. I based it off your org. ver 1, but it is possible I missed some edge cases.

Run version 2 of mine since it contains a fix to the bug you mentioned regarding ramrd and ramwrt.


> > 80Store doesn't seem to have an effect,
>
> It was my understanding that Page 2 needs to be active to bank in AUX ram when 80STORE is on.
>
> Is 80STORE supposed to do something else?

Sathers page 5-25 bottom left last two paragraphs : If 80Store is set, RAMRD and RAMWRT do not affect $400-$7FF, and if 80Store and HIRES are both set, RAMRD and RAMWRT do not affect $400-$7FF or $2000-$3FFF.

It continues for a few more paragraphs with more logic associated with 80Store.

> > AltZP not affecting HighRam/ROM region,
>
> It is supposed to? According to The //e Technical Manual, Chapter 4, Memory Organization, Page 84:
>
> ALTZP, W, $C008: Off: use main bank, page 0, and page 1
> AZTZP, W, $C009, On: use aux bank, page 0, and page 1
>
> Where are you seeing that it it effects High RAM/ROM ?

Sathers page 5-25 middle of right column : ALTZP switches the $0-$1FF range and, if High Ram is enabled, the $D000 - $FFFF range betw. mobo RAM and aux RAM.

However, it could be that I'm interpreting this all incorrectly, hence the reason for my program in the first place!

Would one of you veterans lend a hand here and run version 2 of my BASIC program (https://drive.google.com/open?id=1ysZVnjmfS-Qfgpi5jtjKn1b_npLridJU) and verify that it's correct? This way we can use it as a basis for Michael's new and improved version.

Thanks!

Anthony

Michael 'AppleWin Debugger Dev'

unread,
Nov 9, 2017, 9:29:58 PM11/9/17
to
On Thursday, November 9, 2017 at 4:25:19 PM UTC-8, Anthony Ortiz wrote:
> > BASIC gets a lot of crap for being a shitty programming language, and some of it is definitely justified, but inspired by your initial implementation I threw together a clean re-engineered version
>
> Hey this looks great!

Thanks! There was JUST enough room to squeeze in HGR2 and TEXT2!

> You just need to fix it so that Read and Write are empty and RW populated when RAM or AUX is set to both Read and Write; High Ram (LC) is working fine however.

Actually that's something I've been meaning to ask you -- where are there 3 columns? Isn't the 1st "RW" column redundant? I mean it helps fill the screen out for a pleasing aesthetic balance but is it really needed?

But OK, I've added a version number to line 0, along with adding the whitespace back into the R and W columns if RAMRD and RAMWRT are both enable, (or both off) to visually match your original version.


Anthony Ortiz

unread,
Nov 9, 2017, 9:41:04 PM11/9/17
to
You know, it really isn't necessary as Read and Write columns already exist, I just included it because if something is both Read and Write I didn't want it visually split up as people tend to visualize the memory map as one contiguous region, not as multiple regions, and that the only time when they're going to think of it as multiple regions is when those regions are actually being banked. That being said you have a point about it being redundant so I guess it doesn't matter, whatever your preference is... perhaps it will open up space for other stuff.

qkumba

unread,
Nov 9, 2017, 10:27:30 PM11/9/17
to
> > ALTZP, W, $C008: Off: use main bank, page 0, and page 1
> > AZTZP, W, $C009, On: use aux bank, page 0, and page 1
> >
> > Where are you seeing that it it effects High RAM/ROM ?
>
> Sathers page 5-25 middle of right column : ALTZP switches the $0-$1FF range and, if High Ram is enabled, the $D000 - $FFFF range betw. mobo RAM and aux RAM.

If RAM isn't banked in (e.g. C080, C083, etc) then $C009 has no effect - you still see ROM as before.

James Davis

unread,
Nov 9, 2017, 10:39:32 PM11/9/17
to
I was not complaining, I was merely making suggestions. In Anthony's Hello #1 & #2, there are 4 unused lines near the bottom of the screen above the soft-switches on the bottom two lines. I was thinking they could be moved up to the $C000-$CFFF gap along with the soft-switches on the bottom two lines and then they would represent the actual area where the soft-switches really are in the memory map, with the blank lines being filled in with blocks for the missing 4k address space, so that from top to bottom the diagram represents the whole 64k.

The reason for bank 1 is as a substitute for accessing the missing/unaccessible 4k in the top 16k of the whole 64k 6502 memory address space in Auxiliary memory cards. This is shown in the A2E TRM on some of their memory map diagrams, and explained in the text.

Michael 'AppleWin Debugger Dev'

unread,
Nov 9, 2017, 10:40:34 PM11/9/17
to
> Sathers page 5-25 bottom left last two paragraphs : If 80Store is set, RAMRD and RAMWRT do not affect $400-$7FF, and if 80Store and HIRES are both set, RAMRD and RAMWRT do not affect $400-$7FF or $2000-$3FFF.

Right, that's why I have this line:

350 Z=2*HI+P2*(1-S8)+1:REM 80STORE=1 MAKES PAGE2 BANK IN AUX

My understanding is that 80STORE=1, PAGE=2, means $400..$7FF = aux, and $2000..$3FFF = aux (regardless of RAMWR, RAMWRT)

I guess the question is, what bank is $400..$7FF supposed to be when 80STORE=1, but PAGE2=0 ? It should be MAIN, right? If so, then yeah, I have a bug.

> Run version 2 of mine since it contains a fix to the bug you mentioned regarding ramrd and ramwrt.

Ah, yes, OK, you have the fixed version.

80STORE=1
PAGE2=0
RAMRD=1 <-- ignored because 80STORE=1

Alright, version 4 is up. Updated source, screenshots, and disk image.

* Fixed proper bank display for HGR1, and TEXT1, when 80STORE=1
* Added v4 to top left
* Cleaned up showing too many memory address



Michael 'AppleWin Debugger Dev'

unread,
Nov 9, 2017, 10:59:24 PM11/9/17
to
On Thursday, November 9, 2017 at 7:39:32 PM UTC-8, James Davis wrote:
> I was not complaining, I was merely making suggestions.

OK, fair enough.

> In Anthony's Hello #1 & #2, there are 4 unused lines near the bottom of the screen above the soft-switches on the bottom two lines. I was thinking they could be moved up to the $C000-$CFFF gap along with the soft-switches on the bottom two lines and then they would represent the actual area where the soft-switches really are in the memory map, with the blank lines being filled in with blocks for the missing 4k address space, so that from top to bottom the diagram represents the whole 64k.

I'd rather see HGR1 and TEXT2 in my version, but I guess that could work. I'd still like to see a mockup so I can see the strength/weaknesses of how it compares/contrasts with Anthony's (or my) version.

Right now we have a consistent 22 lines, and 2 status lines. I have qualms putting the IO switches in the logical place right smack dab in the middle of the memory map will clutter it up (too much.)

> The reason for bank 1 is as a substitute for accessing the missing/unaccessible 4k in the top 16k of the whole 64k 6502 memory address space in Auxiliary memory cards. This is shown in the A2E TRM on some of their memory map diagrams, and explained in the text.

Anthony and I already know that -- not sure what you are getting at here though aside from the "L" shape for $D000..$FFFF ?

Anthony Ortiz

unread,
Nov 9, 2017, 11:01:46 PM11/9/17
to
Hey Qkumba! This seems contrary to what Sather's is saying as I've already quoted above. He claims that 'ALTZP switches the $0-$1FF range' without any further conditions, then states 'if High Ram is enabled, the $D000 - $FFFF range betw. mobo RAM and aux RAM.' Are you saying Sather's is wrong about this, or perhaps I'm misunderstanding this somehow?

Thanks!

Anthony Ortiz

unread,
Nov 9, 2017, 11:10:20 PM11/9/17
to
Hi James!

Yeah, I left some space at the bottom for future expansion. I didn't put in the IO area as it was pointless using up real-estate for it since none of the switches would affect that area at all, it would just be taking up space. I also thought that I would add some more soft-switches at some later point, such as the RamWorks bank counter and perhaps some IIgs specific switches when in IIgs mode.

Regarding bank 1, yes, that serves as a substitute. In my program you can switch banks with the B key and it will display B1 or B2.

If you have any ideas or enhancement post a mockup so we can see a visual, or modify the program yourself and post a version that we can check out.

Cheers!

Anthony

Michael 'AppleWin Debugger Dev'

unread,
Nov 9, 2017, 11:17:06 PM11/9/17
to
On Thursday, November 9, 2017 at 6:41:04 PM UTC-8, Anthony Ortiz wrote:
> I just included it because if something is both Read and Write I didn't want it visually split up as people tend to visualize the memory map as one contiguous region, ...

Gotcha.

> That being said you have a point about it being redundant so I guess it doesn't matter, whatever your preference is... perhaps it will open up space for other stuff.

One thing I could see by removing it is that it opens up an "exploded" or "zoomed" view.

i.e. Here is a mockup (use a monospaced/non-proportional font)

v4 ___READ___ __WRITE___
$FFFF| ROM | ROM | C088 BANK2
$E000|__________|__________| /C081 HRAMWRT
| ROM | ROM | / C080 HRAMRD
$D000|__________|__________|/ C057 HIRES
:__________:__________: C055 PAGE2
$BFFF| AUX | AUX |\ C008 ALTZP
$6000|__________|__________| \ C004 RAMWRT
| AUX | AUX | \C002 RAMRD
$4000|__________|__________| C000 80STORE

The lines are > 40 cols but that is only because I'm including both the Description and Address.

Space could toggle showing one or the other on 40-cols.
On 80-cols both could be shown.

This would free up the bottom 2 rows -- but honestly, I'm not sure what you would use it for?


Anthony Ortiz

unread,
Nov 9, 2017, 11:19:59 PM11/9/17
to
You know, given what you're saying, James may have a point about 80 columns... perhaps we could split the map into two in 80 column mode, doubling the real estate and the ability to display the data you're suggesting?

Michael 'AppleWin Debugger Dev'

unread,
Nov 9, 2017, 11:33:30 PM11/9/17
to
On Thursday, November 9, 2017 at 8:19:59 PM UTC-8, Anthony Ortiz wrote:
> You know, given what you're saying, James may have a point about 80 columns... perhaps we could split the map into two in 80 column mode, doubling the real estate and the ability to display the data you're suggesting?

I'm happy with the 40-col version and need to get back to other projects so I'll let you guys hash out future versions.

That said, I could see a "crème de la crème" version that:

- detects if you are in 40-col or 80-col mode at startup, and
- shows the appropriate table / hotkeys / descriptions

Best of both worlds. Resistance is Futile. Oh wait, we aren't talking about ST:TNG. :-)

The data should already be there, just need to:

- add global var that holds the 40/80 mode
- update the display logic to show extra info in 80-col

M.

Anthony Ortiz

unread,
Nov 9, 2017, 11:44:17 PM11/9/17
to
You're right about the other projects; that's why I didn't want to spend much time on the code, I just wanted to use it to verify the logic so I can get on with my real project, lol. Unfortunately it still hasn't served it's purpose, I have no idea whether the logic is correct or not and it seems Qkumba has uncovered something.

James Davis

unread,
Nov 10, 2017, 2:11:38 AM11/10/17
to
You could verify where you are reading or writing by peeking and/or poking & peeking unique data bytes in each area. Use the ID bytes for ROM and put something unique in RAM that will change from reading MAIN/AUX or Bank1/Bank2 or RAM/ROM, etc. Then re-examine them differently somehow. Don't ask me how; I'm not an Applesoft programmer anymore; it has been too long since I programmed anything. I'm just an "Idea Man," a generalist.


James Davis

unread,
Nov 10, 2017, 2:15:12 AM11/10/17
to
Nice mockup!

qkumba

unread,
Nov 10, 2017, 10:50:43 AM11/10/17
to
Hi Anthony,

> Hey Qkumba! This seems contrary to what Sather's is saying as I've already quoted above. He claims that 'ALTZP switches the $0-$1FF range' without any further conditions, then states 'if High Ram is enabled, the $D000 - $FFFF range betw. mobo RAM and aux RAM.' Are you saying Sather's is wrong about this, or perhaps I'm misunderstanding this somehow?

No, Sather is correct. On a write to $C009, ZP and stack will switch to aux, and that effect will be visible immediately. The banked RAM will also switch from main to aux, but you won't be able to see it unless you actually bank it in.
Message has been deleted

James Davis

unread,
Nov 10, 2017, 1:06:56 PM11/10/17
to
Qkumba,

When you say, "bank" as in:

"If RAM isn't banked in (e.g. C080, C083, etc) then $C009 has no effect - you still see ROM as before."

and:

"but you won't be able to see it unless you actually bank it in."

do you really mean "switched" as in "switched in"?

James Davis

Michael 'AppleWin Debugger Dev'

unread,
Nov 10, 2017, 2:08:14 PM11/10/17
to
@qkumba Thanks for the clarification of $C009! OK, so using $C008/$C009 is the only way to access MAIN/AUX LC RAM -- that makes perfect sense now.

I think part of the confusion comes from incomplete online docs.
i.e. Kreative Korps is wrong.
http://www.kreativekorp.com/miscpages/a2info/iomemory.shtml
C008 49160 SETSTDZP ECG W Main Stack and Zero Page
C009 49161 SETALTZP ECG W Aux Stack and Zero Page

Where as Jamtronix is correct:
http://www.jamtronix.com/blog/2007/06/11/apple-e-soft-switch-status-and-other-io-locations/
$C008 W ALZTPOFF Enable main memory from $0000-$01FF & avl BSR
$C009 W ALTZPON Enable aux memory from $0000-$01FF & avl BSR


@Anthony
I was confused too about ALTZP until qkumba set the light bulb off mentioning High RAM.
I read David Empson's excellent FAQ which cleared things up.
128K Apple IIe Memory Map
http://apple2.org.za/gswv/a2zine/faqs/R032MMAP128.TXT


To make sure I understood how STDZP and ALTZP effect High RAM I threw together this program so you can visually see what is going on:
https://github.com/Michaelangel007/apple2_softswitch/blob/master/test.lc.s
I've updated the softswitch.po virtual disk with the binary: TEST.LC

The first text line display are the original values of LC Aux, LC Main, LC ROM @ $FDB4
Next we poke in A into LC Aux, and M into LC Main.
The second text line displays the unique values we read from Aux, Main, and ROM of LC respectively

0300:8D 00 C0 A2 7C 8D 02 C0
0308:8D 05 C0 BD 00 03 9D 00
0310:03 CA D0 F7 8D 82 C0 AD
0318:B4 FD 8D 04 C0 8D 02 04
0320:AD 83 C0 AD 83 C0 A2 C1
0328:A0 CD 8D 09 C0 AD B4 FD
0330:8D 00 04 8E B4 FD 8D 08
0338:C0 AD B4 FD 8D 01 04 8C
0340:B4 FD 8D 09 C0 AD B4 FD
0348:8D 80 04 8D 08 C0 AE B4
0350:FD 8E 81 04 8D 82 C0 8D
0358:09 C0 AC B4 FD 8C 82 04
0360:AD 83 C0 AD 83 C0 AE 00
0368:04 AC 01 04 8E B4 FD 8D
0370:08 C0 8C B4 FD 8D 82 C0
0378:8D 01 C0 60

Michael 'AppleWin Debugger Dev'

unread,
Nov 10, 2017, 2:10:22 PM11/10/17
to
James,

The vernacular all means the same thing.

"switch" = "switched in" = "banked in" = "banked"

A bunch of us get lazy having to type "in all the time. :-)

Michael 'AppleWin Debugger Dev'

unread,
Nov 10, 2017, 2:40:28 PM11/10/17
to
Anthony you'll probably want to single-step through the below code in AppleWin's debugger.

F7
BPX 300
MD1 FDB4
<space>
BPC
F7


Getting rid of the left-over AUXMOVE cruft ...

0300:8D 82 C0 AD B4 FD 8D 02
0308:04 AD 83 C0 AD 83 C0 A2
0310:C1 A0 CD 8D 09 C0 AD B4
0318:FD 8D 00 04 8E B4 FD 8D
0320:08 C0 AD B4 FD 8D 01 04
0328:8C B4 FD 8D 09 C0 AD B4
0330:FD 8D 80 04 8D 08 C0 AE
0338:B4 FD 8E 81 04 8D 82 C0
0340:8D 09 C0 AC B4 FD 8C 82
0348:04 AD 83 C0 AD 83 C0 AE
0350:00 04 AC 01 04 8E B4 FD
0358:8D 08 C0 8C B4 FD 8D 82
0360:C0 60

Anthony Ortiz

unread,
Nov 10, 2017, 2:48:47 PM11/10/17
to
Qkumba and Michael : I'm confused; this is exactly the way my program is behaving. Try setting the altzp switch and bank things in and out via ramrd and ramwrt. I'm still at work so I can't run your updated program Michael but will do when I get home.

I am Rob

unread,
Nov 10, 2017, 3:25:52 PM11/10/17
to
On Friday, November 10, 2017 at 1:48:47 PM UTC-6, Anthony Ortiz wrote:
> Qkumba and Michael : I'm confused; this is exactly the way my program is behaving. Try setting the altzp switch and bank things in and out via ramrd and ramwrt. I'm still at work so I can't run your updated program Michael but will do when I get home.


Maybe I can throw another thought process to try to clarify things.

$C073 only sets $200.BFFF to the 64 kb of the Ramworks card.
RAMRD and RAMWRT $C002.C005 allow reading from the current bank of Ramworks from $0200.BFFF.

So as to not to confuse things, the Language Card Banks will be called LC pages 1 and 2 (instead of banks, as this may get confused with Ramworks banks)

$C008 switches in Main LC, ZP and stack. The LC softswitches then read and write according to their rules to the Main LC.

$C009 switches in the Ramworks LC, ZP and stack of the bank that is now in effect set by $C073. The same rules apply to the softswitches that affect the Main LC, but are now used with Aux Mem's LC.

The LC uses softswitches $C080.c083 for LC page two (or LC bank2 if you prefer) and $C084.C087 for LC page one (or LC bank1).

Michael 'AppleWin Debugger Dev'

unread,
Nov 10, 2017, 3:33:14 PM11/10/17
to
> qkumba Michael : I'm confused; this is exactly the way my program is behaving

@Anthony OK, I just double-checked your v2 program, given how $C009 is supposed to work, and it looks to be correct for all the High RAM Read/Write and ALTZP permutations.

Sorry for any confusion!

i.e.
HRAMDR=1
HRAMWRT'=0
ALTZP=0 --> r/w LC RAM and LC B2

HRAMDR=1
HRAMWRT'=0
ALTZP=1 --> r/w LC AUX and LC B2

HRAMDR=0
HRAMWRT'=1
ALTZP=don't care --> ROM

HRAMDR=0
HRAMWRT'=0
ALTZP=0 --> read ROM, write LC RAM and LC B#

HRAMDR=0
HRAMWRT'=0
ALTZP=1 --> read ROM, write LC AUX and LC B#


I still have a bug in mine so v5 will be coming later today or tomorrow ...

I am Rob

unread,
Nov 10, 2017, 3:43:03 PM11/10/17
to
> $C073 only sets $200.BFFF to the 64 kb of the Ramworks card.
> RAMRD and RAMWRT $C002.C005 allow reading from the current bank of Ramworks from $0200.BFFF.


My first line may needs some clarification.

$C073 only sets the 64kb bank of the Ramworks card. Starting at zero, which is the 64 kb Aux bank that all 128 kb machines would normally have, and one (1) being the first bank of the Ramworks card up to $FF.

$C002.C005 affects the area of memory from $0200.BFFF of the bank set by $C073.

$C008.C009 affects the area of $0000.01FF and $D000.FFFF, for the Main LC or the Aux LC bank switched in by $C073.

James Davis

unread,
Nov 10, 2017, 9:39:21 PM11/10/17
to
Yes, I know; but, we need some precision of language here to alleviate the confusion.
0 new messages