Hey there,

I've been doing a bit of programming with QuickBasic
using MS-DOS 6.22 running under QEMU 0.9.0/x86/Linux.
It's all fine and dandy except for one (big) problem:
sin() and cos() don't work correctly.

Here's a demonstration:
http://nonlogic.org/dump/bin/1183539319-glitchy.exe

It works fine on a real PC, and even VMWare, but not
under QEMU. I'm pretty sure it's QEMU, as I don't have
the problem running it under QBasic 1.0, which I hear
*emulates* sin() and cos(). But, let's face it,
compared with QuickBasic 4.5, QBasic 1.0 sucks.

What happens under QEMU is, after drawing 1/8, it
draws the third 1/8 when it should be drawing the
second 1/8, and vice versa. Same goes with the sixth
and seventh 1/8s.

Here's the source code:
  CONST pi = 3.141592653589793#
  CONST p256 = pi / 128
  
  SCREEN 13
  FOR i = 0 TO 31
    PALETTE 0 + i, i * &H10101
    PALETTE 32 + i, i * &H2
    PALETTE 64 + i, i * &H200
    PALETTE 96 + i, i * &H202
    PALETTE 128 + i, i * &H20000
    PALETTE 160 + i, i * &H20002
    PALETTE 192 + i, i * &H20200
    PALETTE 224 + i, i * &H20202
  NEXT
  
  FOR i = 0 TO 256
    PSET (i, 0), i
    px = 160 + SIN(i * p256) * 80
    py = 100 + -COS(i * p256) * 80
    PSET (px, py), i
    t = TIMER
    DO: LOOP WHILE TIMER - t < .01
  NEXT

Note that it breaks with ANY use of sin() or cos()
under QB4.5.

--GreaseMonkey

Send instant messages to your online friends http://au.messenger.yahoo.com 


Reply via email to