Jump to content
IGNORED

CC8


576XE

Recommended Posts

Thank you!

 

Yes I know that CC8 works with ACEC Linker.

Really it's upgrade of ACEC (by designe). And we all know that the roots are from DBC.

 

They said that even LSC linker also works! (I tried programming code with DVC-LSC CEDIT.COM program. All works perfectly!

You only need to add appropriate runtimes on the disk with ACEC runtimes and deal done. No problem at all)

 

ACEC and CC8 need not runtimes on disk! It's very good design!

 

And the problem!

Please look at http://www.verycomputer.com/10_2482f67523b1814a_1.htm

It's a recent CC8 Documentation, and they said that somewhere in inet exists

CC8 Compiler Version 2.3b (3 of 3) which is UUencoded CC8.COM file.

I can't find this file at all.

 

This version has almost all bangs and whistles of C lang. (IMHO) I'm not a programmer!

 

Please!!!

Link to comment
Share on other sites

This guy:

 

https://www.linkedin.com/pub/john-palevich/4b/b92/667

 

worked with Steve Kennedy, the author of CC8.

 

Could be one of these guys:

https://www.linkedin.com/pub/steven-m-kennedy/9/b76/936

https://www.linkedin.com/in/kennedysm

 

I'd try this address:

"smk---AT---bosgd---DOT---att---DOT---com"

Link to comment
Share on other sites

Thank you!

 

Yes I know that CC8 works with ACEC Linker.

Really it's upgrade of ACEC (by designe). And we all know that the roots are from DBC.

 

They said that even DVC linker also works! (I tried programming code with DVC-LSC CEDIT.COM program. All works perfectly!

You only need to add appropriate runtimes on the disk with ACEC runtimes and deal done. No problem at all)

 

ACEC and CC8 need not runtimes on disk! It's very good design!

 

And the problem!

Please look at http://www.verycomputer.com/10_2482f67523b1814a_1.htm

It's a recent CC8 Documentation, and they said that somewhere in inet exists

CC8 Compiler Version 2.3b (3 of 3) which is UUencoded CC8.COM file.

I can't find this file at all.

 

This version has almost all bangs and whistles of C lang. (IMHO) I'm not a programmer!

 

Please!!!

I have found this: http://ftp.pigwa.net/stuff/collections/holmes%20cd/Holmes%201/ATR%20Programs/Applications%20A-Z/C%202.3%20Compiler.atr

Link to comment
Share on other sites

rdea6, Many thanks!

 

The only thing is - how to extract Ken's k-file from ATR.

And another is - how to check that it's 2.3b.

 

I see, by the way, that no one loves cc8 but it's amasing native 8-bit project. Why?!!

Find ken's utility v. 1.13 and OPEN the ATR highlight the word k-boot and use the extract button..

 

post-10165-0-94887900-1441651814_thumb.pngpost-10165-0-29014900-1441651834_thumb.png

 

Look here for AtrUtil

Edited by rdea6
Link to comment
Share on other sites

I checked all available versions of CC8 and no one is 2.3b.

 

CC8 itself is No Name C v2.3 and XCC8 is possibly v2.3a. (slightly bugfixed)

 

All of them shows error when meet char *s = "something"; stanza but Steve said that this string reads in v2.3b without a problem.

Link to comment
Share on other sites

I checked these versions and they all are not 2.3b

 

They eat these strings:

/* Atari CC8 Compiler: The K&R subset */

main() $(
    char *str;
    str = "Hello friends.\nIt's me - The C Language Compiler!";

    prins(str);
$)

prins(s)
    char *s;
$(
    printf("\f\n%s\n\n", s);
$)
but not this (as Steve Kennedy wrote):
char *p = "hello";
Thus it's K&R 1-st edition!
Link to comment
Share on other sites

Hi there, devwebcl!

 

Now I checked this code:

struct node $(
    char *caption;
    char selection;
    struct node *next;
    struct node *prev;
$) first, last;

It means that declaration after description was done.

Also it may means nothing!
All previous versions couldn't eat these first and last variables ...
:)
Thank you very much!

post-20208-0-97156800-1442750434_thumb.png

  • Like 1
Link to comment
Share on other sites

Hello,

 

Here is a little sample of source of Doubly Linked List compiled with CC8.

There was more then two weeks spended to understand undocumented difference between K&R and CC8. :)

 

Here is fully working code!

/* Doubly Linked List implementation */
#define NULL 0

struct Node $(
    int data;
    struct Node *next;
    struct Node *prev;
$);

/* global variable - pointer to head node. */
struct Node *head;

/* Creates a new Node and returns pointer to it. */
struct Node *mkNewNode(x)
    int x;
$(
    struct Node *newNode;
    newNode = (struct Node *) malloc(sizeof(struct Node));
    newNode->data = x;
    newNode->prev = NULL;
    newNode->next = NULL;
    return newNode;
$)

/* Inserts a Node at head of doubly linked list */
Prepend(x)
   int x;
$(
    struct Node *newNode;
    newNode = mkNewNode(x);
    if(head == NULL) $(
        head = newNode;
        return;
    $)
    head->prev = newNode;
    newNode->next = head;
    head = newNode;
$)

/* Inserts a Node at tail of Doubly linked list */
Append(x)
    int x;
$(
    struct Node *newNode, *temp;
    newNode = mkNewNode(x);
    temp = head;
    if(head == NULL) $(
        head = newNode;
        return;
    $)
    while(temp->next != NULL) temp = temp->next;
    /* Go To last Node */
    temp->next = newNode;
    newNode->prev = temp;
$)

/* Prints all the elements in linked list in forward traversal order */
FwdPrint() $(
    struct Node *temp;
    temp = head;
    printf("Forward: ");
    while(temp != NULL) $(
        printf("%d ",temp->data);
        temp = temp->next;
    $)
    printf("\n");
$)


/* Prints all elements in linked list in reverse traversal order. */
RevPrint() $(
    struct Node *temp;
    temp = head;
    /* if empty list - exit */
    if(temp == NULL) return;
        /* Going to last Node */
        while(temp->next != NULL) $(
        temp = temp->next;
    $)
    /* Traversing backward using prev pointer */
    printf("Reverse: ");
    while(temp != NULL) $(
        printf("%d ",temp->data);
        temp = temp->prev;
    $)
    printf("\n");
$)

