print via interrupt

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!
Post Reply
SMcClouth
Coder
Posts: 32
Joined: Wed Jun 06, 2012 11:45 am

print via interrupt

Post by SMcClouth »

For my program I'm using a routine to print, which is as following:

Code: Select all

SUB printf (fmt AS STRING)
temp$ = ""
FOR i% = 1 TO LEN(fmt)
	IF MID$(fmt, i%, 2) = "/n" THEN
		temp$ = temp$ + CHR$(10) + CHR$(13)
	END IF
	temp$ = temp$ + MID$(fmt, i%, 1)
NEXT i%
FOR i% = 1 TO LEN(fmt)
	char = ASC(MID$(temp$, i%, 1))
	RegsX.AX = &HE00 + char
	RegsX.BX = 1
	InterruptX &H10, RegsX, RegsX
NEXT i%	
END SUB
I use this because I don't want to use the standard PRINT and for obvious reasons I'm want it to resemble the C-function. Besides that it has to run in SCREEN 0 but I can't get it anyway to use colors. Does anyone know how to achieve this?

Thanks in advance!
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
SMcClouth
Coder
Posts: 32
Joined: Wed Jun 06, 2012 11:45 am

Post by SMcClouth »

hey burger2227 already saves me time since I only use PDS... I'll check it out. Thx mate!
Post Reply