lotus

previous page: 04.008 Is it possible to run PaintWorks from hard disk? Will it load files from an HFS partition?
  
page up: Apple II Csa2 FAQs
  
next page: 04.010 Is there an Apple II program for amatuer radio CW code practice?

04.009 How can I read a single ProDOS block into memory using Applesoft BASIC?




Description

This article is from the Apple II Csa2 FAQ, by Jeff Hurlburt with numerous contributions by others.

04.009 How can I read a single ProDOS block into memory using Applesoft BASIC?

         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.

By:  Joseph M Barbey
    

 

Continue to:













TOP
previous page: 04.008 Is it possible to run PaintWorks from hard disk? Will it load files from an HFS partition?
  
page up: Apple II Csa2 FAQs
  
next page: 04.010 Is there an Apple II program for amatuer radio CW code practice?