/* Driver code to test the implementation */
main() $(
    /* empty list. set head as NULL. */
    head = NULL;

    /* Calling an Insert and printing list both in forward */
    /* as well as reverse direction. */
    Append(2);
    FwdPrint();
    RevPrint();

    Append(4);
    FwdPrint();
    RevPrint();

    Prepend(6);
    FwdPrint();
    RevPrint();

    Append(;
    FwdPrint();
    RevPrint();
$)

All the BEST!

 

P.S. By the way, It's not CC8 v.2.3b. So sorry...

 

  • Like 1
Link to comment
Share on other sites

Another attempt to investigate some abilities of CC8

 

Prehistory...

I worked with X33A.DOS with excellent Shell33a environment.

My goal was to access memory in direct way.

 

As an example - to change BG color of screen in C-way.

 

YES! I know that there are peek/dpeek and poke/dpoke in CC8, but...

They say that C - is system level programming language and I needed to use C but not the assembled snippets in it.

 

For about 2 weeks I can not get any results.

(Being RESET-proof and renewing in VBI, Shell killed all my success, because it's changing color in VBI)

 

And now when I turned off color changing in shell (optionally available in shell) ...

 

Here is a simple short program used typecasting , C-macro and fully workable.

 

/* Typecasting and macros in CC8 */
/* Some kind of POKE */


#define putbyte(addr,val) (*(char*) (addr) = (val))


main()$(
    putbyte(710,50);
$)
And the result:

post-20208-0-53608100-1443334438_thumb.png

Link to comment
Share on other sites

Hello.

Now I have found my old tests of CC8 abilities and I can say that structs and function declarations are fully working in plain CC8 environment.

 

Here you can find some sample with calling function No.2

It means that CC8 is not so bad itself ;)

/* Declaration of functions */
f0();
f1();
f2();

/* Array of pointers to functions */
(*f[3])() = $( f0, f1, f2 $);

main() $(
  char n;
  n = 2;
/* Calling a function using array of pointers to functions */
  (*f[n])();
$)

f0() $(
  printf("Function f0 called\n");
$)

f1() $(
  printf("Function f1 called\n");
$)

f2() $(
  printf("Function f2 called\n");
$)
  • Like 3
Link to comment
Share on other sites

Hello friends!


Hello, FJC!

Glad to see you again.


It's a good symptom that you are interested in CC8.

Sorry, I don't know how it's fast. (Anyway, we need assembly in time critical routines.)


I only investigate it's usefullness for programming in Atari-8 environment.

I never was good Atari player.


And I never became a good programmer (There was no internet at a time and thus there was no any documentation ...)


You know of course that CrossAssemblers, Pascals, Action!, PL65(My love) etc. may be used somehow for "pointing structure-like" programming.

But clear C is the only native choice!


Really we need C for Atari isn't it?


Anyway, there are many problems...


It's enough to say about first - We all lost modern version!


I saw it (this version) with my own eyes in some post as a literal garbage after text (but it was uuencoded part!).

Now superGoogle can't find it. Google loves it's own suggestions!


I even didn't save this post... Bad luck!


If you are interested in current Docs I'll send you real v2.3 Documentation.

Here in this theme I sended modern one as a link to some site.


Version 2.3b has correct syntax of K&R and eats enums, unions etc. (But typedef).

Yes, I know that it's may be RTS parts of assembly in this version! b - may be beta.


But anyway there is a great difference between restrictions of 2.3 and freedom of 2.3b.


Here is a link to a discription of CC8 doing by famous Mark Miller.

(His description says itself that we need new malloc, free etc.

NOT placed on page6 !)


Part1


Part2



That's all.

I'll be glad if you can understand my English.


Best wishes from Moscow!

Greetings to your family and cat!
Link to comment
Share on other sites

  • 1 year later...

Hello friends!

Recently I've write working malloc library for CC8 compiler.
Here is the code and corresponding atr at your disposal:

/* Memory allocation library for CC8 compiler */
/* First fit algorythm for malloc and free */
/* by Evgeny Zolotarev (aka 576XE), 2017 */

/* While using you may freely comment program messages */

#define NULL 0
#define META_SIZE sizeof(struct meta)
#define MEM_SIZE 20000

char memory[MEM_SIZE];

struct meta $(
  int size;
  int freFlg;
  struct meta *next; 
$);

struct meta *freeList = (char*) memory;

initialize() $(
  freeList->size = MEM_SIZE-META_SIZE;
  freeList->freFlg = 1;
  freeList->next = NULL;
$)

/* Used by malloc(size) */
split(fitSlot,size)
  struct meta *fitSlot;
  int size;
$(
  struct meta *new;
  new = (struct meta *) ((char *) fitSlot+size+META_SIZE);
  new->size = (fitSlot->size)-size-META_SIZE;
  new->freFlg = 1;
  new->next = fitSlot->next;
  fitSlot->size = size;
  fitSlot->freFlg = 0;
  fitSlot->next = new;
$)

char *malloc(nBytes)
  int nBytes;
$(
  struct meta *curr, *prev;
  char *result;

  if(!(freeList->size)) $(
    initialize();
    printf("+ Memory initialized.\n\n");
  $)

  curr = freeList;
  while((((curr->size) < nBytes) || ((curr->freFlg) == 0)) && (curr->next != NULL)) $(
    prev = curr;
    curr = curr->next;
    printf("- Area used/small,block not allocated\n");
  $)

  if((curr->size) == nBytes) $(
    curr->freFlg = 0;
    result = (char*) ++curr;
    printf("+ Exact fitting block allocated\n");
    return result;
  $)
  else if((curr->size) > (nBytes+META_SIZE)) $(
    split(curr, nBytes);
    result = (char*) ++curr;
    printf("+ Fitting block allocated by split\n");
    return result;
  $)
  else $(
    result = NULL;
    printf("- Sorry. No sufficient memory to allocate\n");
    return result;
  $)
$)

/* Used by free() */
merge() $(
  struct meta *curr,*prev;

  curr = freeList;
  while((curr->next) != NULL) $(
    if((curr->freFlg) && (curr->next->freFlg)) $(
      curr->size += (curr->next->size)+META_SIZE;
      curr->next = curr->next->next;
    $)
    prev = curr;
    curr = curr->next;
  $)
$)

free(ptr)
  char *ptr;
$(
  if((ptr >= (char*) memory) && (ptr <= (char*) (memory+MEM_SIZE))) $(
    struct meta *curr;

    (struct meta *) curr = ptr;
    --curr;
    curr->freFlg = 1;
    merge();
    printf("+ Block freed, space merged\n");
  $)
  else printf("Please provide a valid pointer allocated by malloc\n");
$)


/* Driver code for debugging */
int main() $(
  int *p,*r,*k;
  char *q,*w;

  p = (int) malloc(100 * sizeof(int));
  q = (char) malloc(250 * sizeof(char));
  r = (int) malloc(1000 * sizeof(int));

  free(p);
  w = (char )malloc(700);

  free(r);
  k = (int) malloc(500*sizeof(int));

  printf("\nAllocation and deallocation\nare done successfully!\n");
$)

CC8 Compiler SpDOSx33a 360.atr

You can see that I'm using an array to reserve some memory for allocation.
But my real idea was to use heap for the purpose, of course.

I know that the heap can start just after 'ProgEnd' up to MEMTOP in certain graphics mode. But I can't realize where this 'ProgEnd' lives.

My suggestion is to use tiny ASM program in MAC/65 placed in very end of C-code but called in very beginning of INIT routine and returning ending LABEL address.
MAC/65 can do this while using Program Counter.

I said earlier that I'm not a programmer and I don't know the construction and features of compiler or linker. Thus I can not be sure does this ASM code will be placed at the 'ProgEnd' or not.

Anyway I ask you for your suggestions. :)

Yes, I can use in some manner linker's message about end of code (It's realy the beginning of stack which growing top down...)

 

post-20208-0-53243000-1496552360_thumb.png

Linker message...

 

post-20208-0-73453200-1496552428_thumb.png

