From caen!batcomputer!ghost.dsi.unimi.it!univ-lyon1.fr!jussieu.fr!math.ohio-state.edu!howland.reston.ans.net!agate!library.ucla.edu!news.mic.ucla.edu!ctc.com!news.pop.psu.edu!news.cac.psu.edu!newsserver.jvnc.net!igor.rutgers.edu!dziuxsolim.rutgers.edu!pilot.njin.net!jac Fri Apr 1 20:38:16 EST 1994
Article: 120 of comp.sources.apple2
Path: caen!batcomputer!ghost.dsi.unimi.it!univ-lyon1.fr!jussieu.fr!math.ohio-state.edu!howland.reston.ans.net!agate!library.ucla.edu!news.mic.ucla.edu!ctc.com!news.pop.psu.edu!news.cac.psu.edu!newsserver.jvnc.net!igor.rutgers.edu!dziuxsolim.rutgers.edu!pilot.njin.net!jac
From: jac@pilot.njin.net (Jonathan Chandross)
Newsgroups: comp.sources.apple2
Subject: v001SRC092: diskdump -- Split 5.25" Disk Into 6 Files
Message-ID:
Date: 24 Mar 94 03:53:23 GMT
Organization: Rutgers Univ., New Brunswick, N.J.
Lines: 204
Approved: jac@pilot.njin.net
Submitted-by: David A. Curran (curran@titan.ucs.umass.edu)
Posting-number: Volume 1, Source:92
Archive-name: util/diskdump
Architecture: ANY_2
Version-number: 1.00
Diskdump takes a DOS 3.3 formatted 5.25 disk and converts it into eight
discrete binary files on two disks. The individual files can be uploaded
and used with a Unix or Macintosh Apple // emulator, or distributed via
a network. The original disk image is reconstituted by concatenating
the various parts together.
Those of you wishing to learn more about the DOS 3.3 RWTS routine could
start with this. A copy of _What's Where In The Apple_ is invaluable
to understanding what the various locations do. (I used it when writing
the Read.Me.) A copy of _Beneath Apple DOS_ would also be very useful.
Enjoy.
=Read.Me
-
-diskdump
-
-Diskdump takes a DOS 3.3 formatted 5.25 disk and converts it into eight
-discrete binary files on two disks. The individual files can be uploaded
-and used with a Unix or Macintosh Apple // emulator, or distributed via
-a network. The original disk image is reconstituted by concatenating
-the various parts together. Note that the files are BINARY: they must be
-converted into some ASCII format, either using uuencode(1), binscii(1),
-etc., before being emailed. Similarly, any encoded file must be decoded
-before the pieces are concatenated together.
-
-Note that diskdump cannot recreate an Apple // format disk from the various
-parts; it is intended to be used in uploading a disk to be used with an Apple
-// emulator.
-
-==============
-Using diskdump
-==============
-Diskdump requires two disks to hold a 140K disk image. The procedure is:
- -- format the two destination disks
- -- put first six pieces on first destination disk
- -- put last two pieces on second destination disk
-
-Each file is named:
- "PART"
-where is the current part number. This means the parts are numbered:
- PART1
- PART2
- ...
- PART8
-
-The original disk image is reconstituted by concatenating the pieces together.
-
-Under Unix this is done as:
- cat part1 part2 part3 part4 part5 part6 part7 part8 > diskimage
-
-Under MS-DOS this is done as:
- copy part1+part2+part3+part4+part5+part6+part7+part8 disk.img
-
-For a Macintosh, you will have to use an editor or file utility to form a
-single file from the pieces, and then change the file type and creator to
-match whatever emulator you are using. Any decent editor can be used to
-concatenate the pieces, and then ResEdit or MacTools can be used to change
-the file type and creator.
-
-==============
-Implementation
-==============
-Diskdump uses the DOS3.3 RWTS (Read-Write Track-Sector) routine to read
-the next eighth of the disk. After being read in, each portion is saved
-using the Applesoft "bsave" command.
-
-Each disk segment is stored in RAM beginning at 0x4650 and is 20,480 bytes
-long. This means that RAM from 0x4650 to 0x9650 will be overwritten.
-Although DOS 3.3 extends down to 0x9600, the region at 0x9600 is used for
-file buffers. Since this program uses no files, we can safely use this
-region for holding the data we read in.
-
-Line 1010:
- POKE 768,32
- POKE 769,227
- POKE 770,3
- POKE 771,76
- POKE 772,217
- POKE 773,3
-creates an assembly routine at 0x300 that loads the Input/Output Control
-Block (IOB) and then calls the specified RWTS subroutine. The A register
-gets the high byte and the Y register gets the low byte of the IOB address.
-The pokes create the assembly routine:
- JMP $03E3 -- loads A and Y registers
- JMP $03D9 -- call to RWTS subroutine
-
-Line 1015:
- POKE 800,169
- POKE 802,32
- POKE 803,218
- POKE 804,253
- POKE 805,96
-creates a hex dump routine at 0x320 that is much faster than doing a decimal
-to hex conversion in a program. This routine is unused by the program, but
-appears because I pulled some of this code out of a sector editor I wrote.
-To use it:
- POKE 801,
- CALL 800
-The hex value will be displayed at the current cursor position. The assembly
-routine is:
- LDA #$ -- Loads A register with value to display
- JMP $FDDA -- Displays value
- RTS -- Return to Subroutine (wherever call came from)
-where is stored at location 0x321.
-
-Line 1020 sets up the RWTS for the read operation:
- -- Volume number is 0
- -- Data buffer is at 0x9600
- -- Read a full sector at a time
- -- Set command code to Read
-
- Poke Location Meaning
- 47083,0 0xB7EB Volume Number
- 47088,0 0xB7F0 | Pointer to Read/Write data buffer
- 47089,150 0xB7F1 |
- 47090,0 0xB7F2 Unused
- 47091,0 0xB7F3 Portion of Sector to read
- 47092,RW 0xB7F4 Command Code:
- 0 = Seek
- 1 = Read
- 2 = Write
- 3 = Format
-
-Line 20000 sets up:
- -- operation code = Read
- -- Track = next track number
- -- Sector = next sector number
-
- Poke Location Meaning
- 47092,RW 0xB7F4 Operation is Read
- 47084,TR 0xB7EC Track Number (0x00-0x22)
- 47085,SE 0xB7ED Sector Number (0x0 - 0x0F)
-
-and then calls the machine language subroutine at 0x300 to read in the data.
-
-The loop at 7530 to 7555 reads in the data:
- -- move the data pointer up by a sector's worth of data
- -- read in the next block of data
- -- if this was track 35
- -- we have finished the disk
- -- if this was sector 16
- -- move to next track
- -- sector 0
- -- increment part number
- -- save current part using current part number
- -- if the part number is 6
- -- prompt user to insert second disk (for remaining two parts)
-
-
-DISKDUMP IS COPYRIGHT 1994 BY DAVID A. CURRAN
-ALL RIGHTS RESERVED
-
-This package may be freely distributed so long as no fee is charged and
-modified versions are not distributed.
-
-David A. Curran
-curran@titan.ucs.umass.edu
-March 1994
-Version 1.00
=diskdump
-10 GOSUB 1000
-20 GOSUB 7000: END
-1000 TR = 0:SE = 0:RW = 1:LC = 1
-1010 POKE 768,32: POKE 769,227: POKE 770,3: POKE 771,76: POKE 772,217: POKE 773,3
-1015 POKE 800,169: POKE 802,32: POKE 803,218: POKE 804,253: POKE 805,96
-1020 POKE 47083,0: POKE 47088,0: POKE 47089,150: POKE 47090,0: POKE 47091,0: POKE 47092,RW
-1030 RETURN
-2000 POKE 47092,RW: POKE 47084,TR: POKE 47085,SE: CALL 768
-2010 RETURN
-7000 PRINT "PUT DISK 1 IN DRIVE 2 AND HIT RETURN. ALL INFORMATION ON THIS DISK WILL BE ERASED. 'Q' TO QUIT NOW.": GET A$: IF A$ = "Q" THEN END
-7005 PRINT
-7010 PRINT CHR$ (4);"INIT DISKDUMP,D2"
-7020 PRINT "PUT DISK 2 IN DRIVE 2 AND HIT RETURN. ALL INFORMATION ON THIS DISK WILL BE ERASED. 'Q' TO QUIT NOW.": GET A$: IF A$ = "Q" THEN END
-7025 PRINT
-7030 PRINT CHR$ (4);"INIT DISKDUMP,D2"
-7500 HOME : PRINT "PUT SOURCE IN DRIVE 1, TARGET 1 IN DRIVE2."
-7510 GET A$
-7520 SE = 0:TR = 0:CT = 0
-7525 H1 = SE:H2 = TR:RW = 1: POKE 47082,1
-7530 FOR A = 0 TO 79
-7535 POKE 47088,(18000 + (A * 256)) - 256 * ( INT (((18000 + (A * 256)) / 256)))
-7540 POKE 47089, INT (((18000 + (A * 256)) / 256))
-7541 GOSUB 2000
-7543 IF ((TR = 35) AND (RW = 1)) THEN GOTO 7600
-7545 SE = SE + 1: IF SE = 16 THEN SE = 0:TR = TR + 1
-7548 VTAB RW + 10: HTAB TR: PRINT "0"
-7555 NEXT
-7557 IF ZW = 1 THEN RETURN
-7560 IF RW = 2 THEN GOTO 7525
-7565 CT = CT + 1: IF CT = 6 THEN PRINT "PLACE DISK 2 IN DRIVE 2.": GET A$: PRINT
-7570 N$ = "PART" + CHR$ (48 + CT)
-7575 PRINT CHR$ (4);"BSAVE ";N$;",A18000,L20480,D2"
-7580 GOTO 7525
-7600 PRINT "FINISHED.": FOR A = 1 TO 2000: NEXT : RUN
-
+ END OF ARCHIVE