💾 Archived View for mirrors.apple2.org.za › archive › ground.icaen.uiowa.edu › MiscInfo › Programmin… captured on 2023-01-29 at 10:17:50.
-=-=-=-=-=-=-
Path: news1.icaen!news.uiowa.edu!news.physics.uiowa.edu!newsrelay.iastate.edu!vixen.cso.uiuc.edu!uwm.edu!news.he.net!news-peer.gip.net!news.gsl.net!gip.net!howland.erols.net!netnews.com!news.idt.net!feed.nntp.acc.ca!news.bconnex.net!not-for-mail From: CUTjefbla@bconnex.net (Jeff Blakeney) Newsgroups: comp.sys.apple2 Subject: Re: Reading Prodos Blocks from Applesoft Date: Tue, 05 May 1998 01:06:37 GMT Organization: Barrie Connex Lines: 64 Message-ID: <354e4db5.5297731@news.bconnex.net> References: <6ijgsf$jsp$1@nnrp1.dejanews.com> Reply-To: CUTjefbla@bconnex.net (Jeff Blakeney) NNTP-Posting-Host: iah15-57.barrie.connex.net X-Newsreader: Forte Free Agent 1.1/32.230 Xref: news1.icaen comp.sys.apple2:133385 On Sun, 03 May 1998 23:40:47 -0600, mduggan162@aol.com wrote: >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? If you just want to load blocks from a particular file, you can just use the BLOAD command. For example: 10 PRINT CHR$(4);"BLOAD SOMEFILE,A$4000,L512,B";BL%*512 BL% is the block number of the file you wish to read and this command loads the 512 bytes of the block into the beginning of HGR2 memory. The only way that I can think of to load any block from a ProDOS volume would be to call a short assembly routine to do the MLI call to ProDOS. Here is a method to do this (you can just copy this section and save it to a ProDOS disk and EXEC it from basic if you don't want to type it yourself): CALL -151 300: 20 00 BF 80 07 03 60 03 00 00 00 00 00 BSAVE READBLOCK.OBJ,A$300,L$D 3D0G NEW 10 HOME: PRINT CHR$(4);"BLOAD READBLOCK.OBJ" 20 INPUT "SLOT: ";S%: INPUT "DRIVE: ";D% 30 INPUT "BLOCK # ";BL%: INPUT "LOCATION: "; ML% 40 SD% = (D%-1)*128 + S%*16 50 B1% = INT(BL%/256): B2% = BL%-B1%*256 60 M1% = INT(ML%/256): M2% = ML%-M1%*256 70 POKE 776,SD% 80 POKE 777,M2%: POKE 778,M1% 90 POKE 779,B2%: POKE 780,B1% 100 CALL 768 SAVE READBLOCK What the assembly program simply does a JSR BF00 with everything set up for a READ_BLOCK command then returns to the calling program (Applesoft program in this case). The parameter block starting at $307 (775) contains the following: 03 Number of parameters 60 Slot and drive number that is calculated and poked in (this example shows slot 6, drive 1, slot 6, drive 2 would be E0) Example program pokes SD% here. 00 20 Location to put block read from disk in (low byte, high byte) (this example shows $2000 which is the HGR memory) Example program pokes B2% (low) and B1% (high) here. 02 00 Block number to read (low byte, high byte) (this example shows block 2 which is the first directory block on a volume) Example program pokes M2% (low) and M1% (high) here. Keep in mind that the block number must be between 0 and 32767 (0 and $7FFF) and that the 512 bytes AFTER the location will be overwritten with the data read from disk. If you have any problems understanding any of this, let me know and I'll try to help out more. We might also want to move this to comp.sys.apple2.programmer. === I've had enough SPAM. Cut the obvious from my address to email me. ===