Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Compiler Brain Dump - Your Chance to Tell Me How Wrong I am - Haha

66 views
Skip to first unread message

Bill Chatfield

unread,
Dec 26, 2023, 11:49:53 AM12/26/23
to
I found ZBASIC. I've been looking at different structured BASICs and
compilers. ZBASIC seems pretty awesome. It can even do DHGR. Does
anyone have any experience or comments about it? It builds BIN
programs.

I've eliminated other BASIC compilers because they don't have
"structured" statements like WHILE/WEND, REPEAT/UNTIL,
IF/ELSE/ENDIF, optional line numbers & Functions with parameters.
If you don't have those, you're still just writing a bunch of GOTOs that
are very hard to read. I love ApppleSoft BASIC, but for large programs,
it gets pretty hard to manage.

My main problem with Kyan Pascal is that the programs have to
run in it's special environment. You can also build a .SYSTEM file but
it also needs the runtime library to work. It's not really building a
stand-alone executable (BIN) file. That annoys me. And it takes a
LONG.... time to load that runtime library, for every program you want
to run. This kind of eliminates it for small programs. And it exits
BASIC.SYSTEM when it's done.

I know cc65 is the ultimate, but you're not actually using the Apple II
when you develop the program. It's more efficient that way. But, the
goal of retro is to use the retro computer. I do use cc65 and I love
it, but it would be nice to also have an Apple II hosted development
system.

I know Aztec C exists. But I haven't tried it. I love C but I find that
other people have a harder time reading the code because it is cryptic.
If you've done AppleSoft BASIC, something like ZBASIC is going to be
easier for you to read than C code. Pascal is easier to read than C,
unless you have a lot of experience with C or Java/C++/C#/etc. For
example, a young person learning to program who learns AppleSoft BASIC
could transition to ZBASIC and build compiled BIN programs every
easily. Kyan Pascal would be better, but it has the runtime library
that takes forever to load.

I can write Assembly "Language" but it is so slow to write simple
things. And most people can't even read it.

I want other people to be able to read and understand my code. I feel
like it is a means of communicating how to accomplish tasks and how the
machine works.


Brian Patrie

unread,
Dec 27, 2023, 6:35:54 AM12/27/23
to
Bill Chatfield wrote:
> And it exits BASIC.SYSTEM when it's done.

It's more apropos to say that a SYS program exits BASIC.system at
launch. A ProDOS Quit call (or a reboot) is the only kosher way to exit
a SYS app--especially since a large program is likely to step on
BASIC.system in memory.

BIN files are great for little things that are going to be called from
AppleSoft; but for a major project SYS makes more sense (at least to me).

Bill Chatfield

unread,
Dec 27, 2023, 11:24:57 AM12/27/23
to
Yeah, that makes sense. It is more correct to say it that way. Most of
the time I want to write little things for functionality that is
missing in the AppleSoft "shell". I can never get through a major
project before I lose interest. Ha ha.

I am Rob

unread,
Dec 30, 2023, 2:15:03 PM12/30/23
to
> I found ZBASIC. I've been looking at different structured BASICs and
> compilers. ZBASIC seems pretty awesome. It can even do DHGR. Does
> anyone have any experience or comments about it? It builds BIN
> programs.
>
> I've eliminated other BASIC compilers because they don't have
> "structured" statements like WHILE/WEND, REPEAT/UNTIL,
> IF/ELSE/ENDIF, optional line numbers & Functions with parameters.
> If you don't have those, you're still just writing a bunch of GOTOs that
> are very hard to read. I love ApppleSoft BASIC, but for large programs,
> it gets pretty hard to manage.

> I can write Assembly "Language" but it is so slow to write simple
> things. And most people can't even read it.

> I want other people to be able to read and understand my code. I feel
> like it is a means of communicating how to accomplish tasks and how the
> machine works.

There are add-ons for Applesoft Basic. There is an IF/ELSE/THEN and REPEAT/UNTIL add-on. The REPEAT/UNTIL is actually quite a bit faster than a FOR/NEXT loop.

For the most part, most people just don't know how to program Applesoft Basic efficiently.

If you are using too many GOTO's in your programs, then should consider using more ON/GOTO's or better yet ON/GOSUB.

instead of:

10 GET CHOICE
15 IF CHOICE=1 THEN GOT0 xxyy
20 IF CHOICE=2 THEN GOTO yyxx

