Zero-page usage by ROM routines

Here you can ask questions or provide insights about how to use efficiently 6502 assembly code on the Oric.
Post Reply
User avatar
Chema
Game master
Posts: 1910
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Zero-page usage by ROM routines

Post by Chema » Wed Mar 26, 2008 7:15 pm

Greetings.

I was not sure where to post this one.

I am not sure if it is documented anywhere, but I think it would be nice to have a list of zero-page addresses used by ROM routines, so if we are using ROM (even through C programs) we can avoid to put anything in those addresses.

I am not sure if most routines in ROM use the same range, or not, so this might be difficult to answer.

Even if, in the end, you will most probably avoid using ROM, it is quite common to have a C interface for testing your routines easily, and including printfs or getchars, calling hires, or something similar.

This could ruin your program if the called routines write on zero-page exactly where you are storing your pointers or any other useful data!

Any information about this?

Cheers.

User avatar
Symoon
Archivist
Posts: 1024
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France
Contact:

Post by Symoon » Thu Mar 27, 2008 9:07 am

That would be a great idea, for instance we could create a web page with the "definitive" use of the zero page.
As I'd see it, it could be a table with v1.0 and v1.1 columns indicating which routines use each byte. More colums could be added for the various disk operating systems (Sedoric, Jasmin...), and for the Telestrat.

This is documented in "l'Oric à Nu", but
- in French
- rather old - maybe new things discovered since
- we noticed a few, very rare, mistakes here or there

How could we set up the work on this ? So that anyone could participate and fill the table according to his knowledge (or books ;-))
Last edited by Symoon on Thu Mar 27, 2008 11:58 am, edited 1 time in total.

User avatar
Chema
Game master
Posts: 1910
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Post by Chema » Thu Mar 27, 2008 9:39 am

Symoon wrote:- in French
Ok. I can't help then :(

User avatar
waskol
Flight Lieutenant
Posts: 331
Joined: Wed Jun 13, 2007 8:20 pm
Location: FRANCE, Paris

Post by waskol » Thu Mar 27, 2008 10:20 am

Please, have a look to Geoffrey Phillips book (Oric Atmos and Oric 1 Graphics and Machine code techniques), chapter 5 :wink:
Where a ROM address is given you will find the version 1.0 presented first, followed by the version 1.1 address in parenthesis.
5.2 Use of page 0 memory

Any unspecified locations can be assumed to be used by the ROM but to be of no significance.

#00 – #0B – Unused by BASIC.

#10 – #11 – Address of current HIRES position.

#12 – #13 – Address of start of current line (in TEXT mode).

#14 – #15 – Used by the 8912 register load subroutine.

#18 – #19 – Used to point to the start of error messages.

#1A – #C – Contains a jump to the routine which prints ‘Ready’.

#1F – #20 – Address of last PLOT position.

#21 – #23 – Contains the DEF USR jump.

#28 – The type of data which resulted from formula evaluation; 0 means numeric, #FF means a string.

#29 – A flag that indicates whether the last variable used was an integer.

#2A – A flag which is used in several places.

#33 – #34 – Various uses, but often used to store a line number that is being located.

#35 – #83 – The BASIC input buffer. This is used to store anything that is typed, including immediate commands and INPUT data (which explains why an immediate command cannot use INPUT). This area is also used in version 1.0 during cassette operations – see Chapter 4.

#86 – Address of last temporary string.

#88 – #90 – A table of temporary strings.

#9A – #9B – Start of BASIC pointer.

#9C – #9D – Start of variables pointer.

#9E – #9F – Start of arrays pointer.

#A0 – #A1 – End of arrays pointer.

#A2 – #A3 – Pointer to next free string space.

#A6 – #A7 – Highest available memory location available to BASIC.

#A8 – #A9 – Current line number (read-only).

#AA – #AB - The current line number – saved for error messages.

#AC – #AD- Address of the start of the current instruction – 1.

#AE – #AF – Current DATA line number – used only when printing error messy ges. Altering this location does not change the READ sequence.

#BO – #B1 – The address of the next DATA item – 1. It is this address that one must modify in order to change the data accessed by the next READ command.

#B4 – #B5 – The identity of the last variable used.

#D0 – #D5 – The main floating-point accumulator.

#D8 – #DD – The second accumulator.

#E2 – #E7 – The get-character routine. This part increments the pointer at #E9, #EA and drops into address #E8.

#E8 – #F9 – The second part of the get-character routine. This section loads the next character, according to location #E9,#EA.

#FA – #FE – The current random number is stored here as a floating-point number.


And there is much more in his book !
And you can download it just right here on Defence-force :
http://www.defence-force.org/computing/ ... /index.htm

User avatar
Chema
Game master
Posts: 1910
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Post by Chema » Thu Mar 27, 2008 1:42 pm

waskol wrote:Please, have a look to Geoffrey Phillips book (Oric Atmos and Oric 1 Graphics and Machine code techniques), chapter 5 :wink:
I completely forgot about that book... even if I downloaded it long ago in my computer! Thanks indeeed.
Any unspecified locations can be assumed to be used by the ROM but to be of no significance.
Uh, oh...
#E2 – #E7 – The get-character routine. This part increments the pointer at #E9, #EA and drops into address #E8.

#E8 – #F9 – The second part of the get-character routine. This section loads the next character, according to location #E9,#EA.


That is the one I was looking for! I was reading the keyboard with jsr $023b and maybe it was corrupting my data...

But there are many other locations out there that could be used when I issue a printf a ping or even for making the cursor flash!

It is a bit nightmarish to get a zero-page memory map that works!

Cheers.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest