How to redirect Print output into a file

5 posts / 0 new
Last post
tokabln's picture
Offline
Last seen: 2 days 3 hours ago
Joined: Dec 30 2015 - 10:48
Posts: 172
How to redirect Print output into a file

Folks,

 

just doing some research of my Apple IIe for example trying to readout PROM content of different cards. So far the following is working as expected

REM APPLE II - Reading PROM content out of 2 x (256x4 bipolar PROM) e.g. Slot 4 -> Address $C400 => 50176dec.
1 REM $C000..C07F On Board Resources
2 REM $C080..C08F Slot 0 /DEVSEL area (16 byte register file)
3 REM $C090..C09F Slot 1 /DEVSEL area
4 REM ... repeated for Slot 2..6
5 REM $C0F0..C0FF Slot 7 /DEVSEL
6 REM $C100..C1FF Slot 1 /IOSEL area (256 bytes 'PROM')
7 REM ... repeated for Slot 2..6
8 REM $C700..C7FF Slot 7 /IOSEL area
9 REM $C800..CFFF Common area for all Slots (2 KiB 'ROM')
10 INPUT "Enter PROMSTART Addr. (decimal)";PROMSTART
20 FOR I = 0 to 255
30 A = PEEK(PROMSTART+I)
40 B = INT(A/16)
50 A$ = MID$("0123456789ABCDEF",A-16*B+1,1) + A$
60 A = B
70 IF A > 0 THEN 40
80 IF(LEN(A$)/2) > INT(LEN(A$)/2)THEN A$ = "0" + A$
90 PRINT A$
100 A$ = ""
110 NEXT I

but I’m failing to redirect the printout into a file instead of printing it to the screen.

Can someone please point me into the right direction? My programming skills a for more then 40 years gone ;-)

 

:UPDATE wrong PROM Start Address

Dog Cow's picture
Offline
Last seen: 2 weeks 3 days ago
Joined: Dec 11 2008 - 16:26
Posts: 553
You need to OPEN a file, then

You need to OPEN a file, then issue a WRITE command.

tokabln's picture
Offline
Last seen: 2 days 3 hours ago
Joined: Dec 30 2015 - 10:48
Posts: 172
Many thanks... it’s probably

Many thanks... it’s probably not the best program code but it works ;-)

0 REM APPLE II - Reading PROM content out of 2 x (256x4 bipolar PROM) e.g. Slot 4 -> Address $C400 => 50176dec.
1 REM $C000..C07F On Board Resources
2 REM $C080..C08F Slot 0 /DEVSEL area (16 byte register file)
3 REM $C090..C09F Slot 1 /DEVSEL area
4 REM ... repeated for Slot 2..6
5 REM $C0F0..C0FF Slot 7 /DEVSEL
6 REM $C100..C1FF Slot 1 /IOSEL area (256 bytes 'PROM')
7 REM ... repeated for Slot 2..6
8 REM $C700..C7FF Slot 7 /IOSEL area
9 REM $C800..CFFF Common area for all Slots (2 KiB 'ROM')
10 REM LET PROMSTART = 50176        : REM Slot #4 $C400
20 INPUT "Enter IOSEL (PROM) Startaddr. (dec)";PROMSTART
30 DSK$ =  CHR$ (4)                    : REM  ^D   

40 A$ = ""                             : REM added because of below comment from jeffmazur
50 PRINT DSK$;"OPEN PROM.BIN"
60 PRINT DSK$;"WRITE PROM.BIN";A$
70 FOR I = 0 TO 255
80 A =  PEEK (PROMSTART + I)
90 B =  INT (A / 16)
100 A$ =  MID$ ("0123456789ABCDEF",A - 16 * B + 1,1) + A$
110 A = B
120 IF A > 0 THEN 90
130 IF ( LEN (A$) / 2) >  INT ( LEN (A$) / 2) THEN A$ = "0" + A$
140 PRINT A$
150 A$ = ""
160 NEXT I
170 PRINT DSK$;"CLOSE PROM.BIN"

 

: UPDATE wrong PROM Start Address - thanks RALFK

Offline
Last seen: 4 hours 59 min ago
Joined: Jun 18 2010 - 13:54
Posts: 153
Well if we're going to get

Well if we're going to get picky -  In line 50 you use variable A$ which hasn't been initialized yet...

tokabln's picture
Offline
Last seen: 2 days 3 hours ago
Joined: Dec 30 2015 - 10:48
Posts: 172
Thanks for your feedback... I

Thanks for your feedback... I made the necessary update above ;-)

Log in or register to post comments