Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DECLARE SUB SetVideoSeg (sNewSeg() AS INTEGER)
- DECLARE SUB UpdateLine (SegArray() AS INTEGER, iLine AS INTEGER)
- REM $INCLUDE: 'qbx.bi'
- DEFINT A-Z
- DEFLNG L, P
- DEFSNG F
- REM $DYNAMIC
- CLS
- REDIM SHARED iBuff(32766) AS INTEGER
- iBuff(0) = 10
- DIM REGS AS RegType
- DIM SHARED iScreenSeg AS INTEGER
- DIM SHARED fTime
- DIM SHARED iSegSeg AS INTEGER, iSegPtr AS INTEGER
- REGS.ax = &H5100
- CALL Interrupt(&H21, REGS, REGS)
- SCREEN 13
- iSegSeg = 0: iSegPtr = 0
- IF VARPTR(iBuff(0)) <> 0 THEN END
- 'FF 0F A0 7D
- fTime = TIMER
- FOR lSeg = REGS.bx TO &HA000& STEP 64
- DEF SEG = lSeg
- FOR i = 0 TO 1023 STEP 2
- IF PEEK(i) = &HFF THEN
- IF PEEK(i + 1) = &HF THEN
- IF PEEK(i + 2) = &HA0 THEN
- IF PEEK(i + 3) = &H7D THEN
- PRINT ".";
- IF PEEK(i + 4) = &H0 THEN
- IF PEEK(i + 5) = &HA0 THEN
- lBuff = CLNG(VARSEG(iBuff(0))) AND &HFFFF&
- iBL = lBuff AND &HFF&: iBH = lBuff \ 256
- POKE i + 4, iBL: POKE i + 5, iBH
- IF POINT(0, 0) = 10 THEN
- PRINT : PRINT HEX$(lSeg) + ":" + HEX$(i)
- POKE i + 4, 0: POKE i + 5, &HA0
- iSegSeg = lSeg: iSegPtr = i + 4
- GOTO Found
- END IF
- POKE i + 4, 0: POKE i + 5, &HA0
- END IF
- END IF
- END IF
- END IF
- END IF
- END IF
- NEXT i
- NEXT lSeg
- Found:
- SetVideoSeg iBuff()
- PRINT "Buffered Graphics!"
- LINE (0, 0)-(319, 199), 15, B
- FOR i = 0 TO 31
- CIRCLE (-160 + RND * 640, -100 + RND * 400), 40 + RND * 100, 15
- LINE (-160 + RND * 640, -100 + RND * 400)-(-160 + RND * 640, -100 + RND * 400), 15
- LINE (-160 + RND * 640, -100 + RND * 400)-(-160 + RND * 640, -100 + RND * 400), 15, B
- NEXT i
- PRINT : PRINT " what? you see nothing?"
- WHILE ABS(TIMER - fTime) < 2: WAIT &H3DA, 8: WAIT &H3DA, 8, 8: WEND: fTime = TIMER
- FOR iX = 0 TO 319 STEP 1
- SELECT CASE iX
- CASE 105
- PRINT : PRINT " oh! i see it's buffering!!!"
- WHILE ABS(TIMER - fTime) < 2: WAIT &H3DA, 8: WAIT &H3DA, 8, 8: WEND: fTime = TIMER
- CASE 213
- PRINT : PRINT " wait for it, and..."
- WHILE ABS(TIMER - fTime) < 2: WAIT &H3DA, 8: WAIT &H3DA, 8, 8: WEND: fTime = TIMER
- END SELECT
- FOR iY = 3 TO 197 STEP 3
- IF POINT(iX, iY) = 0 THEN PAINT (iX, iY), 31 + RND * 224, 15
- NEXT iY
- NEXT iX
- DIM iScan(255) AS INTEGER
- FOR i = 0 TO 255: iScan(i) = i: NEXT i
- FOR i = 0 TO 255: SWAP iScan(i), iScan(RND * 255): NEXT i
- FOR i = 0 TO 255
- UpdateLine iBuff(), iScan(i)
- WAIT &H3DA, 8: WAIT &H3DA, 8, 8
- IF LEN(INKEY$) THEN END
- NEXT i
- SLEEP
- REM $STATIC
- SUB SetVideoSeg (sNewSeg() AS INTEGER)
- DEF SEG = iSegSeg
- lBuff = CLNG(VARSEG(sNewSeg(0))) AND &HFFFF&
- iBL = lBuff AND &HFF&: iBH = lBuff \ 256
- POKE iSegPtr, iBL
- POKE iSegPtr + 1, iBH
- END SUB
- SUB UpdateLine (SegArray() AS INTEGER, iLine AS INTEGER)
- STATIC iInit AS INTEGER
- STATIC asm() AS INTEGER
- IF iInit = 0 THEN
- REDIM asm(12) AS INTEGER
- iInit = 1
- asm(0) = &HBE60 'pusha | mov si, ...
- asm(1) = &HFFFF '0x????
- asm(2) = &H1E06 'push es | push ds
- asm(3) = &HFE8B 'mov di,si
- asm(4) = &H6836 'push ...
- asm(5) = &HA000 '0xA000
- asm(6) = &H6807 'pop es | push ...
- asm(7) = &HFFFF '0x????
- asm(8) = &HB91F 'pop ds | mov cx, ...
- asm(9) = &HA0 '0x00A0
- asm(10) = &HA5F3 'rep movsw
- asm(11) = &H71F 'pop ds | pop es
- asm(12) = &HCB61 'popa | retf
- END IF
- IF iLine < 103 THEN
- asm(1) = (iLine * 320&)
- ELSE
- asm(1) = -65536 + (iLine * 320&)
- END IF
- asm(7) = VARSEG(SegArray(0))
- DEF SEG = VARSEG(asm(0))
- CALL ABSOLUTE(VARPTR(asm(0)))
- END SUB
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement