$CPU 8086 ' make compatible with XT systems $LIB ALL OFF ' turn off all PowerBASIC libraries $ERROR ALL OFF ' turn off all PowerBASIC error checking $OPTIMIZE SIZE ' optimize for smaller code $COMPILE UNIT ' compile to a UNIT (.PBU) '$COMPILE EXE ' compile to a UNIT (.PBU) DEFINT A-Z ' Required for all numeric functions, forces PB to not ' include floating point in UNIT (makes it smaller) '/*------------------------------------------------------------------*/ $CODE SEG "MLIB1" DECLARE SUB GetStrLoc() ' internal string locator in RTL '/*------------------------------------------------------------------*/ SUB SAY(BYVAL Row AS INTEGER, BYVAL Col AS INTEGER, BYVAL Text AS STRING, BYVAL Attr AS INTEGER) PUBLIC DIM ScrnSeg AS INTEGER IF (pbvScrnCard AND 1) = 0 THEN ScrnSeg = &HB800 ' color monitor ELSE ScrnSeg = &HB000 ' mono monitor END IF ! push DS ; save DS for PowerBASIC ! push Word Ptr Text ; push string handle on the stack ! call GetStrLoc ; find the string ! jcxz QPExit ; if it's null, exit ! mov DS, DX ; put segment in DS ! mov SI, AX ; put offset in SI ! push CX ; save length ! mov AX, ScrnSeg ; put screen segment in AX ! mov ES, AX ; move to ES ! mov AX, Row ; put row in AX ! dec AX ; minus one ! mov CX, 160 ; AX = ! mul CX ; AX * 160 ! mov DI, AX ; put it in DI ! mov AX, Col ; put column in AX ! dec AX ; minus one ! shl AX, 1 ; times 2 ! add DI, AX ; add to DI ! pop CX ; restore length of string ! mov AH, Attr ; put attribute in AH WriteChar: ! lodsb ; get char from string ! stosw ; write char and attribute to screen ! loop WriteChar ; do it all CX times QPExit: ! pop DS ; restore DS for PowerBASIC END SUB '/*------------------------------------------------------------------*/ '/* $INCLUDE "C:\CODE\MLIB\MLIB.INC" '/* CLS '/* PRINT "TESTING SAY FUNCTION" '/* SAY 10,1,"This is a test.",12 '/* INPUT Z