-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from skx/10-delete
Allow deleting files
- Loading branch information
Showing
7 changed files
with
92 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
;; delete.asm - Delete the named file | ||
;; | ||
|
||
FCB1: EQU 0x5C | ||
|
||
BDOS_ENTRY_POINT: EQU 5 | ||
|
||
BDOS_OUTPUT_STRING: EQU 9 | ||
BDOS_DELETE_FILE: EQU 19 | ||
|
||
;; | ||
;; CP/M programs start at 0x100. | ||
;; | ||
ORG 100H | ||
|
||
;; The FCB will be populated with the pattern/first argument, | ||
;; if the first character of that region is a space-character | ||
;; then we've got nothing to search for. | ||
ld a, (FCB1 + 1) | ||
cp 0x20 ; 0x20 = 32 == SPACE | ||
jp nz, got_argument ; Not a space, so we can proceed | ||
|
||
;; | ||
;; No argument, so show the error and exit | ||
;; | ||
ld de, usage_message | ||
ld c, BDOS_OUTPUT_STRING | ||
call BDOS_ENTRY_POINT | ||
jr exit_fn | ||
|
||
got_argument: | ||
LD DE, FCB1 | ||
LD C, BDOS_DELETE_FILE | ||
CALL BDOS_ENTRY_POINT | ||
|
||
exit_fn: | ||
;; exit | ||
LD C,0x00 | ||
CALL BDOS_ENTRY_POINT | ||
|
||
|
||
;;; | ||
;;; The message displayed if no command-line argument was present. | ||
;;; | ||
usage_message: | ||
db "Usage: DELETE FILENAME.EXT" | ||
|
||
;; note fall-through here :) | ||
newline: | ||
db 0xa, 0xd, "$" | ||
|
||
END |