💾 Archived View for mirrors.apple2.org.za › archive › ground.icaen.uiowa.edu › MiscInfo › Programmin… captured on 2023-01-29 at 10:13:37.

View Raw

More Information

-=-=-=-=-=-=-

Path: news1.icaen!news.uiowa.edu!news2.chicago.iagnet.net!qual.net!iagnet.net!vixen.cso.uiuc.edu!news-peer.sprintlink.net!news-backup-west.sprintlink.net!news.sprintlink.net!151.164.30.38!newsgate.swbell.net!151.164.30.35.MISMATCH!cyclone.swbell.net!swbell!not-for-mail
From: Rubywand <rubywand@swbell.net>
Newsgroups: comp.sys.apple2
Subject: Re: Reading Prodos Blocks from Applesoft
Date: Mon, 04 May 1998 06:51:14 -0500
Organization: Southwestern Bell Internet Services, Richardson, TX
Lines: 65
Message-ID: <354DABB2.D5B77ACB@swbell.net>
References: <6ijgsf$jsp$1@nnrp1.dejanews.com>
Reply-To: rubywand@swbell.net
NNTP-Posting-Host: ppp-207-193-9-191.hstntx.swbell.net
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: (null) 894282069 9799 (None) 207.193.9.191
X-Complaints-To: usenet@nnrp3
X-Mailer: Mozilla 4.04 [en] (Win95; I)
Xref: news1.icaen comp.sys.apple2:133334

mduggan162@aol.com writes ...
> 
> Does know where I could find or how I would go about creating an > applesoft program that can read a single prodos block from disk into > memory?
>
 ....


     After booting ProDOS, you can do a CALL-151 to enter the monitor
and type in ...

300: 4C 09 03 03 60 00 20 00 00 20 00 BF 80 03 03 85 FF 60

Do a CTRL-C to get back to the Applesoft prompt and enter ...

BSAVE PROZAP.BIN,A$300,L$20


     The routine does a ProDOS Machine Language Interface CALL which
reads the block into $2000-$21FF. It saves the Error# in $FF.

300: 4C 09 03    start
303: 03          3 parms in this parms block
304: 60          unit # DSSS0000  Drv 1 (D=0) Slot 6 (SSS=110)
305: 00 20       buffer start
307: 00 00       block # Low, High ex: block 256 is 307: 00 01
309: 20 00 BF    JSR to do MLI command          
30C: 80          command (80 for READ BLOCK; 81 for WRITE BLOCK)
30D: 03 03       loc of parms block
30F: 85 FF       save error # (00= no error)
311: 60          exit


     A BASIC program could use the routine by POKE-ing the block # into
$307,$308 (775 and 776 in decimal) and doing a CALL768. The MLI command
code is POKEd into $30C (780). If a PEEK at address $FF (255) gives a
result of zero, there is no error.

100 LOMEM: 8704
105 REM Sets start of var space above $2000-$21FF buffer
110 TEXT: HOME: PRINT CHR$(4)"BLOAD PROZAP.BIN"
115 B= 2
120 REM Sets block to read/write (block 2)
125 C= 128
130 REM Sets MLI READ command ($80); MLI WRITE is 129 ($81)
135 BH= INT(B/256): BL= INT (B-256*BH)
140 POKE 775,BL: POKE 776,BH
145 REM POKEs block to read/write
150 POKE 780, C
155 REM POKEs MLI command
160 CALL 768
165 REM Does the block read/write
170 PRINT "BLOCK ";B
175 E= PEEK(255)
180 REM E= error number
185 IF E<1 THEN 195
190 PRINT "ERROR ";E;"!";CHR$(7)
195 END


     After running the program for a BLOCK READ, the block contents
should be at $2000-21FF.



Rubywand