mirror of
https://github.com/iKarith/beneath-apple-dos.git
synced 2024-10-12 00:23:45 +00:00
27bcf5f79c
PIEWriter dot codes are case-insensitive, and I've deciphered that .pp is a paragraph break. Replace those with blank lines. The NUL at EOF was escaped, but it can be simply deleted. Did so.
281 lines
11 KiB
Plaintext
281 lines
11 KiB
Plaintext
ABA6 Place track/sector of T/S List in directory entry in
|
|
first T/S List variable in file manager workarea.
|
|
Copy file type from directory to parmlist to pass it
|
|
back to caller and to file manager workarea.
|
|
Copy number of sectors in file to workarea.
|
|
Save directory offset to entry in workarea.
|
|
Set end of data pointer to "infinity".
|
|
Set number of data bytes represented by one T/S List
|
|
sector to 122*256 (30.5K) in workarea.
|
|
Go read first T/S List sector (AF5E).
|
|
.np
|
|
ABDC-AC05 Initialize file manager workarea.
|
|
Zero entire 45 bytes of workarea.
|
|
Save complemented volume number in workarea.
|
|
Save drive number in workarea.
|
|
Save slot*16 in workarea.
|
|
Set track number to $11 (catalog track).
|
|
Return to caller.
|
|
.np
|
|
AC06-AC39 CLOSE function handler.
|
|
Checkpoint data buffer to disk if needed (AF1D).
|
|
Checkpoint T/S List buffer if needed (AF34).
|
|
Release any sectors which were preallocated but not
|
|
used (B2C3).
|
|
If VTOC does not need to be re-read, exit.
|
|
Otherwise, re-read VTOC sector (AFF7).
|
|
Flush through directory sectors in the catalog until
|
|
we reach the one which contains the entry for this
|
|
file.
|
|
Get the index to the entry.
|
|
Update the sector count in the entry to reflect the
|
|
new file's length.
|
|
Checkpoint the directory sector back to the disk.
|
|
Exit file manager.
|
|
.np
|
|
AC3A-AC57 RENAME function handler.
|
|
Call common code to locate/open the file.
|
|
If file is locked, exit with "FILE LOCKED" return
|
|
code.
|
|
Set $42,$43 to point to new name.
|
|
Copy new name to directory entry.
|
|
Write back directory sector to disk.
|
|
Exit file manager.
|
|
.np
|
|
AC58-AC69 READ function handler.
|
|
Insure subcode does not exceed 5. If so, exit with
|
|
return code=3.
|
|
Use subcode as index into READ subcode handler entry
|
|
point table.
|
|
Go to proper handler of subcode.
|
|
.np
|
|
AC6A-AC6C Return code = 3, subcode bad
|
|
.np
|
|
AC6D-AC6F "FILE LOCKED" error return
|
|
.np
|
|
AC70-AC86 WRITE function handler.
|
|
If file is locked, exit with "FILE LOCKED" error.
|
|
Insure subcode does not exceed 5. If so, exit with
|
|
return code=3.
|
|
Use subcode as index into WRITE subcode handler entry
|
|
point table.
|
|
Go to proper handler of subcode.
|
|
.np
|
|
AC87-AC89 POSITION AND READ ONE BYTE subcode handler
|
|
Call position routine.
|
|
Fall through to next subcode handler.
|
|
.np
|
|
AC8A-AC92 READ ONE BYTE subcode handler.
|
|
Read next file byte (ACA8).
|
|
Store in parmlist for pass back to caller.
|
|
Exit the file manager.
|
|
.np
|
|
AC93-AC95 POSITION AND READ A RANGE OF BYTES subcode handler.
|
|
Call position routine.
|
|
Fall through to next subcode handler.
|
|
.np
|
|
AC96-ACA7 READ A RANGE OF BYTES subcode handler.
|
|
Decrement and check length (B1B5).
|
|
Read a byte (ACA8).
|
|
Point $42,$43 at range address and add one to address
|
|
Store byte read at address.
|
|
Loop back to AC96. (length check will exit file
|
|
manager when length is zero.)
|
|
.np
|
|
ACA8-ACB8 Read a data byte.
|
|
Read next data sector if necessary (B0B6).
|
|
If at end of file, exit with "END OF DATA" error.
|
|
Otherwise, load data byte from data sector buffer.
|
|
Increment record number/byte offset into file (B15B).
|
|
Increment file position offset (B194).
|
|
Return with data byte read.
|
|
.np
|
|
ACBB-ACBD POSITION AND WRITE ONE BYTE subcode handler.
|
|
Call position routine.
|
|
Fall through to next subcode handler.
|
|
.np
|
|
ACBE-ACC6 WRITE ONE BYTE subcode handler.
|
|
Find data byte to be written.
|
|
Write it to file (ACDA).
|
|
Exit file manager.
|
|
.np
|
|
ACC7-ACC9 POSITION AND WRITE A RANGE OF BYTES subcode handler.
|
|
Call position routine.
|
|
Fall through to next subcode handler.
|
|
.np
|
|
AACA-ACD7 WRITE A RANGE OF BYTES subcode handler.
|
|
Copy and advance range address pointer.
|
|
Get next byte to write.
|
|
Write it to file (ACDA).
|
|
Test and decrement length (B1B5).
|
|
Loop back to AACA.
|
|
.np
|
|
ACDA-ACEC Write a data byte.
|
|
Read the proper data sector (if necessary) (B0B6).
|
|
Store data byte to be written in sector buffer.
|
|
Flag data sector buffer as requiring rewrite.
|
|
Increment record number/byte offset into file (B15B).
|
|
Exit via file position offset increment routine
|
|
(B194).
|
|
.np
|
|
ACEF-ACF5 LOCK function handler.
|
|
Set mask byte to $80 (lock).
|
|
Go to common code (ACFB).
|
|
.np
|
|
ACF6-ACFA UNLOCK function handler.
|
|
Set mask byte to $00 (unlock).
|
|
Fall through to common code.
|
|
.np
|
|
ACFB-AD11 LOCK/UNLOCK common code.
|
|
Locate/open file (AB28).
|
|
Get index into directory to entry.
|
|
Update file type byte to lock ($8X) or unlock ($0X).
|
|
Write directory sector back to disk.
|
|
Exit file manager.
|
|
.np
|
|
AD12-AD17 POSITION function handler.
|
|
Call position routine.
|
|
Exit file manager.
|
|
.np
|
|
AD18-AD2A VERIFY function handler.
|
|
Locate/open file (AB28).
|
|
AD1B Read next data sector.
|
|
If at end of file, exit file manager.
|
|
Otherwise, increment sector position.
|
|
And loop back to AD1B.
|
|
.np
|
|
AD2B-AD88 DELETE function handler.
|
|
Locate/open file (AB28).
|
|
Using directory index, determine if file is locked.
|
|
If so, exit with "FILE LOCKED" error code.
|
|
Copy T/S List sector's track number from directory to
|
|
workarea and to last character of file name in the
|
|
directory entry itself.
|
|
Store a $FF over T/S List sector's track number in
|
|
directory entry to mark file deleted.
|
|
Copy T/S List sector's sector number to workarea.
|
|
Write directory sector back to disk.
|
|
AD54 Read next T/S List sector (AF5E).
|
|
If no more exist, write VTOC and exit file manager.
|
|
Otherwise, select T/S List buffer (AF0C).
|
|
Index to first T/S pair.
|
|
AD5E If track number is zero or minus, skip it.
|
|
Otherwise, free the data sector by updating the VTOC
|
|
bit map (AD89).
|
|
Index to next T/S pair.
|
|
If more, go to AD5E.
|
|
Get T/S of next T/S List sector from this one.
|
|
Free this T/S List sector (AD89).
|
|
Go process next one, if any (go to AD54).
|
|
Otherwise, write VTOC and exit file manager.
|
|
.np
|
|
AD89-AD97 Free a sector.
|
|
Call B2DD to deallocate sector in VTOC bit map.
|
|
Zero the sector allocation area of the workarea.
|
|
Return to caller.
|
|
.np
|
|
AD98-AE2E CATALOG function handler.
|
|
Initialize file manager workarea (ABDC).
|
|
Set V value to zero (complimented=$FF).
|
|
Read the VTOC sector (AFF7).
|
|
Set up a counter for 22 lines before waiting for
|
|
the keyboard.
|
|
Skip 2 lines on the screen.
|
|
Print "DISK VOLUME ".
|
|
Convert Volume number and print it (AE42).
|
|
Skip 2 more lines.
|
|
ADCA Read next directory sector.
|
|
If no more exist, exit file manager.
|
|
Set index to first entry.
|
|
ADD1 Get track number.
|
|
If zero, exit file manager.
|
|
If minus, skip entry (deleted file).
|
|
Print "*" if file is locked (check file type byte).
|
|
Use file type as index into file type name table at
|
|
B3A7 and print single character found there.
|
|
Print a blank.
|
|
Convert and print the number of sectors in the file.
|
|
Print a blank.
|
|
Index to filename.
|
|
Print file name.
|
|
Skip to next line.
|
|
Advance index to next directory entry.
|
|
If there are more, go to ADD1.
|
|
If not, go to ADCA to read next directory sector.
|
|
Exit when finished.
|
|
.np
|
|
AE2F-AE41 Skip a line on CATALOG printout.
|
|
Output a carriage return.
|
|
Decrement line counter.
|
|
If still nonzero, exit.
|
|
Otherwise, wait for keyboard keypush.
|
|
Then reset counter to 21 lines.
|
|
And return to caller.
|
|
.np
|
|
AE42-AE69 Convert the number stored at $44 to a three character
|
|
printable number and print it.
|
|
.np
|
|
AE6A-AE7D Restore file manager workarea from file buffer.
|
|
Select file manager workarea buffer.
|
|
Set return code in parmlist to zero initially.
|
|
Copy 45 byte saved image of file manager workarea in
|
|
file buffer to real file manager workarea.
|
|
Exit to caller.
|
|
.np
|
|
AE7E-AE8D Save file manager workarea in file buffer.
|
|
Select file manager workarea buffer.
|
|
Copy 45 byte workarea to file buffer.
|
|
Exit to caller.
|
|
.np
|
|
AE8E-AF07 INIT function handler.
|
|
Initialize the file manager workarea (ABDC).
|
|
Call RWTS to format the diskette (B058).
|
|
Copy V value to VTOC buffer.
|
|
Start track to allocate next value at $11.
|
|
And direction of allocation as $01 (forward).
|
|
Zero VTOC bit map (all sectors in use).
|
|
Skipping the first three tracks and track $11, copy
|
|
the 4 byte bit mask (B3A0) to each track entry in
|
|
the VTOC bit map to free the sectors. This leaves the
|
|
first three tracks and the catalog track marked in
|
|
use.
|
|
Zero the directory sector buffer.
|
|
Point to directory sector buffer.
|
|
Set track $11 in RWTS parmlist.
|
|
Set up link from this directory sector to next (track
|
|
$11, sector-1).
|
|
Call RWTS to write directory sector.
|
|
Write each sector on track in this way except for
|
|
sector zero.
|
|
On last sector (sector 1) zero link pointer.
|
|
Point RWTS parms at DOS load point (B7C2).
|
|
Write DOS image onto tracks 0-2 (B74A).
|
|
Exit file manager.
|
|
.np
|
|
AF08-AF1C Select a buffer by setting $42,$43 to point to it.
|
|
AF08 Select file manager workarea buffer in file buffer.
|
|
AF0C Select T/S List sector buffer in file buffer.
|
|
AF10 Select data sector buffer in file buffer.
|
|
Exit to caller when $42,$43 are set.
|
|
.np
|
|
AF1D-AF33 Checkpoint write data sector buffer to disk.
|
|
Test flag to see if buffer was changed since last
|
|
read/write.
|
|
If not, exit to caller.
|
|
Otherwise, set up RWTS pointer (AFE4).
|
|
Call RWTS to write sector.
|
|
Reset flag to indicate data sector no longer in need
|
|
of a checkpoint.
|
|
Exit to caller.
|
|
.np
|
|
AF34-AF4A Checkpoint write T/S List sector buffer to disk.
|
|
Test flag to see if buffer was changed since last
|
|
read/write.
|
|
If not, exit to caller.
|
|
Otherwise, set up RWTS pointer (AF4B).
|
|
Call RWTS to write sector.
|
|
Reset flag to indicate T/S List sector no longer in
|
|
need of checkpoint.
|
|
Exit to caller.
|
|
.nx ch8.6
|