[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ZBasic
Mark Percival wrote:
To: magnusfalkirk
magnusfalkirk wrote:
Has anyone ever used this to
write a program for the Apple II and if so what do you think of it.
The first program that comes to mind is Jim Royal's, Star Trek: First
Contact. Excellent game.
http://www.apple2.org.za/mirrors/ground.icaen.uiowa.edu/apple8/Games/Startrek.fc2/STARTREK.FC.SHK
Interesting.
Looking at the compiled code, ZBASIC uses "JSR $082A / xx", where
xx is an interpretive opcode (followed by optional additional parameter
bytes), for all operations except simple 16-bit integer ops.
The interpreter is in the file RT.AUX.OBJ0.
So a typical program is:
JSR $082A
DB $28
JSR $082A
DB $2D
JSR $082A
DB $40
JSR $082A
DB $28
JSR $082A
DB $55
...
Since these JSR sequences often occur in long sequences, it would
have saved a lot of memory to use an interpretive loop to scan
through the ops instead of the JSR linkage (except to *enter* the
interpreter. One interpretive op would exit the interpreter and
give control to in-line code.
This is the Sweet-16 approach, and it could have saved as much as
75% of the program memory in ZBASIC. It would cost one extra byte
(say, 00) and slightly more time when "exiting" a string of
interpretive ops, but they appear seldom to be isolated.
Of course, time would be saved by not exiting and re-entering the
interpreter for each op.
So the code above could have been:
JSR $082A
DB $28
DB $2D
DB $40
DB $28
DB $55
DB $00
...
-michael
NadaNet networking for Apple II computers!
Home page: http://members.aol.com/MJMahon/
"The wastebasket is our most important design
tool--and it's seriously underused."
- References:
- ZBasic
- From: "magnusfalkirk" <dean.phares@gmail.com>
- Re: ZBasic
- From: "Mark Percival" <mark.percival@a2central.com.remove-1tv-this>