Megalextoria
Retro computing and gaming, sci-fi books, tv and movies and other geeky stuff.

Home » Digital Archaeology » Computer Arcana » Apple » Apple II » Wrapping binaries in INTBASIC?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Wrapping binaries in INTBASIC? [message #371208] Tue, 24 July 2018 20:11 Go to next message
Steve Nickolas is currently offline  Steve Nickolas
Messages: 2036
Registered: October 2012
Karma: 0
Senior Member
I've seen a number of INTBASIC programs that have bits of 6502 code in
them. I've tried to figure out how to do this without luck

Basically - I'm trying to create a one-file program which can load
Applesoft into memory for either a ][, or a /// booted with the
bootloader I've been using (I still have to distinguish these two).

-uso.
Re: Wrapping binaries in INTBASIC? [message #371242 is a reply to message #371208] Wed, 25 July 2018 13:36 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: fadden

On Tuesday, July 24, 2018 at 5:11:59 PM UTC-7, Steve Nickolas wrote:
> I've seen a number of INTBASIC programs that have bits of 6502 code in
> them. I've tried to figure out how to do this without luck

I'm not sure any of the answers really explain it, but some info is here:

https://retrocomputing.stackexchange.com/questions/494/how-w ere-binary-subroutines-embedded-in-integer-basic-programs
Re: Wrapping binaries in INTBASIC? [message #371269 is a reply to message #371208] Thu, 26 July 2018 09:27 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: dmrogers99

On Tuesday, July 24, 2018 at 8:11:59 PM UTC-4, Steve Nickolas wrote:
> I've seen a number of INTBASIC programs that have bits of 6502 code in
> them. I've tried to figure out how to do this without luck
>
> Basically - I'm trying to create a one-file program which can load
> Applesoft into memory for either a ][, or a /// booted with the
> bootloader I've been using (I still have to distinguish these two).
>
> -uso.

I've been trying (off and on, mostly off) for some time to convert Wendell Sanders Apple Trek from Integer to Applesoft. He's got a little audio routine in there that when you LIST the program causes it to go nuts. I've worked around the LIST issue, but I still have to extract the audio routine. Mostly I'm still in the BASIC conversion process. It's kind of tedious, but a worthwhile distraction from time to time.

Anyway, from Apple's CONTACT magazine, MAY '78, page 4, there may be some clues. This is written for using TAPE, not disk, so there may be some differences with DOS loaded, I haven't looked into that yet. But here's the procedure (I've typed it in verbatim (minus a couple of typos, may have added a few):

LOADING MACHINE LANGUAGE AS PART OF A BASIC PROGRAM

Often we want to include machine language data inside a BASIC program. A great many Apple tapes are made up this way to simplify the loading process. Here’s a recipe for doing it yourself with programs written in Apple BASIC.

Apple BASIC loads programs into memory with the highest program line at the highest RAM location (HIMEM). Preceding lines are located lower and lower in RAM. The beginning of the program is at PP, an address which is held in memory locations CA and CB (hexadecimal), or 202 and 203, decimal. When you type SAVE, the the computer transfers to tape everything between PP and HIMEM. Thus, to tuck machine language into your program so that it can later be loaded like BASIC, it is merely necessary to move the PP pointer fown below the beginning of the extra code, put in two POKEs to reset the pointer before running the program, and type SAVE. Later, you will be able to LOAD the whole thing just as if it were all BASIC. Just follow these steps:

1. Get the BASIC program into memory, just the way you want it. If you make any changes, you must re-do steps 2 and 6.
2. In the command mode, type: PRINT PEEK (202), PEEK (203) and write down the results. Let’s call them m and n, respectively.
3. Load your machine language code into memory using the monitor load capability (xxxx.yyyyR). This will put the machine language program into memory below the beginning of the BASIC program, starting at hexadecimal address xxxx.
4. Take the starting address of the machine language program and divide it into two parts: xx/xx. Convert each pair of digits from hex to decimal values: a & b; corresponding to the left and right xx pairs, respectively. Write them down.
5. Now enter the BASIC command mode and type: POKE 202,b-1 (value b from step 4, above) Poke 203, a (value a from above step 4 above) POKE 204,00 POKE 205,8
6. You have now moved the pointers down below your machine language program, and must insert code to move them back again when the program is run. To do that, type 0 POKE 202,m: POKE 203,n: GOTO q where m and n are the values from Step 2, and q is the first line number in your BASIC program. That line number can be 0 – it will not be erased by the above entry.
7. Now you’re done! Don’t try to list your program before running it, because all you’ll see is a meaningless set of numbers and symbols. Just type SAVE (before running the program), and it will all go onto tape. Later a LOAD command will bring it all back in.
CAUTION!

Once you have RUN such a program, you cannot SAVE it, for the pointers will have been moved. You can only save or coapy a program like this before it has been RUN.


Good luck!

Dave Rogers
Re: Wrapping binaries in INTBASIC? [message #371271 is a reply to message #371269] Thu, 26 July 2018 11:16 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: fadden

On Thursday, July 26, 2018 at 6:28:00 AM UTC-7, dmrog...@yahoo.com wrote:
> Anyway, from Apple's CONTACT magazine, MAY '78, page 4, there may be some clues.

Excellent! Can't speak for anyone else, but that's exactly what I've been looking for.
Re: Wrapping binaries in INTBASIC? [message #371284 is a reply to message #371271] Thu, 26 July 2018 13:43 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: dmrogers99

On Thursday, July 26, 2018 at 11:16:17 AM UTC-4, fadden wrote:
> On Thursday, July 26, 2018 at 6:28:00 AM UTC-7, dmrog...@yahoo.com wrote:
>> Anyway, from Apple's CONTACT magazine, MAY '78, page 4, there may be some clues.
>
> Excellent! Can't speak for anyone else, but that's exactly what I've been looking for.

Well, not to confuse things - but I also found this while I was spelunking around my archives. It identifies certain issues that may be more relevant for the OP. I have clipped images that I can't post, but the original source is here: https://archive.org/stream/Best_of_Micro_The_Volume_1_1978_C OMPUTERIST_The_US#page/n105

There are probably a few other ways. There usually are.

Dave
Re: Wrapping binaries in INTBASIC? [message #371302 is a reply to message #371284] Thu, 26 July 2018 20:20 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: Tom Porter

I have no idea if this will be of any help, but I found a binary that converts Integer to Applesoft... its included on this disk here. BRUN it.

https://www.dropbox.com/s/x2flyemyxjnudq3/Apple%20DOS%203.3% 20January%201983.dsk?dl=0
Re: Wrapping binaries in INTBASIC? [message #371304 is a reply to message #371302] Thu, 26 July 2018 20:32 Go to previous message
Steve Nickolas is currently offline  Steve Nickolas
Messages: 2036
Registered: October 2012
Karma: 0
Senior Member
On Thu, 26 Jul 2018, Tom Porter wrote:

> I have no idea if this will be of any help, but I found a binary that
> converts Integer to Applesoft... its included on this disk here. BRUN
> it.

For what it's worth, the program I'm wrapping actually loads Applesoft on
an Apple ///. ;)

-uso.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: fancy lores graphics
Next Topic: Applevision is full HGR, not TEXT on HGR
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Apr 24 01:48:27 EDT 2024

Total time taken to generate the page: 0.04914 seconds