BIOS

 BBS: Inland Empire Archive
Date: 06-06-92 (21:19)             Number: 145
From: MATT HART                    Refer#: NONE
  To: MANUEL GODINEZ                Recvd: NO  
Subj: BIOS                           Conf: (2) Quik_Bas
 MG> Does anyone have a routine to PRINT using the BIOS ? I'll like to make

Here's one.  Kinda tricky.  There's a BIOS routine that
will print an entire string, but some BIOS's don't support
it, including Tandy.  This one prints and moves the cursor
and prints and moves, etc...  It's in assembly - part of a
library package I'm trying to put together as shareware.

; BPRINT.ASM  by Matt E. Hart
;
; PRINT replacement - uses BIOS calls
;
; DECLARE SUB BPrint(Strg$, BYVAL Attr)
;
;        Strg$ : String to print
;        Attr% : Attribute to print the string with
;
.MODEL MEDIUM,BASIC
.CODE

BPrint PROC Strg:Word, Attr:Word
    MOV     AX,0300h
    XOR     BX,BX
    INT     10h                 ; Sets current cursor location into DX
    MOV     SI,Strg
    MOV     CX,[SI]             ; CX has string length
    CMP     CX,0
    JE      B_Ending            ; Zero length - string was null
    MOV     DI,[SI+2]           ; DI has address of first byte
    MOV     BX,Attr             ; BX has attribute
B_Top:
    PUSH    CX                  ; Save the counter
    MOV     CX,1                ; Set the number of characters to 1
    MOV     AH,09h
    MOV     AL,[DI]             ; Character of string into AL
    INT     10h                 ; BIOS Print it
    POP     CX                  ; Restore the number of characters
    DEC     CX                  ; Less 1
    JZ      B_Ending            ; Last character - finish
    INC     DI                  ; NExt character
    INC     DL                  ; You can keep updating the Column
                                ; the BIOS doesn't care if you go past the
                                ; end, it'll wrap
    MOV     AH,02h
    INT     10h                 ; Reset the Row/Column
    JMP     B_Top
B_Ending:
    RET
BPrint ENDP
END

---
 * Origin: Midnight Micro!  V.32/REL  (918)451-3306 (1:170/600)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET