DOS Wedge

From C64-Wiki
Jump to navigationJump to search
Start screen of DOS MANAGER V5.1.

The DOS Wedge is a small program to ease the use of a Commodore disk drive. It has the following properties:

  • The error status of a disk drive can be read with one floppy command.
  • The directory of a floppy disk can be listed without overwriting an existing BASIC program.
  • A compact command syntax allows sending of drive commands.

C64 DOS Wedge[edit | edit source]

The DOS Wedge for the C64 was programmed in machine language by Bob Fairbairn. It uses the memory area $CC00–$CFFF (52224–53247).

Loading[edit | edit source]

The BASIC program "C-64 Wedge" of the test-/demo diskette (1541, 1570/1571) is loaded and run with:

  1. LOAD "C-64 WEDGE",8
  2. RUN
  3. After that "C-64 Wedge" loads the machine code into the memory at $CC00 (52224) and runs it.
  4. Finally the start screen shows "DOS MANAGER V5.1".

The new commands[edit | edit source]

> can be used alternatively to @ to begin a floppy command. A value in square brackets is optional.

@ Display the error status (see also STATUS). Attention: The disk drive must be ready or the command will hang!
@$ List the directory without overwriting the memory.
@#devno Set the current device number of the disk drive to devno, for e.g. @#8 or @#9.
/filename Load the BASIC program filename.
filename Load and run the BASIC program filename.
%filename Load the machine code program filename.
filename Save the BASIC program filename.
@diskcommand Send a drive command, e.g.

@N:diskname[,id] - Format a disk (NEW). Without id only the directory is cleared, aka fast format.

@Q Deactivate the Wedge.

Remarks[edit | edit source]

  • Similar to standard BASIC commands the new commands can also be used in a BASIC program.
  • Leading spaces are ignored.
  • SYS 52224 activates the DOS Wedge again after deactivation by @Q.
  • When you want to use the DOS Wedge commands in your programs the name of the disk command following the @ prefix must be enclosed by quotation marks, e.g. @"$", /"DOS*" or ←"Test".
  • The commands of the DOS wedge practically became a standard and are included in the command set of many floppy speeders in extended or improved form. Also some machine language monitors picked up the '@' syntax.

Internal details[edit | edit source]

The wedge patches the CHRGET routine in the Zeropage, where every character that is processed by the BASIC interpreter is checked. If it is a command of the wedge the corresponding DOS wedge routine is called.

On the left is the SMON disassembler listing. On the right in the comment are the original values.

,0073  E6 7A     INC   7A
,0075  D0 02     BNE 0079
,0077  E6 7B     INC   7B
,0079  AD 08 02  LDA 0208
,007C  4C F3 CC  JMP CCF3   ;,007C  C9 3A     CMP #3A
,007F  0A        ASL        ;,007E  B0 0A     BCS 008A
,0080  C9 20     CMP #20
,0082  F0 EF     BEQ 0073
,0084  38        SEC
,0085  E9 30     SBC #30
,0087  38        SEC
,0088  E9 D0     SBC #D0
,008A  60        RTS

Jump back to the CHRGET routine:

,CD1E  C9 3A     CMP #3A
,CD20  B0 03     BCS CD25
,CD22  4C 80 00  JMP 0080   ; CHRGET Rest run
,CD25  4C 8A 00  JMP 008A

Articles[edit | edit source]

Links[edit | edit source]

WP-W11.png Wikipedia: DOS_Wedge

DOS Wedge enhanced: