[comp.sys.apple2] C language, RAM5 memory question

greyelf@wpi.WPI.EDU (Michael J Pender) (10/31/90)

1.  Does anyone know of a way to reserve a section of memory in HyperC?
I want to use the hires graphics, but not eat my own program.

2.  How do I return a value to a calling routine from assembler in Hyper C?
I've tried putting the value in r1, r1h, but it didn't pass the value back.

3.  I want to do a sequence of reads and writes from a slot 5 ramcard
at assembler level.  Sometimes when I try this I get garbage instead of the
data I placed there.  Do I have to initialize the card first, or just assume
prodos does?  Do I have to do a Pascal 1.1 standard read/write call before
just making a bunch of lda/sta calls from location medata?

4.  Hyperc lacks a scanf function.  Why don't we just take the c code for
a scanf function from a language like small C and use that?  Anyone have
small C out there?

I know I asked these questions before, but it is very important to me to 
have the answers before the weekend.
-- 
---
Michael J Pender Jr  Box 1942 c/o W.P.I.   Part of this D- belongs to 
greyelf@wpi.bitnet   100 Institute Rd.     God...  

BRL102@psuvm.psu.edu (Ben Liblit) (10/31/90)

In article <1990Oct30.201113.31554@wpi.WPI.EDU>, greyelf@wpi.WPI.EDU (Michael J
Pender) says:
>
>1.  Does anyone know of a way to reserve a section of memory in HyperC?
>I want to use the hires graphics, but not eat my own program.

Write your routines normally, but at link time, specify:

   lnk -tb0x4000 <any other switches> <file name>

The -tb# switch sets the start of the text area (actually, this is the program
code).  Since the BSS and data sections are, by default, placed at the *end* of
the text section, this will guarantee that the finished product will be loaded
above hires page one.  Use -tb0x6000 if you need to reserve both hires pages.

I realize that this doesn't actually reserve the memory area, merely avoids it.
So far, I know of no way to reserve an area of memory without actually having a
part of your file that gets loaded into it.  And I doubt you want the extra 8K
overhead that you'd get by declaring the hires page as, say, an array of chars.

Hmm ... does anybody know just what exactly "BSS" stands for anyway?

                            Ben Liblit
                            BRL102 @ psuvm.bitnet -- BRL102 @ psuvm.psu.edu
                            "Fais que tes reves soient plus longs que la nuit."

toddpw@nntp-server.caltech.edu (Todd P. Whitesel) (11/01/90)

If your ram card is an AE RamFactor then you most certainly have to access a
c5xx location first, because it enables the counter and data locations.
This might apply to Apple's Memory Expansion Card also, I don't know for sure.

Todd Whitesel
toddpw @ tybalt.caltech.edu

greyelf@wpi.WPI.EDU (Michael J Pender) (11/02/90)

In article <1990Nov1.015319.10227@nntp-server.caltech.edu> toddpw@nntp-server.caltech.edu (Todd P. Whitesel) writes:
>
>If your ram card is an AE RamFactor then you most certainly have to access a
>c5xx location first, because it enables the counter and data locations.
>This might apply to Apple's Memory Expansion Card also, I don't know for sure.
>
>Todd Whitesel
>toddpw @ tybalt.caltech.edu

I load the address I want into meadrs low, mid and high, and then try a 
read command from medata.  But I get garbage on performing the read.
I want to know if I have to do a protocol read call first, then just
sequentially access the card....

-- 
---
Michael J Pender Jr  Box 1942 c/o W.P.I.   Part of this D- belongs to 
greyelf@wpi.bitnet   100 Institute Rd.     God...  

toddpw@nntp-server.caltech.edu (Todd P. Whitesel) (11/02/90)

greyelf@wpi.WPI.EDU (Michael J Pender) writes:
>I load the address I want into meadrs low, mid and high, and then try a 
>read command from medata.  But I get garbage on performing the read.
>I want to know if I have to do a protocol read call first, then just
>sequentially access the card....

You shouldn't need to call the firmware at all. But at least on the RamFactor,
an access to CnXX is all you need to do before you set up the low/mid/high
address and read/write the data. This is because a reset disables the c08x
registers and an access to CnXX enables them.

Todd Whitesel
toddpw @ tybalt.caltech.edu