[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: And now, from the author of the DOS Disk post, a post that actually relates to this newsgroup.
Jon Bettencourt <jonINTERNETrelayCHAT@napaVALLEYnet.CLARInet> wrote:
> Is there any way to compile an Applesoft BASIC file to machine language?
> Either a BIN file or a SYS file; BIN would probably be easier to do.
There was the ancient TASC compiler, which worked under DOS 3.3.
> I tried the Beagle BASIC Compiler, but it seems to only compile COM files,
Is this 'COM' a ProDOS file type? According to the file type notes,
'COM' is file type $59, and is described as a "Communications file",
with an application-specific auxiliary type. None of these had been
defined as of the last publication of the file type notes.
I've never used Beagle Basic, but it might be using this filetype for
some kind of special binary image file which needs to be used in
conjunctin with a front end or runtime engine.
> which, when transfered to another disk, result in Integer BASIC files.
What other disk? Do you mean a DOS 3.3 disk or another ProDOS disk?
> Here is the short program I want to compile:
>
> 10 FOR X = 8192 TO 16383 : R = INT(RND(1)*256) : POKE X,R : NEXT X
>
> It fills page 1 of Hi-Res graphics with TV static. This happens very
> slowly. I know it can be done faster, after all there is a routine to
> clear the screen.
A compiled version of this wouldn't be much faster, because most of the
wasted time is due to dealing with floating point numbers.
A better idea would be to come up with a simple and fast random number
generator written in assembly language, and add some wrapper code which
fills the screen with random data. The wrapper code could even be a
BASIC program, if the overhead wasn't too much.
For example, there was a series of articles published in "The
Sourceror's Apprentice" many years ago, which described a cyclic
shift/XOR-based random number generator. It generates 8-bit random
numbers from a 32-bit seed variable, and has a repeat period of 2^32-1
(4194962795). The seed can be any value except zero, and could be
derived from memory locations $4E and $4F, which are incremented
continuously while the system is waiting for a keypress (with the
standard monitor routines, as used by GET and INPUT from BASIC).
I've used this algorithm on various other processors, and it seems to
work well, as long as it is seeded correctly.
I'll have to do a fair amount of digging to find the original 6502
version of the code.
--
David Empson
dempson@actrix.gen.nz
Snail mail: P O Box 27-103, Wellington, New Zealand