you would use

10 GET CHOICE
15 ON CHOICE GOSUB 100,200,300
20 GOTO 10

100 DOTHIS : RETURN
200 DOTHAT : RETURN
300 DOMORE : RETURN

There is even an add-on that reduces line #15 to

15 GOSUB 100*CHOICE

Another add-on allows for GOTO/GOSUB "label" to identify your subroutines.


As for Machine Language, once you start collecting or creating sub-routines, it becomes very efficient down the road as the subroutines can then be imported into larger programs. You will see a lot of source code that has INCLUDE "subroutine". But higher languages are difficult to program to use imported sub-routines.

Bill Chatfield

unread,
Dec 31, 2023, 11:37:51 AM12/31/23
to
On Sat, 30 Dec 2023 11:15:01 -0800 (PST)
I am Rob <gid...@sasktel.net> wrote:

> 10 GET CHOICE
> 15 ON CHOICE GOSUB 100,200,300
> 20 GOTO 10
>
> 100 DOTHIS : RETURN
> 200 DOTHAT : RETURN
> 300 DOMORE : RETURN

I like this. But it limits you to menus like this:

1. New
2. Open
3. Save

Instead of

N)ew
O)pen
S)ave

Because ON/GOSUB only takes an integer for "CHOICE". But I suppose that
is not terrible.



I am Rob

unread,
Dec 31, 2023, 4:17:57 PM12/31/23
to
> > 10 GET CHOICE
> > 15 ON CHOICE GOSUB 100,200,300
> > 20 GOTO 10
> >
> > 100 DOTHIS : RETURN
> > 200 DOTHAT : RETURN
> > 300 DOMORE : RETURN
> I like this. But it limits you to menus like this:
>
> 1. New
> 2. Open
> 3. Save
>
> Instead of
>
> N)ew
> O)pen
> S)ave

Applesoft is a very capable language, albeit somewhat slow, and it can do that as well.

Just do a simple string comparison.
Here's a simple little input string to help you on your way.

10 CMD$="NOS"+CHR$(27)
15 ?"Command: N)ew O)pen S)ave <ESC> exits: ";
20 GET CHOICE$: FOR X=1 TO LEN (CMD$): IF CHOICE$ = MID$(CMD$,X,1) THEN ON X GOSUB 100,200,300,400: X=0
30 NEXT : END

100 ? "N was pressed": RETURN
200 ? "O was pressed": RETURN
300 ? "S was pressed": RETURN
400 POP : TEXT : END

Once you get into Machine Language programming you can significantly speed up lines 20 & 30 with & GET CHOICE$,CMD$,X : ON X GOSUB ...

Just be aware that Applesoft only recognizes the first 2 characters of a variable. Meaning CHOICE$ = CH$, or any word that starts with CH and that is a string variable. CHANCE$=CHOICE$=CHARACTER$=CHEAP$, but CHR$ is a reserved token and cannot be used as a variable. Get to know the Tokens that Applesoft uses so you don't accidently try to use them as variables.

One of the better Applesoft Technical manuals I have actually seen is the Laser 128 Technical Reference Manual and explains every Applesoft Token in detail. It is on Asimov.

https://mirrors.apple2.org.za/ftp.apple.asimov.net/documentation/hardware/machines/Laser%20128%20Series%20Technical%20Reference%20Manual.pdf

fadden

unread,
Jan 1, 2024, 10:42:23 AMJan 1
to
On 12/31/2023 1:17 PM, I am Rob wrote:
> One of the better Applesoft Technical manuals I have actually seen is the Laser 128 Technical Reference Manual and explains every Applesoft Token in detail. It is on Asimov.
>
> https://mirrors.apple2.org.za/ftp.apple.asimov.net/documentation/hardware/machines/Laser%20128%20Series%20Technical%20Reference%20Manual.pdf

I think you meant the User's Guide and BASIC Manual:


https://mirrors.apple2.org.za/ftp.apple.asimov.net/documentation/hardware/machines/Laser%20128%20User%27s%20Guide%20%26%20Basic%20Manual.pdf

I am Rob

unread,
Jan 1, 2024, 4:07:04 PMJan 1
to
Thanks. I was in a bit of a rush and didn't have time to verify which Manual.
0 new messages