home *** CD-ROM | disk | FTP | other *** search
- DEFINT A-Z
- DECLARE SUB Menu1 ()
- ' ********************************************
- ' * QMouse.BAS *
- ' * Mouse Routine for MS-QBasic/IBM-QBasic *
- ' * 1 9 9 5 *
- ' ********************************************
-
- ' Robert Wolf TV & Radio Service
-
- '********************************* INI *************************************
-
- DEFINT A-Z
- DECLARE SUB Mouse (cx, dX, bx)
- DECLARE SUB MousePointer (SW)
- DIM SHARED a(9) 'Set up array for code
- DIM ball(10 * 10)
- DIM xball(10 * 10)
- DIM paddle(31 * 5)
- DIM block(61 * 11)
- SCREEN 12: CLS
- DEF SEG = VARSEG(a(0)) 'Get array segment (nnnn: )
- ' (two 8 bit)
- FOR i = 0 TO 17 'length of DATA to
- READ r 'read
- POKE VARPTR(a(0)) + i, r 'into array/2 (nnnn:iiii) (one 8 bit)
- NEXT i 'until 17
- CIRCLE (5, 5), 1, 3
- PAINT (5, 5), 3, 3
- GET (0, 0)-(10, 10), ball
- CLS
- GET (0, 0)-(10, 10), xball
- CLS
- LINE (1, 1)-(50, 6), 4, BF
- LINE (25, 1)-(50, 6), 5, BF
- GET (0, 0)-(51, 7), paddle
- CLS
- LINE (1, 1)-(60, 10), 2, BF
- GET (0, 0)-(61, 11), block
- CLS
- x = 320: y = 200
- xadj = 1: yadj = 1
- life = 5
- stage = 1
- '**************************** Machine Code *********************************
-
- DATA &HB8,&H00,&H00 : ' mov AX,[n] [Swap code-(L),(H)] in AX
- DATA &H55 : ' push BP Save BP
- DATA &H8B,&HEC : ' mov BP,SP Get BP to c Seg
- DATA &HCD,&H33 : ' int 33 Interrupt 33
- DATA &H92 : ' xchg AX,[reg] [Swap code-reg] in AX
- DATA &H8B,&H5E,&H06 : ' mov BX,[BP+6] Point to (variable)
- DATA &H89,&H07 : ' mov [BX],AX Put AX in (variable)
- DATA &H5D : ' pop BP Restore BP
- DATA &HCA,&H02,&H00 : ' ret 2 Far return
-
- '*********************** P R O G R A M S C R E E N ***********************
-
- start:
-
- LOCATE 10, 20: PRINT "Michael's New and Improved BREAKOUT!!!"
- LOCATE 11, 20: INPUT "(1)Keyboard or (2)Mouse"; choice
- LOCATE 11, 20: INPUT "Enter Level of Play(># slower; <# faster):", level
- IF level < 0 THEN level = 0
- IF level > 10 THEN level = 10
- IF level = 0 THEN level = 5
-
- CLS
-
-
- LINE (0, 0)-(5, 440), , BF
- LINE (0, 0)-(500, 4), , BF
- LINE (500, 5)-(495, 440), , BF
-
- start2:
-
- FOR hplace = 6 TO 440 STEP 61
- FOR vplace = 36 TO 413 STEP 11
- blocks = blocks + 1
- PUT (hplace, vplace), block
- IF stage = 2 THEN
- ST = ST + 1
- IF ST = 1 THEN PAINT (hplace + 2, vplace + 2), 14, 0
- IF ST = 2 THEN ST = 0
- END IF
- NEXT vplace
- NEXT hplace
-
-
-
- '****************************** Mouse set up ******************************
-
- CALL MousePointer(0) 'Reset mouse and
- CALL MousePointer(1) 'turn pointer on
- CALL MousePointer(3) 'Get coordinates
-
- '****************************** P R O G R A M ******************************
- 1
- DO WHILE k$ <> CHR$(27)
- k$ = INKEY$
-
- chk = dX
-
- 'lx = dx: qx = cx
- CALL Mouse(cx, dX, bx)
-
- 'LOCATE 22, 60
- 'PRINT cx 'Display Row
- 'LOCATE 22, 66
- 'PRINT dx 'Display Column
-
- IF life < chks THEN
- LINE (515, 50)-(600, 100), 0, BF
- END IF
-
- FOR dis = 1 TO (life - 1)
- ad = disp
- disp = dis * 15 + 500
- PUT (disp, 50), ball, PSET
-
- NEXT dis
-
- chks = life
-
-
-
- IF x > 480 THEN
- xadj = -1
- ELSEIF x < 10 THEN
- xadj = 1
- END IF
-
- IF y < 10 THEN
- yadj = 1
- END IF
- IF POINT(x + 5, y + 11) = 4 THEN
- yadj = -1
- xadj = xadj - 1
- IF xadj < -1 THEN xadj = -1
- ELSEIF POINT(x + 5, y + 11) = 5 THEN
- yadj = -1
- xadj = xadj + 1
- IF xadj > 1 THEN xadj = 1
- END IF
-
- IF POINT(x + 11, y + 5) = 2 THEN
- PAINT (x + 11, y + 5), 0, 0
- xadj = -1
- blocks = blocks - 1
- score = score + 100
- ELSEIF POINT(x - 1, y + 5) = 2 THEN
- PAINT (x - 1, y + 5), 0, 0
- xadj = 1
- blocks = blocks - 1
- score = score + 100
- END IF
- IF POINT(x + 5, y + 11) = 2 THEN
- PAINT (x + 5, y + 11), 0, 0
- yadj = -1
- blocks = blocks - 1
- score = score + 100
- ELSEIF POINT(x + 5, y - 1) = 2 THEN
- PAINT (x + 5, y - 1), 0, 0
- yadj = 1
- blocks = blocks - 1
- score = score + 100
- END IF
-
- IF POINT(x + 11, y + 5) = 14 THEN
- PAINT (x + 11, y + 5), 2, 0
- xadj = -1
- score = score + 150
- ELSEIF POINT(x - 1, y + 5) = 14 THEN
- PAINT (x - 1, y + 5), 2, 0
- xadj = 1
- score = score + 150
- END IF
- IF POINT(x + 5, y + 11) = 14 THEN
- PAINT (x + 5, y + 11), 2, 0
- yadj = -1
- score = score + 150
- ELSEIF POINT(x + 5, y - 1) = 14 THEN
- PAINT (x + 5, y - 1), 2, 0
- yadj = 1
- score = score + 150
- END IF
-
- LOCATE 1, 70: PRINT score
-
- IF blocks < 1 THEN
- stage = stage + 1
- GOTO start2
- END IF
-
- a = x: b = y
-
- x = x + xadj
- y = y + yadj
-
- IF k$ = CHR$(0) + "M" THEN kbd = ax + 20
- IF k$ = CHR$(0) + "K" THEN kbd = ax - 20
-
-
- 'FOR slow = 0 TO : NEXT slow
-
-
-
- IF choice = 2 THEN ax = dX
- IF choice = 1 THEN ax = kbd
-
- IF ax > 445 THEN ax = 440
- IF ax < 5 THEN ax = 5
-
- PUT (x, y), ball, PSET
- 'PUT (a, b), xball, PSET
- PUT (ax, 440), paddle, PSET
-
- LINE (5, 440)-(ax, 447), 0, BF
- LINE (ax + 50, 440)-(490, 447), 0, BF
-
- IF y > 430 THEN
- PUT (x, y), xball, PSET
- life = life - 1
- IF life = 0 THEN
- LOCATE 10, 25
- PRINT "You DIE!!!!"
- END
- END IF
- LOCATE 10, 25: PRINT "READY!"
- SLEEP
- LOCATE 10, 25: PRINT " "
- x = dX + 5
- y = 410
- xadj = 0
- yadj = -1
- END IF
-
-
-
-
-
-
- LOOP
-
- '******************************** Exit *************************************
- done:
- CALL MousePointer(2) 'Turn mouse off
-
- DEF SEG
-
- END
- '**************************** Return to Basic ******************************
-
- SUB Menu1
-
-
-
-
-
- ' IF bx = 1 THEN
- ' IF cx = 4 THEN
- ' IF dx >= 1 AND dx <= 47 THEN
- ' REM GOTO
- ' END IF
- ' END IF
- ' END IF
-
-
- ' IF bx = 1 THEN
- ' IF cx >= 10 AND cx <= 37 THEN
- ' IF dx >= 1 AND dx <= 47 THEN
- ' REM GOTO done
- ' END IF
- ' END IF
- ' END IF
-
- ' IF bx = 1 THEN
- ' IF cx >= 10 AND cx <= 37 THEN
- ' IF dx >= 1 AND dx <= 47 THEN
- ' REM GOTO done
- ' END IF
- ' END IF
- ' END IF
-
- END SUB
-
- SUB Mouse (cx, dX, bx)
-
- POKE VARPTR(a(4)), &H92 'Swap code,Get CX setup
- CALL absolute(cx, VARPTR(a(0))) 'Run Code
- cx = cx 'Adjust 25x80
- POKE VARPTR(a(4)), &H91 'Swap code,Get DX setup
- CALL absolute(dX, VARPTR(a(0))) 'Run Code
- dX = dX 'Adjust 25x80
- POKE VARPTR(a(4)), &H93 'Swap code,Get BX setup
- CALL absolute(bx, VARPTR(a(0))) 'Run Code
-
- 'Note :
- 'Remove the /8
- 'for graphics modes.
-
- END SUB
-
- SUB MousePointer (SW)
-
- POKE VARPTR(a(0)) + 1, SW 'Swap code,Set AX = (SW)
- CALL absolute(c, VARPTR(a(0))) 'Run Code
-
- 'Note:
- 'SW = 0-reset
- 'SW = 1-on
- 'SW = 2-off
- 'SW = 3-coordinates
-
-
- END SUB
-
-