-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
ccp.z80
45 lines (35 loc) · 1.01 KB
/
ccp.z80
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
;; ccp.z80 - Set the name of the CCP to load.
;;
;; This uses the custom BIOS function we've added to the BIOS, which was never
;; present in real CP/M. Consider it a hook into the emulator.
;;
FCB1: EQU 0x5C
BDOS_ENTRY_POINT: EQU 5
;;
;; CP/M programs start at 0x100.
;;
ORG 100H
;; The FCB will be populated with the first argument,
;; if the first character of that region is a space-character
;; then we've got nothing specified
ld a, (FCB1 + 1)
cp 0x20 ; 0x20 = 32 == SPACE
jp z, missing_argument ; Got a space, report the error
ld HL, 03
ld de, FCB1 + 1
ld a, 31
out (0xff), a
exit:
LD C,0x00
CALL BDOS_ENTRY_POINT
missing_argument:
LD DE, MISSING_ARGUMENT_STR
LD C, 0x09
call BDOS_ENTRY_POINT
jr exit
;;;
;;; Text output strings.
;;;
MISSING_ARGUMENT_STR:
db "Usage: CCP [CCP|CCPZ]", 0x0a, 0x0d, "$"
END