Files
Sepp J Morris 31738079c4 Upload
Digital Research
2020-11-06 18:50:37 +01:00

46 lines
1.0 KiB
NASM
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

; Figure 5-14
;
; CCPM
; Check if CP/M
; This subroutine determines the version number of the
; Operating System and, if not CP/M version 2, displays
; an error message and executes a warm boot.
;
; Entry and Exit Parameters
;
; None
;
; Calling sequence
;
; CALL CCPM ;Warm boots if not CP/M 2
;
B$PRINTS EQU 9 ;Display $-terminated string
B$GETVER EQU 12 ;Get version number
BDOS EQU 5 ;BDOS Entry Point
;
CR EQU 0DH ;Carriage Return
LF EQU 0AH ;Line Feed
;
CCPMM: DB CR,LF
DB 'This program can only run under CP/M version 2.'
DB CR,LF,'$'
;
;
CCPM:
MVI C,B$GETVER ;Get version number
CALL BDOS
MOV A,H ;H must be 0 for CP/M
ORA A
JNZ CCPME ;Must be MP/M
MOV A,L ;L = version number of CP/M
ANI 0F0H ;Version number in MS Nibble
CPI 20H ;Check if version 2
JNZ CCPME ;Must be an earlier version
RET ;Yes, we under CP/M version 2
;
CCPME: ;Error
MVI C,B$PRINTS ;Display error message
LXI D,CCPMM
CALL BDOS
JMP 0 ;Warm Boot