Softcard III: Selecting 40-Column and 80-Column Text Modes

Softcard III: Selecting 40-Column and 80-Column Text Modes

There are several ways to switch to either 40 or 80 column mode in the CP/M
environment.  One way is to write a short assembly language program, assemble
it, then load it as a .COM file.  Another way is to use the BASIC's CHR$
functions to change modes.  Don't forget to reset the viewport when changing
to 80 column mode.  Refer to the Standard Device Drivers Manual for further
information.
 
Below are two assembly language programs which allows you to set 40 or 80
column modes from the CP/M command level.  Enter these in your ED.COM editor,
then assembled them using ASM.COM.  Once assembled, load them into .COM files
using the Load utility on the CP/M System Disk.
 
          ;
          ;       Forty.COM
          ;
          BDOS    EQU     0005H      ; BDOS entry point
          WARM    EQU     0000H      ; Warm start entry point
          PRINT   EQU     9          ; Print string command
          ;
                  ORG     0100H      ; Beginning of TPA
          ;
                  LXI     D,CMDS     ; Point to command string
                  MVI     C,PRINT    ; Set-up BDOS command
                  CALL    BDOS       ; Call BDOS to print string
                  JMP     WARM       ; Warm start return to CP/M
          ;
          CMDS:   DB      16         ; Set text mode
                  DB       1         ; To 40 column mode
                  DB      28         ; Clear viewport command
                  DB      '$'        ; End print string command
          ;
                  End
 
          ;
          ;       Eighty.COM
          ;
          BDOS    EQU     0005H      ; BDOS entry point
          WARM    EQU     0000H      ; Warm start entry point
          PRINT   EQU     9          ; Print string command
          ;
                  ORG     0100H      ; Beginning of TPA
          ;
                  LXI     D,CMDS     ; Point to command string
                  MVI     C,PRINT    ; Set-up BDOS command
                  CALL    BDOS       ; Call BDOS to print string
                  JMP     WARM       ; Warm start return to CP/M
          ;
          CMDS:   DB      16         ; Set text mode
                  DB       2         ; To 80 column mode
                  DB       1         ; Reset viewport
                  DB      28         ; Clear viewport command
                  DB      '$'        ; End print string command
          ;
                  End
 
From Microsoft BASIC, use:
 
   A. To switch to 40 Column mode:
 
        100 Print CHR$(16) + CHR$(1) + CHR$(28)
        110 End
 
   B. To switch to 80 Column mode:
 
        100 Print CHR$(16) + CHR$(2) + CHR$(1) + CHR$(28)
        110 End

Back