The command code routines
THE 'TRANSFER UFIA TO DFCA' SUBROUTINE
This subroutine is called by using command code 51 (#33), it transfers the file
description and header (UFIA) to the Disk File Channel Area (DFCA). On entry IX must
point to the start of the User's File Information Area (UFIA).
1539 HXFER PUSH IX
153B POP HL
153C LD DE,#1E01 Start of 'UFIA1'.
153F LD BC,24
1542 LDIR Transfer the UFIA to 'UFIA1'.
1544 LD IX,#1AC3 IX points to the DFCA.
1548 CALL #2984,JTEST_DRV Check if the specified drive is
154B RET defined.
THE 'OPEN FILE SECTOR MAP' SUBROUTINE
This subroutine is called by using command code 52 (#34), it Opens a File Sector Map
with the information contained in the DFCA. On entry IX must point to the UFIA, a call
to 'HXFER' above transfers the UFIA to the DFCA. A return is made with the disk buffer
pointer (RPT) set to the start of the disk buffer in the DISCiPLE RAM.
'OFSM' should be used for files which don't contain a 9 byte header at the start of the
file.
154C OFSM CALL #1539,HXFER Transfer UFIA to DFCA.
154F JP #29A8,JOFSM_2 Open the file sector map.
THE 'OPEN A FILE' SUBROUTINE
This subroutine is called by using command code 53 (#35), it opens a file for SAVEing.
As with the preceeding subroutines IX must point to the UFIA. By calling 'OFSM' above
the UFIA is transferred to the DFCA and the file sector map is opened. Finally
'SAVE_HEAD1' is called to transfer the 9 bytes file header to the file.
'HOFLE' can be used for files which contain the 9 byte header.
1552 HOFLE CALL #154C,OFSM Transfer UFIA to DFCA and open the file
sector map.
1555 CALL #0D2F,SAVE_HEAD1 Transfer the 9 byte file header to the
1558 RET file and exit.
THE 'SAVE BLOCK TO DISK' SUBROUTINE
This is called by using command code 55 (#37). The data block starting at address DE
with length BC is SAVEd to disk. NOTE: A file has to be opened for SAVEing before
writing bytes. Use 'HOFLE' or 'OFSM' to do this.
1559 HSVBK CALL #1579,BCDE_DEHL Transfer BC to DE and DE to HL.
155C JP #29C9,JHSVBK_2 Save the block.
THE 'GET A FILE FROM DISK' SUBROUTINE
This is called by using command code 59 (#3B), it opens a file for LOADing. The IX
register must point to the start of the UFIA. The return is made with the first sector
of the file loaded into the disk buffer and RPT pointing to the first byte (usually
the start of the 9 byte file header).
155F HGFLE CALL #1539,HXFER Transfer the UFIA to the DFCA.
1562 JP #299C,JHGFLE_2 Open the file and load the first sector
in the disk buffer.
THE 'LOAD BLOCK FROM DISK' SUBROUTINE
This subroutine is called by using command code 61 (#3D), it does the opposite of
'HSVBK' above. The data block starting at address DE with length BC is LOADed from
disk. NOTE: The file has to be opened by using 'HGFLE' before an attempt can be made
to LOAD bytes. Don't try to LOAD more bytes than available.
1565 HLDBK CALL #1579,BCDE_DEHL Transfer BC to DE and DE to HL.
1568 JP #29A5,JLOAD_FILE Load the block.
THE 'ERASE A FILE' SUBROUTINE
This is called by using command code 65 (#41). It ERASEs one file on the disk (even
when wildcards were used), using the information contained in the UFIA, so make sure
that IX points to the start of it.
156B HERAZ CALL #1539,HXFER Transfer the UFIA to the DFCA.
156E CALL #0985,FIND_FILE Find the file, HL points to the
directory entry of the file (contained
in the disk buffer).
1571 JP NZ,#2954,REP_26 Give error if file not found.
1574 LD (HL),0 Directory description 0 means ERASEd.
1576 JP #29CF,JWSAD Write sector DE.
THE 'BC TO DE AND DE TO HL' SUBROUTINE
This routine transfers the contents of BC to DE and that of DE to HL, it also sets
IX to the start of the DFCA.
1579 BCDE_DEHL PUSH DE
157A PUSH BC
157B POP DE
157C POP HL
157D LD IX,#1AC3
1581 RET
THE 'READ SECTOR TO ADDRESS' SUBROUTINE
This routine is called by using command code 68 (#44). It reads sector DE from drive
A to the address held in the IX register.
1582 HRSAD PUSH BC
1583 PUSH IX
1585 LD IX,#1AC3
1589 CALL #2987,JTEST_DRV1 See if the drive held in the A register
is defined.
158C CALL #29BD,JRSAD Load the sector into the disk buffer.
158F POP HL
1590 PUSH DE
1591 LD DE,#1BD6 Start of disk buffer.
1594 EX DE,HL
1595 CALL #0D22,GET_SECLEN Fetch sector length in BC.
1598 LDIR Move sector to specified address.
159A PUSH DE
159B POP IX Update IX.
159D POP DE Restore DE and BC.
159E POP BC
159F RET
THE 'WRITE SECTOR FROM ADDR.' SUBROUTINE
This is called using command code 69 (#45), it writes sector DE to drive A starting
from address IX.
15A0 HWSAD PUSH BC
15A1 PUSH IX
15A3 POP HL
15A4 LD IX,#1AC3
15A8 CALL #2987,JTEST_DRV1 See if the drive held in the A register
15AB PUSH DE is defined.
15AC LD DE,#1BD6
15AF CALL #0D22,GET_SECLEN Fetch the sector length into BC.
15B2 LDIR Move BC bytes to the disk buffer.
15B4 POP DE
15B5 PUSH HL
15B6 CALL #29CF,JWSAD Write sector DE to disk.
15B9 POP IX
15BB POP BC
15BC RET Finished.
THE 'READ SECTOR DE' SUBROUTINE
This routine is called using command code 63 (#3F), it loads sector DE from the
current drive into the disk buffer.
15BD RSAD LD IX,#1AC3
15C1 JP #29BD,JRSAD Load the sector.
THE 'WRITE SECTOR DE' SUBROUTINE
This is called using command code 62 (#3E), it saves the contents of the disk buffer
into sector DE on the current drive.
15C4 WSAD LD IX,#1AC3
15C8 JP #29CF,JWSAD Save the sector.