[LLVMdev] MOS6502 target

Bruce Hoult bruce at hoult.org
Thu Jul 3 14:25:33 PDT 2014


On Fri, Jul 4, 2014 at 6:21 AM, John Criswell <jtcriswel at gmail.com> wrote:

> On 7/2/14, 9:44 PM, Bruce Hoult wrote:
>
>> I've considered doing this as well :-) As an exercise to learn the LLVM
>> back end as much as anything.
>>
>> It probably makes sense to allocate 8 or 16 pairs of zero page locations
>> as virtual 16 bit registers and make 32 bit operations available only as
>> library routines/intrinsics.
>>
>
> One interesting problem with doing that is determining which zero page
> locations are free for use on the target machine.  The Apple II ROM, for
> example, reserves many of these locations for its own use. Other machines
> may reserve different locations within the zero page.


The monitor reserves very few. Mostly just screen cursor position and the
hooks for character in and out, if you want to use those. Or you can run on
bare metal and do your own screen drawing and exit by calling the monitor
init vector (e.g. the CPU reset vector).

DOS uses a few more, but not a lot.

The vast majority of locations marked as "reserved" are used by AppleSoft.
Which you can totally ignore if you're not a subroutine called by & from
BASIC. If you preserved monitor and DOS locations, then you can exit to the
AppleSoft init vector. You'll recall "3D0G" :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140704/800e0407/attachment.html>


More information about the llvm-dev mailing list