Category : Databases and related files
Archive   : CARDFILE.ZIP
Filename : QP-TURBO.ASM

 
Output of file : QP-TURBO.ASM contained in archive : CARDFILE.ZIP
;QPRINT.ASM - performs Quick Printing with Turbo Basic
;Note: Assemble this with MASM (2.0 or later), then LINK, convert
; to a binary file with EXE2BIN, and finally rename as QPrint.Com
;Copyright 1987, Ziff Communications Co.

Code Segment Byte
Assume CS:Code

QPrint Proc Far

Begin: Push BP ;save registers for BASIC
Push DS

Mov AH,3 ;specify BIOS service to read cursor position
Mov BH,0 ;on text page zero
Int 10h ;this service returns row/column in DH/DL

Mov AL,DH ;put the current row number into AL
Mov CL,160 ;multiply by 160 to get start address of row
Mul CL ;do the multiplication, answer ends up in AX
Mov DH,0 ;clear DH for the Add below, we only want DL
Add AX,DX ;add the column once for the character byte
Add AX,DX ;and once more for the attribute byte
Mov DI,AX ;now DI holds starting address on the screen

Xor DX,DX ;zero out DX to look at low memory using ES
Mov ES,DX
Mov BX,0B000h ;assume the mono screen segment for now
Mov AL,ES:[463h] ;look at the video controller port address
Cmp AL,0B4h ;is it mono?
JZ Get_Params ;yes, skip over adding 800h to video segment
Add BX,800h ;no, adjust BX for a color monitor
Push BX ;and save it because the EGA test destroys BX

Mov AH,12h ;specify EGA BIOS EGA special function service
Mov BL,10h ;request EGA info
Int 10h ;call the BIOS
Cmp BL,10h ;if BL is still 10h, there's no EGA
JNZ EGA ;it is an EGA, skip ahead
Mov DX,3DAh ;not EGA, specify port to check for retrace

EGA: Pop BX ;get the video segment again

Get_Params: Mov BP,SP ;get stack pointer so we can find variables
Mov ES,BX ;move whatever segment is correct into ES
LDS SI,[BP+08] ;get the color that was passed
Mov AH,[SI] ;and put it into AH for screen writing below
LDS SI,[BP+12] ;put descriptor to X$ into SI
Mov CX,[SI] ;put Len(X$) into CX for loop counter
And CX,7FFFh ;clear the length hi-bit
Mov SI,[SI+02] ;put address of first character in X$ into SI
JCXZ Exit ;if CX is zero it's a null string, exit now
Pop DS ;get DS back to find the string data segment
Push DS ;save it again
Mov DS,DS:[0000] ;the data segment is located at DS:[0000]
Cld ;clear the direction flag to move data forward

Check_Mon: Cmp DL,0 ;are we on a mono or EGA system?
JZ Mono ;yes, skip over the retrace stuff

No_Retrace: In AL,DX ;get the video status byte from port number DX
Test AL,1 ;test just the horizontal retrace bit
JNZ No_Retrace ;if doing a retrace, wait until it's not

Retrace: In AL,DX ;get the status byte again
Test AL,1 ;are we doing a retrace now?
JZ Retrace ;no, wait until we are

Mono: Lodsb ;get the character from X$ and increment SI
Stosw ;store both the character and attribute
Loop Check_Mon ;loop until CX is zero

Exit: Pop DS ;restore the registers for BASIC
Pop BP

QPrint Endp
Code Ends
End Begin


  3 Responses to “Category : Databases and related files
Archive   : CARDFILE.ZIP
Filename : QP-TURBO.ASM

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/