-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This pull-request closes #11 by allowing files to be created.
- Loading branch information
Showing
5 changed files
with
90 additions
and
1 deletion.
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
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 @@ | ||
;; create.asm - Create the named file | ||
;; | ||
|
||
FCB1: EQU 0x5C | ||
|
||
BDOS_ENTRY_POINT: EQU 5 | ||
|
||
BDOS_OUTPUT_STRING: EQU 9 | ||
BDOS_MAKE_FILE: EQU 22 | ||
|
||
;; | ||
;; 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, 22 | ||
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: CREATE FILENAME.EXT" | ||
|
||
;; note fall-through here :) | ||
newline: | ||
db 0xa, 0xd, "$" | ||
|
||
END |