6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Thu Nov 21, 2024 12:57 pm

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Own variables
PostPosted: Sat Feb 15, 2020 1:20 pm 
Offline

Joined: Tue Jun 19, 2018 8:28 am
Posts: 122
I am using EhBasic as an "OS" in my homemade 6502 computer. It works fine,but now I try to incorporate some own code, to run peripherals I used in my design.
Now I am trying to add support for 8242 AT keyboard controller. For that I need a "cell" in a memory, where I can store received scancodes. Can you pint me a fragment of a memory space I can use without interfering with normal operation of EhBasic? Is it possible to use some location in Zero Page or is it entirely reserved for EhBasic?


Top
 Profile  
Reply with quote  
 Post subject: Re: Own variables
PostPosted: Sat Feb 15, 2020 1:53 pm 
Offline
User avatar

Joined: Fri Dec 12, 2008 10:40 pm
Posts: 1007
Location: Canada
I do something very similar, as I suppose many other do too.

You can change ram_base to give you as much memory as you need. It is set at $0300 as a default. If you need 512 bytes of memory set it to $0500 and you can be sure that $0300-$04FF will be available to you.

I also put my routines in ROM between BASIC and the vector area, then use CALL and USR() to run them. If I need to set up more parameters than I can pass with USR() I will just poke them into RAM before calling the routine.

_________________
Bill


Top
 Profile  
Reply with quote  
 Post subject: Re: Own variables
PostPosted: Sat Feb 15, 2020 5:23 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1748
Location: Sacramento, CA
You can safely use zero page locations $30 to $3F or $E2 to $EE. There are others also, but these are the ones I use the most.

Daryl

_________________
Please visit my website -> https://sbc.rictor.org/


Top
 Profile  
Reply with quote  
 Post subject: Re: Own variables
PostPosted: Sat Feb 15, 2020 5:28 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1488
Location: Scotland
I don't use it anymore, but when I ported EhBASIC to my system, I found it only used Zero page locations < $90. That leaves lots for your own use. My own OS uses $90 through $FF so it fitted really well. I used the 65C02 port though but I doubt the original one would be any different.

Quick check now, it seems the version I have has a different way to define ZP variables - every variable is defines as the last one +1, so check the sources.

Cheers,

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 23 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: