Skip to content

Instantly share code, notes, and snippets.

@pamoroso
Last active February 4, 2023 22:46
Show Gist options
  • Save pamoroso/e06b75713719c12123ac71042e7cbd94 to your computer and use it in GitHub Desktop.
Save pamoroso/e06b75713719c12123ac71042e7cbd94 to your computer and use it in GitHub Desktop.
CLS for CP/M

CLS

Transient commands in Assembly for clearing the screen on CP/M-80 and CP/M-86 with an ANSI/VT100 terminal.

Usage

Execute CLS with no arguments from the command prompt:

A>CLS
; Clear the screen.
;
; Runs on CP/M-86 with an ANSI/VT100 terminal.
WRITESTR equ 09h ; BDOS function write string
TERMCPM equ 00h ; BDOS function terminate program
cseg
mov cl, WRITESTR
lea dx, clshome
int 224
mov cl, TERMCPM
int 224
dseg
org 100h
; ANSI escapes:
; clear screen : ESC [ 2 J
; go to screen home : ESC [ H
clshome db 1bh, '[2J', 1bh, '[H$'
end
; Clear the screen.
;
; Runs on CP/M-80 with an ANSI/VT100 terminal.
TPA equ 100h
BDOS equ 05h
WRITESTR equ 09h ; Write string
org TPA
mvi c, WRITESTR
lxi d, clshome
call BDOS
ret
; ANSI escapes:
; clear screen : ESC [ 2 J
; go to screen home : ESC [ H
clshome: db 1bh, '[2J', 1bh, '[H$'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment