Apple-1 Newbie Needs Programing Advice

5 replies [Last post]
Offline
Joined: Jan 27 2012
Posts: 37

Greetings Apple-1 enthusiasts! Smile

I've searched all over the internet but I have not found the answer I'm looking for. This seems to be the best place to ask.

How do I convert something LIKE THIS ...

"Apple-1 Basic program"

10 PRINT "WELCOME TO ROCK PAPER SCISSORS"
20 DIM V$(10)
30 INPUT "ROCK OR PAPER OR SCISSORS", V$
40 IF V$ = "ROCK" THEN 100
50 IF V$ = "PAPER" THEN 200
60 IF V$ = "SCISSORS" THEN 300
100 A= RND (2)
105 IF A = 0 THEN 120
110 IF A = 1 THEN 130
120 PRINT "PAPER YOU LOSE"
125 GOTO 30
130 PRINT "SCISSORS YOU WIN"
135 GOTO 30
200 A= RND (2)
205 IF A = 0 THEN 220
210 IF A = 1 THEN 230
220 PRINT "SCISSORS YOU LOSE"
225 GOTO 30
230 PRINT "ROCK YOU WIN"
235 GOTO 30
300 A= RND (2)
305 IF A = 0 THEN 320
310 IF A = 1 THEN 330
320 PRINT "ROCK YOU LOSE"
325 GOTO 30
330 PRINT "PAPER YOU WIN"
335 GOTO 30
RUN

Into something LIKE THIS? (Apple-1 hex dump)

Fabricated EXAMPLE ONLY:

004A: 00 08 00 10 00 1B
0050: FF FF FF FF FF FF FF FF
0058: FF FF FF FF FF FF FF FF
0060: FF FF FF FF FF FF FF F6
0068: 9A F6 03 F3 01 05 01 03
0F28: 45 C2 40 2A CB 23 CB 72
0F30: 45 28 A0 A0 29 47 03 5B
0F38: 01 4C E4 07 5C B2 D0 07
0F40: 03 C4 71 C4 12 C3 12 38
0F48: C3 16 B1 01 00 72 14 B1
0F50: 0A 00 03 C1 B2 71 C1 B2
0F58: 12 38 C3 16 B1 01 00 72
0F60: 03 60 C4 1C B2 16 00 1E
0F68: C1 B2 16 B0 00 00 25 5B
0F70: 03 C1 B2 71 C1 B2 13 B1
0F78: 01 00 03 C4 71 C4 13 B1
0F80: 0A 00 03 5B 01 4C F8 07
0F88: 5C B2 D0 07 03 D0 71 D0
0F90: 12 C3 12 38 C3 16 B1 01
0F98: 00 72 14 B1 0A 00 03 C1
0FA0: B1 71 C1 B1 12 38 C3 16
0FA8: B1 01 00 72 03 60 D0 1C
0FB0: B2 16 00 1E C1 B1 16 B0
0FB8: 00 00 25 5B 03 C1 B1 71
0FC0: C1 B1 13 B1 01 00 03 D0
0FC8: 71 D0 13 B1 0A 00 03 5B
0FD0: 01 2F B8 0B 53 28 C2 C5
0FD8: D4 29 27 C2 03 60 C2 1A
0FE0: B3 B8 0B 25 5B 03 61 28
0FE8: CC C9 CD C9 D4 A0 C9 D3
0FF0: A0 A4 B3 B0 B0 B0 AE A0
0FF8: 29 47 03 5F B3 B8 0B 01
E2B3R
RUN

I'm looking for a FAIRLY SIMPLE to use Apple-1 Basic compile tool. If no such animal exists I would still be very interested in learning how to make Apple-1 hex dumps.

Any help on this matter would be greatly appreciated.

btw: I don’t own a Replica 1 nor do I own a MAC OS.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
speedyG's picture
Offline
Joined: Nov 16 2011
Posts: 2407
Re: Apple-1 Newbie Needs Programing Advice

