Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
bottom line print
#11
I developed a simple toolkit for textmode:

Code:
SUB PutChar (dSeg%, dOff%, x%, y%, c%, chr%)
    DEF SEG = dSeg%
    POKE dOff% + 160 * y% + 2 * x% + 1, c%
    POKE dOff% + 160 * y% + 2 * x%, chr%
    DEF SEG
END SUB

You can directly write to screen 0 using:

Code:
PutChar &HB800, 0, x%, y%, foreground%+background%*16, chr%

Where x% and y% are the coordinates, foreground% and background% are the colours, and chr% is the ASCII code of the char you wanna print.

But this is really suited to use an offscreen text mode buffer:

Code:
DIM Buffer%(1999)

PutChar VARSEG(Buffer%(0)), VARPTR(Buffer%(0)), x%, y%, foreground% + background%*16, chr%

To blit the buffer to screen you can use (for example) the superb memcopy routine by Jonathan L. Leger ::

Code:
'===========================================================================
' Subject: PATCHED MEMCOPY ROUTINE           Date: 02-27-98 (00:57)
' Author:  Jonathan L. Leger                 Code: QB, QBasic, PDS
' Origin:  leger@earthlink.net             Packet: MEMORY.ABC
'===========================================================================
defInt A-Z

DECLARE SUB initMemCopy ()
DECLARE SUB memCopy (fromseg%, fromoffset%, toseg%, tooffset%, bytes%)
DECLARE SUB fillChar (segment%, offset%, value%, bytes%)

DIM SHARED memCopy.ASM AS STRING
Dim Array1(1 To 1000) As Integer
Dim Array2(1 To 1000) As Integer

initMemCopy

'*** Fill the first array.
For Value = 1 To 1000: Array1(Value) = Value: Next Value

'*** Copy the contents of Array1() into Array2()
a1seg = VARSEG(Array1(1))        '*** Segment location of Array1()
a1off = VARPTR(Array1(1))        '*** Offset of Array1()
a2seg = VARSEG(Array2(1))        '*** Segment location of Array2()
a2off = VARPTR(Array2(1))        '*** Offset of Array2()
bytes = 2000                     '*** Number of bytes (integer = 2 bytes)
memCopy a1seg, a1off, a2seg, a2off, bytes

'*** Show second array's contents.
For Value = 1 To 1000: Print Array2(Value);: Next Value

End

defSng A-Z
Sub initMemCopy()

memCopy.ASM = ""
memCopy.ASM = memCopy.ASM + Chr$(85)                             'PUSH BP
memCopy.ASM = memCopy.ASM + Chr$(137) + Chr$(229)                'MOV BP,SP
memCopy.ASM = memCopy.ASM + Chr$(30)                             'PUSH DS
memCopy.ASM = memCopy.ASM + Chr$(139) + Chr$(70) + Chr$(10)      'MOV AX,[BP+0A]
memCopy.ASM = memCopy.ASM + Chr$(142) + Chr$(192)                'MOV ES,AX
memCopy.ASM = memCopy.ASM + Chr$(139) + Chr$(70) + Chr$(14)      'MOV AX,[BP+0E]
memCopy.ASM = memCopy.ASM + Chr$(142) + Chr$(216)                'MOV DS,AX
memCopy.ASM = memCopy.ASM + Chr$(139) + Chr$(118) + Chr$(12)     'MOV SI,[BP+0C]
memCopy.ASM = memCopy.ASM + Chr$(139) + Chr$(126) + Chr$(8)      'MOV DI,[BP+08]
memCopy.ASM = memCopy.ASM + Chr$(139) + Chr$(78) + Chr$(6)       'MOV CX,[BP+06]
memCopy.ASM = memCopy.ASM + Chr$(243)                            'REPZ
memCopy.ASM = memCopy.ASM + Chr$(164)                            'MOVSB
memCopy.ASM = memCopy.ASM + Chr$(31)                             'POP DS
memCopy.ASM = memCopy.ASM + Chr$(93)                             'POP BP
memCopy.ASM = memCopy.ASM + Chr$(203)                            'RETF

End Sub

defInt A-Z
Sub memCopy(fromseg%, fromoffset%, toseg%, tooffset%, bytes%)

DEF SEG = VARSEG(memCopy.ASM)
Call Absolute(byVal fromseg%, byVal fromoffset%, byVal toseg%, byVal tooffset%, byVal bytes%, SADD(MemCopy.ASM))
DEF SEG

End Sub

You just call the rutine to blit your buffer this way:

Code:
memCopy VARSEG(Buffer%(0)), VARPTR(Buffer%(0)), &HB800, 0, 2000

I used all those techniques in my textmode game (that I've posted here a couple of times, but it seems that nobody has seen it):

··<[ Nadya ]>··

Smile
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#12
Sorry for the double post, but I'm gonna call this proggie the "thread killer". I've posted it three times, and the three times it killed the thread.

C'mon, I only need a simple comment Big Grin
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#13
To all the "n00bs" who think I am wrong...you probably aren't realizing that QB displays the "Press any key to continue message" over row 25...

Code:
LOCATE 25,1
PRINT "this doesn't work, huh?";
SLEEP

Yeah. That's what I thought. Tongue
Reply
#14
I did
Code:
LOCATE 1,1
PRINT "#"
LOCATE 25,1
PRINT "#"
SLEEP
/post]
Reply
#15
If this doesn't work for you (i.e., put 25 lines of text on your screen), you've got a problem with something or other:


FOR I = 1 TO 25
LOCATE I, 1
PRINT "THIS IS LINE "; I; ".";
NEXT I
WHILE INKEY$ = "": WEND
END
ravelling Curmudgeon
(geocities sites require copying and pasting URLs.)
I liked spam better when it was something that came in a can.
Windows should be defenestrated.
Reply
#16
*_* Definitely, it is not worth showing anything ... he he he

Tongue
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)