Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!pro-generic.cts.com!ericmcg From: ericmcg@pro-generic.cts.com (Eric Mcgillicuddy) Newsgroups: comp.sys.apple Subject: HyperC Message-ID: <11186.infoapple.net@pro-generic> Date: 19 Feb 90 09:41:55 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 132 Routed the messages via Echo Point again, eh? Anyhow, here are answers to some of the questions posted about HyperC. global zero page locations (as posted by m.j pender) sp stack pointer system not hardware. fp frame pointer pc program counter for the interpreter r1-r4 work registers jp addressing register dsip0-disp15 display registers you are free to use r1-r4, jp, smask for your own uses, however do not alter the other locations, or restore them upon completion otherwise the C-engine will get lost. stack items are always 2 byte items. r1 always holds the returned value and is always a 2 byte value (this is a 16 bit compiler running on an 8-bit machine) to use 65c02 opcodes use -e in asm65 calls (modify cc, ccn batch files) getchar(fp) is called getc(fp) and returns an INT, -1 if an error (not 255 I think, although this may work since the flags are set on 8 bit values - it would be machine specific though) inline assembly is not supported. mainly because there are two assemblers, one pseudo - opcodes and the other using native opcodes. All parameters are 16 bit values, check the C-stack for them using (sp),y addressing (from assembly). Return any values in r1 (remember 16 bits). If ther is interest I will provide info on the native mode assembler, it is basically like orca/m,but uses different keywords to implement constants and storage. The screen can be cleared using page(). Works with printer output also. Note that most of these screen functions assume that c3out is active (you're in 80 columns), some will work in 40 cols, some will not. there are several functions to read the keyboard. conRead(buffer,maxchars) is the most versatile, it accepts maxchar-2 characters and appends a newline and null character. terminates entry, is a space, and cancels the last character, clears line without exitting function, toggles state of printing, and aborts the program by calling system error handler (abort code 13). text is echoed to the stdout. kbdRead(is identical, except that it does not echo output. getkey(buffer) gets the next key from the a2 keyboard with high bit clear. ^^^^ clrbuffer - boolean, when set buffer purged and next keypress awaited. keypress() returns boolean of keyboard latch, polls latch rather than waiting for keypress. If using a ramdisk, I suggest the easiest method is to use autoexec to copy the neccessary files and the rename the volume to /csys. This requires no re-witting of the various batch files. A 512k disk is about minimum useful size. If you are not using the floating point libraries, non-integers are consdered 8 byte values. putchar(fp) is called putc(fp) - fp is the prodos file id (0-7). The person who wrote this compiler hated to type more than Ritchie, so try reducing letters on common C functions, you should find most of them. argc, argc are called av, ac by this guy! to read files try the following: INT c; while (c=getc(myfile)) >= 0) { pissaround(); . : } it stops when -1 is encountered. it should be $ffff, so any 8-bit ASCII value is good, unless two deletes in a row. I'm not sure, try it. Shell commands ls, cp, etc. do not support switches. Shell functions sym, lnk, asm65, etc. do. System programs - The programmer is responsible for all details required to implement a sys application. mksys only changes the filetype, nothing more. A makesys() function could be drawn up for inclusion fairly easily. To make The C runtime libraries needed by stand alone applications and the operating system interface are located in the low memory (basically, the shell). Your programs don't need a separate copy of the code unless you intend to make fully stand alone programs. (professional Prodos users only - That's us). This is verbatim out of the manual, but is not explianed at any time in the manual, therefore I assume you must ship the shell with your program in order to get it to run. try lnk -c foofile and look at the output this generates a symbol table for foofile without cluttering it with code or data. Most of the utillities are linked with -s option, which kills the symbol after linking making it hard to see what libraries are used. Bitsets - but first enums - enums allow single bits to represent values. enum color (red,blue,green) ctrgun=red; bckgrnd=green; -since color has less than 257 values it occupies a single byte - equivalent to #define red 0 #define green 1 #define blue 2 typedef unsigned char color; color crtgun=red; color bckgrnd =green; e.g. x=(enum color) y; - I assume 'y' holds the required bit- 'red'? bitsets are packed arrays of bits - similiar to a struct or union, except that its namespace is the same as that used by variables, functions and typedefs. bitset colorset {enum color} pallette = {red, blue} e.g. ok = x in (colorset) y; ok = x in(bitset colorset) y; ok = x in (bitset (red..green) y; - not reccommended -elements can be added tor removed from bitsets with +,- respectively e.g. pallette += black pallette -= blue; removes blue from bitset sym output codes : a - absolute b - bss d - data t - text (really executable code) x - xternal reference 0x# - address of symbol, relative name - symbol name I think you will find HyperC much closer to Ansi C than K&R, I hope this has helped straighten out some difficulties. Post more questions a nd I'll see what I can do.