[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: DRAW & XDRAW... How to use
On Thu, 06 Jan 2000 14:23:31 -0800, jh82
<webmasterNOweSPAM@jh82.i-p.com.invalid> wrote:
>10000 REM 1st shape
>10010 HPLOT #,# to #,# to #,# to #,#... etc, etc.
>10020 RETURN
>
>(If it matters, the way I use the routines is I do a X=#:Y=# and then
>gosub ######. the HPLOT is actually X+#,Y+#)
>
>As I said, there are about 60 of these, and I want to find the
>*fastest* way to get these on and off the screen.
Well, in general, BASIC will be horribly slow. Standard Apple
BASIC is an "interpreted" language, where the computer has to
decypher what each line of text means in machine code as it is
running the program. This conversion from BASIC to machine code
while running the BASIC program slows your program down.
It is much better to use direct machine code when you need
speed. Such code is "compiled", where you spend time to convert
it all at once from "source" into machine code, and the
resulting program is pure binary code.
Many times programmers use a combination of both BASIC and
machine language programs. This way you can write the "slow
stuff" in BASIC, but put the "fast stuff" in machine language.
Indeed, that is essentially what is happening when you use
DRAW and XDRAW for your graphics drawing.
The routines which are used to draw shapes written are in
machine code, so they run much faster than an equivelant
group of HPLOT commands. When the computer sees the
DRAW/XDRAW command, it is calling this machine code program
to quickly read your shape and put it on the screen.
Indeed, the data in the shapetable may look arcane, but it
is in a binary format which the DRAW/XDRAW routines can
directly read and quickly use, without the usual process of
BASIC interpretation.
If you need even more speed than DRAW/XDRAW can give you,
that's when you start looking for "graphics utility"
programs people have written to "extend" the functionality
of BASIC. DRAW/XDRAW is nice, but it's not quite the best.
There are faster ways yet to draw graphics, but then you'll
have to start making sacrifices in ease of use.
>P.S. I can't read hex numbers (yet), so could you post
>them as decimal?
Common Hex numbers on the Apple II:
Hex Decimal Usual function in the Apple II:
$0000 = 0 - $0000-00FF Zero Page (various data)
$0100 = 256 - $0100-01FF The CPU Stack
$0200 = 512 - $0200-02FF Keyboard typing buffer
$0300 = 768 - $0300-03CF Free memory
$03D0 = 976 - $03D0-03FF DOS/System Jump table
$0400 = 1024 - $0400-07FF Text Page 1
$0800 = 2048 - $0800-0BFF Text Page 2/Start of BASIC
$2000 = 8192 - $2000-3FFF Hires Page 1/BASIC
$4000 = 16384 - $4000-5FFF Hires Page 2/BASIC
$6000 = 24576 - $6000-95FF Free Memory/BASIC
$9600 = 38400 - $9600-BFFF Used by DOS
$C000 = 49152 - $C000-CFFF System I/O
(Note that $9600/38400 is not the absolute end of free
memory. It's the default 3 buffers in DOS 3.3, but may
move around in ProDOS as files are opened and closed,
or if you change the number of buffers in DOS 3.3..)
-Mr. Boffo
Email: mister_boffo@hotmail.com