Changes

Jump to: navigation, search
<pre>
;; This example shows how to access the firmware from within CP/M 2.1.
;; This example does not work with CP/M+
;;
;;---------------------------------------------------------

org &100 ;; origin for C/PM .COM programs
nolist
write"test.com"

.enter_firmware equ &be9b
.scr_set_mode equ &bc0e
.txt_output equ &bb5a

;;---------------------------------------------------------
;; change the display mode to mode 1
ld a,1
call enter_firmware
defw scr_set_mode

;; display a message on the screen
ld hl,test_message
call display_message

;; quit back to command-line
ret


;;---------------------------------------------------------
;; HL = pointer to null terminated message
.display_message
ld a,(hl) ;; get ASCII character
inc hl ;; increment pointer for next character
or a ;; end of message marker (0)?
ret z ;; quit if end of message marker found.

call display_char ;; send character to console output
jp display_message ;; loop for next char

;;---------------------------------------------------------
;; A = ASCII character

.display_char
call enter_firmware ;; execute firmware function
defw txt_output ;; firmware function: TXT OUTPUT
ret


;;---------------------------------------------------------
.test_message
defb "Hello World!",0
</pre>
12,273
edits