回 帖 发 新 帖 刷新版面

主题:这里有宝臧!!!!!!

http://www.acidworks.com/

回复列表 (共2个回复)

沙发

Really GOOD!

进入网站后 进入QBASIC
对于里面的源程序的说明:
打开一个源程序后,看到所有的语句都连在了一起,
不要直接复制,那样是不能运行的!

要看到编排好的源程序,方法如下:
在源程序文本上 点右键-->查看源文件(V)
这样就打开了一个记事本,它里面的源程序是编排好了的!
另存为 “game.bas”(文件名加引号)
好了,运行看看!

板凳

Graphics
Use "WAIT &H3DA, 8" before updating the screen, it allows the screen time to refresh and helps animation appear flickerless.
SCREEN 13 is best for games, it has 256 colors and has had many libraries written for it.
When using SCREEN 13 use the following instead of PSET, it is much faster.
   DEF SEG = &HA000
   POKE X + (Y * 320&), color
   DEF SEG
  
Is SCREEN 13 use this instead of PALETTE, it is much faster and easier to use:
   OUT &H3C8, color to change
   OUT &H3C9, red value(a number from 0 to 64)
   OUT &H3C9, green value(a number from 0 to 64)
   OUT &H3C9, blue value(a number from 0 to 64)
  
Also to find out what values a color has use this:
   OUT &H3C7, color to find
   red value = INP &H3C9
   green value = INP &H3C9
   blue value = INP &H3C9
  
When using PUT remember that PSET is the fastest option.
To save the screen to a file in mode SCREEN 13 do:
   DEF SEG = &HA000
   BSAVE "insert file name here", 0, 64000
   DEF SEG
  
And to load that screen back up again do:
   DEF SEG = &HA000
   BLOAD "insert file name here", 0
   DEF SEG
  
Keyboard
Try using "keycode = INP(&H60)" instead of "keycode$ = INKEY$", it is much faster.
To clear the key board buffer and get rid of the annoying beeping sound, do this:
   DEF SEG=0: POKE &H41A, PEEK(&H41C)
  
To disable CTRL+BREAK and CTRL+C do this:
   DEF SEG = 0
   FOR x = 0 TO 3
    POKE (108 + x), PEEK (112 + x)
   NEXT
  
Math
Try to use integers(% and &) instead of floating point(! and #) numbers, they are much faster.
When dividing integers use "a \ b" instead of "INT(a / b)"
If you can add numbers("a + a") instead of multiplying("a * 2"), adding is much faster.
Also multiplying("x * x") is faster than raising a number to a power("x ^ 2").
To find out if a number is odd do "x AND 1", if it returns 1 it is odd.
You could also do "x MOD 2" to find out if a number is odd, if it returns 1 it is odd.
To find out if a number is divisible by another number do "x % y", if it returns 0 x is divisible by y.
Instead of doing "b = x : x = y : y = b" to swap the numbers x and y, do "SWAP x, y"
Timing
This can do about 1/70 of a second timing, but it depends what Hz rating your monitor is set at.
   SUB DELAY (seconds!)
    FOR a = 0 TO 70 * seconds!
     WAIT &H3DA, 8    
     WAIT &H3DA, 8, 8
    NEXT a
   END SUB
  
This one does about 1/19 of a second on all computers.
   SUB DELAY (seconds%)
    seconds% = seconds% * 19
    DEF SEG = 0
    POKE (1132), 0
   CountDown:
    IF PEEK(1132) < seconds% THEN GOTO CountDown
    DEF SEG
   END SUB
  

我来回复

您尚未登录,请登录后再回复。点此登录或注册