probably it might be useful not only to publish what is not availiable but rather too explaining what is availiable....
if for example any thing is availiable to use sweet16 or merlin ( like an appleII series model or a pc with emulation )
then it might be a good idea to work with the apple II assembler and just restrict yourself to the use of memoryspace and make the code relocatable ( by options within the assembler ) and develop / generate the code at the apple II and thereafter transfer the code from there to the apple one by cable from cassetteinterface to cassette interface or by printing the compiled-code ( as dump from memory to printer ) and retyping it.....
thats just an idea for lazy guys like me and the due to the fact that i used to handle it that way years ago.....

another idea: within the code it can be shortened by just displaying to press only "S" for scissors, "P" for paper and "R" for rock and just picking one keypress from the keyboard....
and another idea to shorten the program would be to give the letters "S", "P" and "R" at the beginning values as variables that match the label of the correct subroutine and ask once for keypress and jump to labelvalue and if labelvalue is empty ( all other keys not defined ) repeat demand for keypress .....
and at the next point to save memory just onetime a routine to generate a value 0,1 or 2 and compare with keypress and decide the value to be greater ( win ) , equal ( no loose ) or smaller ( loose )...

__________________

In early days I had a lot of money but no time - now I have no money but a lot of time....
the second part includes less friends but a lot more joy on life....

Offline
Joined: Jun 5 2008
Posts: 381
Re: Apple-1 Newbie Needs Programing Advice

I'm not aware of any Apple 1 BASIC compiler, but you can save the binary.

On a 4K Apple 1 you can save most Basic programs through the cassette port, by saving 004A.00FF and 0400.0FFF.

if you have some kind of serial output device connected, just dump using the monitor
004A.00FF 0400.0FFF

Online
Joined: Oct 9 2011
Posts: 1058
Re: Apple-1 Newbie Needs Programing Advice

One more thing to add to Mike's comment.

Depending on your "LOMEM" and "HIMEM" settings, it's pretty easy to figure out what range to save.

So 004A.00FF is pretty standard as it's the internal setup for Basic, but the second area to dump is the actual code in Mike's example the 0400.0FFF, which correlates to a LOMEM of 1024 and a HIMEM of 4096.

If you set LOMEM to 768 and keep HIMEM at default, which is pretty common to get a little extra room for the code, then you'd use something like 004A.00FF 0300.0FFF

And as Mike said you'd typically save it on an Apple I to the ACI, or if you had a Replica-1 with serial output you could dump it that way. Steve Jobs wrote an article on how to hook up a printer to the Apple-1 if you are so inclined (I can post it if you want) but it does involve cutting traces and it's easier to use a 40 pin chip clip on the 6820 to get access to the lines and then use a UART to get a serial output to a printer or to a serial port (i.e. RS232/RS422), though I haven't attempted this kind of project yet.

Are you attempting to use an emulator or an Apple-1/Mimeo/Obtronix?

Cheers,
Corey

tranter's picture
Offline
Joined: Feb 1 2012
Posts: 23
Re: Apple-1 Newbie Needs Programing Advice

Have a look at this blog posting I made recently:
http://jefftranter.blogspot.com/2012/03/lomem-himem-and-saving-basic-programs.html

If anything is still not clear, just ask.

Offline
Joined: Jan 27 2012
Posts: 37
Re: Apple-1 Newbie Needs Programing Advice

Thanks to everyone for the helpful tips and advice. I'll be carefully studding everything posted in these threads. I'm completely new to all this, so please bear with me. Forgive me if any questions I may have on this subject seem “thick”.

Corey986 - I don't have the cash at the moment for a Mimeo/Replica 1 etc. I just plan on using an emulator for now. You are probably the person I should have asked first. You seem to really know your stuff. How to determine the address (start and end point) is a bit confusing for me at the moment. BTW: That's a great ASCII Lunar Lander. Wink

tranter - I'm going to read that blog link you posted right after I'm done here. I will definitely be asking more questions if I'm still not clear. I strongly suspect you will see me again with more annoying questions.

Mike WIllegal - Thanks for the 004A.00FF and 0400.0FFF binary tip.

speedyG - I'll look into that sweet16 or merlin.

BTW: "S", "P" and "R" worked very well. Thanks Smile