Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help with HyperC

1 view
Skip to first unread message

Kid

unread,
Jan 27, 1994, 1:52:10 PM1/27/94
to
/* Read, show shape tables */

#include <std.h>

main()
{
char shap190; /* Use any number */
FILE f;
f = open("ASCII.SHP");
read(f,24576,1493);
hgr();
offgrph();

}

______________________________________________

Question. I think I'm doing this right, but I doubt it. :) Please tell me
what I'm doing.

I loaded a shape table, which is 1493 bytes long, at memory location
24576 ($6000?). I turned hires graphics on and off real quick just
to show I was doing something.

My next task is to make my program read the first shape and display it
on the hires screen, then erase the shape, and show the next shape
on the screen. The final product would flash A-Z etc (my shape table is the
first 65 ASCII characters) on the hires screen and then turn hires graphics
off.

What subroutine do I plug in next to get this accomplished? Please
send email, I'll post a summary of replies. Thanks.

Soenke Behrens

unread,
Jan 30, 1994, 10:39:38 AM1/30/94
to
Kid (neid...@eden.rutgers.edu) wrote:
: /* Read, show shape tables */

: #include <std.h>
: main()
: {
: char shap190; /* Use any number */
: FILE f;
: f = open("ASCII.SHP");
: read(f,24576,1493);
: }

Umm. I'm not familiar with Hyper-C, but if it's anywhere _near_ usual
C packages, shouldn't that be "int f;"??

Just my 0.02.

Soenke

--
===========================================================================
I live with amnesia, dancing with the ! Soenke Behrens
shadows of my memory. ! Tumblinger 54/205
! 80337 Muenchen

Wulf Hofbauer

unread,
Feb 1, 1994, 5:05:58 AM2/1/94
to
In article <1994Jan30....@informatik.tu-muenchen.de>,
Soenke Behrens <behr...@Informatik.TU-Muenchen.DE> wrote:
>Kid (neid...@eden.rutgers.edu) wrote:
>: /* Read, show shape tables */

>: #include <std.h>
>: main()
>: {
>: char shap190; /* Use any number */
>: FILE f;
>: f = open("ASCII.SHP");
>: read(f,24576,1493);
>: }
>
>Umm. I'm not familiar with Hyper-C, but if it's anywhere _near_ usual
>C packages, shouldn't that be "int f;"??

HyperC is quite near to K&R. File handling is not part of the C
language and thus library-dependent.

In fact, FILE is #defined as int in the original distribution, I've
redefined it as char for my personal use (the libraries use the ProDOS
8 file descriptors which are byte-sized).

As to the original question... I use my own graphics routines, so I
can't tell exactly what is wrong. Behaviour of this code is however
very dependent on code&data placement in memory (controlled by
some linker options). Memory below the first hires page is used by OPSYS
resp. the Opix kernel. You try to load the shape tables to 0x6000,
so I guess you want to use both hires pages (0x2000-0x5fff). You
must thus make sure all program sections (text, data, bss) cause no
memory conflict. If you use the default linker options, they will
conflict, causing unpredictable results.

I'd rather recommend to use a global or local static byte array to
hold the shape tables, so the compiler/linker will care for proper
memory allocation.

Btw, it would also be advisable to close the file before returning.

- Wulf
--
______________________________________________________
| |
| Wulf Hofbauer | zcaa...@rpool1.rus.uni-stuttgart.de |
| |

0 new messages