mirror of
https://github.com/Michaelangel007/apple2_softswitch.git
synced 2025-01-08 05:30:14 +00:00
Initial version
This commit is contained in:
commit
c31ab0387f
16
README.md
Normal file
16
README.md
Normal file
@ -0,0 +1,16 @@
|
||||
# Apple 2 Soft Switch
|
||||
|
||||
Inspired by Anthony's program here is a Applesoft BASIC program to display a memory map and limited soft switches.
|
||||
|
||||
![Screenshot](pics/screenshot.png)
|
||||
|
||||
# Commands
|
||||
|
||||
* ESC = exit
|
||||
* SPC = toggle status lines to show description / soft-switch addresss
|
||||
|
||||
NOTE: The IO soft switch address don't exactly match the hardware switches due to:
|
||||
|
||||
a) some are contiguous
|
||||
b) some require multiple locations to activate (i.e. TEXT/GR and Lo-Res/Hi-Res)
|
||||
|
BIN
pics/screenshot.png
Normal file
BIN
pics/screenshot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
128
softswitch.bas
Normal file
128
softswitch.bas
Normal file
@ -0,0 +1,128 @@
|
||||
0 TEXT:PRINT CHR$(21):HOME:GOTO 80
|
||||
1 IF AZ THEN U=AUX:V=SPC:W=SPC:REM ALT ZP
|
||||
2 VTAB Y:HTAB 7:? B$(U);:HTAB 18:? B$(V);:HTAB 29:? B$(W);:RETURN:REM COLS RW/R/W
|
||||
3 IF RR OR RW THEN U=SPC:REM AUX MEM
|
||||
4 V=RAM:IF RR THEN V=AUX
|
||||
5 W=RAM:IF RW THEN W=AUX
|
||||
6 RETURN
|
||||
7 IF S8 AND P2 THEN U=AUX:R=AUX:W=AUX
|
||||
8 GOSUB 2:RETURN
|
||||
9 VTAB Y:HTAB 40:PRINT MID$(C$,Z,1):RETURN
|
||||
10 L$="":R$="":Z$=T$(I):U=H(I):V=LEN(Z$):M$=MID$(Z$,U,1):IF S(10) THEN R$=T$(I+D):GOTO 40:REM HOTKEY
|
||||
20 IF U-1 > 0 THEN L$=LEFT$ (Z$,U-1)
|
||||
30 IF V-U > 0 THEN R$=RIGHT$(Z$,V-U)
|
||||
40 NORMAL:PRINT L$;:INVERSE:PRINT M$;:NORMAL:PRINT R$;
|
||||
50 IF I<>10 THEN INVERSE:PRINT S(I);:NORMAL
|
||||
60 IF I<>5 AND I<>10 THEN PRINT " ";
|
||||
70 RETURN
|
||||
80 SPC=1:AUX=5:RAM=8:ROM=9:RU1=10:RV2=11:RLC=12
|
||||
90 COL=5:D=COL*2:N=COL*3:M=21:DIM K(D),T$(D*2),H(D),S(D),B$(13),A$(M),U(M)
|
||||
100 REM *** STATUS LINE
|
||||
110 FOR I=1 TO D:READ KEY$,T$(I),H(I):K(I)=ASC(KEY$):NEXT:FOR I=1 TO D:READ T$(I+D):NEXT
|
||||
120 REM *** BANKS
|
||||
130 FOR I=0 TO 12:READ B$(I):NEXT
|
||||
140 REM *** MEMORY
|
||||
150 VTAB 1:HTAB 7: ? "____RW____ ___READ___ __WRITE___"
|
||||
160 FOR I=1 TO M:READ A$(I),U(I):T=U(I)+1
|
||||
170 P$=MID$("||::",T,1):B1$=B$(T):B2$=B$(T):B3$=B$(T)
|
||||
180 VTAB I+1:HTAB 1:PRINT A$(I);P$;B1$;P$;B2$;P$;B3$;P$;:NEXT
|
||||
190 S(10)=0:REM *** RESET S(10) STATE = TOGGLE STATUS
|
||||
200 FOR I=1 TO D-1:S(I)=0:NEXT
|
||||
210 REM *** STATUS
|
||||
220 VTAB 23:HTAB 1:FOR I=1 TO D:GOSUB 10:IF I=5 THEN VTAB 24:HTAB 1
|
||||
230 NEXT
|
||||
240 REM *** DRAW MEM
|
||||
250 AZ=S(3):REM ALTZP
|
||||
260 P2=S(1):REM PAGE2
|
||||
270 S8=S(8):REM 80STORE
|
||||
280 HI=S(6):REM HIRES
|
||||
290 RR=S(2):REM RAMRD
|
||||
300 RW=S(7):REM RAMWRT
|
||||
310 HR=S(4):REM HRAMRD
|
||||
320 HW=S(9):REM HRAMWRT
|
||||
330 B1=S(5):REM BANK1
|
||||
340 REM *** WHICH PAGE VISIBLE
|
||||
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
|
||||
450 GOSUB 2
|
||||
500 Y=4:REM *** $D000
|
||||
510 IF Z=0 THEN U=SPC:V=ROM:W=RV2
|
||||
520 IF Z=1 THEN U=SPC:V=ROM:W=RU1
|
||||
530 IF Z=2 THEN U=ROM:V=SPC:W=SPC
|
||||
540 IF Z=3 THEN U=ROM:V=SPC:W=SPC
|
||||
550 IF Z=4 THEN U=RV2:V=SPC:W=SPC
|
||||
560 IF Z=5 THEN U=RU1:V=SPC:W=SPC
|
||||
570 IF Z=6 THEN U=SPC:V=RV2:W=ROM
|
||||
580 IF Z=7 THEN U=SPC:V=RU1:W=ROM
|
||||
590 GOSUB 2
|
||||
600 REM *** LOWER 48K
|
||||
610 Y= 7:U=RAM:V=SPC:W=SPC:GOSUB 3:GOSUB 2:REM $BFFF
|
||||
620 Y= 9:U=RAM:V=SPC:W=SPC:GOSUB 3:GOSUB 2:REM $4000
|
||||
630 Y=11:U=RAM:V=SPC:W=SPC:GOSUB 3:GOSUB 7:REM $2000
|
||||
640 Y=13:U=RAM:V=SPC:W=SPC:GOSUB 3:GOSUB 2:REM $0C00
|
||||
650 Y=15:U=RAM:V=SPC:W=SPC:GOSUB 3:GOSUB 2:REM $0800
|
||||
660 Y=17:U=RAM:V=SPC:W=SPC:GOSUB 3:GOSUB 7:REM $0400
|
||||
670 Y=19:U=RAM:V=SPC:W=SPC:GOSUB 3:GOSUB 2:REM $0200
|
||||
680 Y=21:U=RAM:V=RAM:W=RAM:GOSUB 3:GOSUB 1:REM $0000
|
||||
690 VTAB 1
|
||||
700 K=PEEK(49152):IF K<128 THEN 700
|
||||
710 K=K-128:POKE 49168,0:IF K = 27 THEN VTAB 1:END
|
||||
720 CMD=0:FOR I=1 TO D:IF K = K(I) THEN CMD=I:I=D:GOTO 740
|
||||
730 IF K(I) >= 64 AND K(I) <= 96 AND K=(K(I)+32) THEN CMD=I:I=D
|
||||
740 NEXT
|
||||
750 IF K = 32 THEN CMD=10:GOTO 780:REM SPACE = TOOGLE STATUS DESC/ADDR
|
||||
760 IF CMD = 0 THEN PRINT CHR$(7);:GOTO 700
|
||||
770 IF CMD = 10 THEN 200:REM RESET
|
||||
780 S(CMD)=1-S(CMD):GOTO 220:REM STATUS
|
||||
800 REM *** STATUS = KEY,TEXT,HIGHLIGHT
|
||||
810 DATA "P","PAGE2" ,1,"R","RAMRD ",4,"A","ALTZP ",1,"D","HRAMRD ",6,"B","BANK1" ,1
|
||||
820 DATA "H","HIRES" ,1,"W","RAMWRT",4,"8","80STORE",1,"T","HRAMWRT'",7,"S","RESET" ,3
|
||||
830 DATA "C054","C002 ","C008 ","C080 ","C088"
|
||||
840 DATA "C050","C004 ","C000 ","C081 "," "
|
||||
850 REM *** BANK
|
||||
860 DATA " *"
|
||||
870 DATA " "
|
||||
880 DATA "__________"
|
||||
890 DATA " "
|
||||
900 DATA "__________"
|
||||
910 DATA " AUX "
|
||||
920 DATA " AUX B1 "
|
||||
930 DATA " AUX B2 "
|
||||
940 DATA " RAM "
|
||||
950 DATA " ROM "
|
||||
960 DATA " RAM B1 "
|
||||
970 DATA " RAM B2 "
|
||||
980 DATA " RAM L/C "
|
||||
1000 REM *** LINES = ADDRESS,UNDERLINE
|
||||
1010 REM 0=| | 1=|__|
|
||||
1020 REM 2=: : 3=:__:
|
||||
1030 DATA "$FFFF",0
|
||||
1040 DATA "$E000",1
|
||||
1050 DATA " ",0
|
||||
1060 DATA "$D000",1
|
||||
1070 DATA " ",3
|
||||
1080 DATA "$BFFF",0
|
||||
1090 DATA " ",1
|
||||
1100 DATA "$5FFF",0
|
||||
1110 DATA "$4000",1
|
||||
1120 DATA "$3FFF",0
|
||||
1130 DATA "$2000",1
|
||||
1140 DATA " ",0
|
||||
1150 DATA "$0C00",1
|
||||
1160 DATA "$0BFF",0
|
||||
1170 DATA "$0800",1
|
||||
1180 DATA "$07FF",0
|
||||
1190 DATA "$0400",1
|
||||
1200 DATA " ",0
|
||||
1210 DATA "$0200",1
|
||||
1220 DATA "$01FF",0
|
||||
1230 DATA "$0000",1
|
||||
|
BIN
softswitch.po
Normal file
BIN
softswitch.po
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user