It works :)

Best wishes from Moscow.
ez

Link to comment
Share on other sites

  • 3 weeks later...

Hi Friends!

It seems that with age I become too wordy...

I bring to your kind attention and to your free disposal heap oriented Memory Allocation Library for CC8 compiler.

It is fully working. (Don't forget to restart Atari or Emulator after linking. Garbage in heap is very interesting thing for debugging.)
And it's just one step forward...

Here are the code of library itself and program for debugging.
Library itself

/* Heap allocation library for CC8 compiler */
/* First-fit algorythm for malloc and free */
/* by Evgeny Zolotarev (aka 576XE), 2017 */

#include "STDIO.H"

#define HEAPTOP 0xbc00
#define HEAPBTM 0x5000
#define MEMOSIZ HEAPTOP-HEAPBTM
#define METASIZ sizeof(struct meta)
#define FRED 1
#define USED 0

struct meta $(
  int size;
  int flag;
  struct meta *next; 
$);

struct meta *list = (char*) HEAPBTM;

initmeta() $(
  list->size = MEMOSIZ-METASIZ;
  list->flag = FRED;
  list->next = NULL;
$)

/* Used by malloc(size) */
split(fits,size)
  struct meta *fits;
  int size;
$(
  struct meta *new;
  new = (struct meta *) ((char *) fits+size+METASIZ);
  new->size = (fits->size)-size-METASIZ;
  new->flag = FRED;
  new->next = fits->next;

  fits->size = size;
  fits->flag = USED;
  fits->next = new;
$)

char *malloc(nBytes)
  int nBytes;
$(
  struct meta *curr, *prev;
  char *result;

  if(!(list->size)) $(
    initmeta();
    printf("+ Memory initialized.\n\n");
  $)

  curr = list;
  while((((curr->size) < nBytes) || ((curr->flag) == USED)) && (curr->next != NULL)) $(
    prev = curr;
    curr = curr->next;
    printf("- Search fitting block ...\n");
  $)

  if((curr->size) == nBytes) $(
    curr->flag = USED;
    result = (char*) ++curr;
    printf("+ Exact fitting block allocated\n");
    return result;
  $)
  else if((curr->size) > (nBytes+METASIZ)) $(
    split(curr, nBytes);
    result = (char*) ++curr;
    printf("Block $%x-$%x Size=%d allocated\n",result,result+nBytes,nBytes);
    return result;
  $)
  else $(
    result = NULL;
    printf("- Sorry. No sufficient memory to allocate\n");
    return result;
  $)
$)

/* Used by free() */
merge() $(
  struct meta *curr,*prev;

  curr = list;
  while((curr->next) != NULL) $(
    if((curr->flag) && (curr->next->flag)) $(
      curr->size += (curr->next->size)+METASIZ;
      curr->next = curr->next->next;
    $)
    prev = curr;
    curr = curr->next;
  $)
$)

free(ptr)
  char *ptr;
$(
  if((ptr >= (char*) HEAPBTM) && (ptr <= (char*) HEAPTOP)) $(
    struct meta *curr;

    (struct meta *) curr = ptr;
    --curr;
    curr->flag = FRED;
    merge();
    printf("+ Block freed, space merged\n");
  $)
  else printf("Please provide a valid pointer allocated by malloc\n");
$)

DEBUG.C

#include "ALCLIB.C"


/* Driver code for debugging */
int main() $(
  int *p,*r,*k;
  char *q,*w;

  p = (int) malloc(100 * sizeof(int));
  q = (char) malloc(250 * sizeof(char));
  r = (int) malloc(1000 * sizeof(int));

  free(p);
  w = (char )malloc(700);

  free(r);
  k = (int) malloc(500*sizeof(int));

  printf("\nAllocation and deallocation\nare done successfully!\n");
$)

And here is the result of allocations and deallocations of memory.

post-20208-0-14745300-1498047451_thumb.png

 

There is no simple way without using of monitor to find the beginning of heap, but you can use an arbitrary value after looking LINKer message:

>>>Code ends at $45F6 or something like this.
post-20208-0-31981800-1498047544_thumb.png

 

IMHO it is EndOfStack address (if it growth downward) and means nothing if instead upward. Yes we can rewrite code to reverse linked list of course (from top to bottom).

Also, you can freely delete debugging messages.

Best wishes from Moscow.
ez

Link to comment
Share on other sites

  • 6 years later...

Hello friends!

Here is some routine from documentation to illustrate using of constant expression with asm statement.

 

char ml_routine[] = 0x68, ..., 0x60; /* ML routine */
    
char * strchr(s, c)
  char *s;
  int  c;
asm ml_routine;

 

I can't initialize array of bytes absolutely this way.
What's wrong? Help me, please!

 

I want to write 24-bit calculations for C. :)
zen
 

Edited by 576XE
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...