Ponde scc16plus specific

New keywords

- byteptr, hwordptr
- wordptr is treated as hwordptr
- as, const, sizeof
- __map__(var)

Accessing External memory

- half word access (16-bit)
- byte access (8-bit)

    word memptr;       // global variable

    word x;

    __map__(memptr);
    memptr = MEM_ADDR;
    x = *hwordptr++;    // pointer is post-incremented

    *byteptr++ = byte(x);
    *byteptr++ = byte(rot8(x));

    x = 0;
    repeat(2) {
      x = rol8(x);
      x |= *byteptr++;
    }

Accessing External memory using CONST reg

- SCC16_EXCONST must be set in configuration
- CONST register is used when r15 is set in the mapping register
- An offset can be added (SCC16_EXCBASE)
- 64KB starting from 0000h in 64KB
- CONST register will be updated if post-modifier is set

#ifndef RTL_SCC16_EXCONST
  #error  EXCONST mode not set
#endif

    word x;

    x = *(const=0x1000 as hwordptr++);
    x += *(const as hwordptr++);
    x += *hwordptr++;                   // CONST as hwordptr

sizeof()

- returns the size of the object being accessed

    sizeof(*wordptr)  --- value: 2  <<<-- not 4
    sizeof(*hwordptr) --- value: 2
    sizeof(*byteptr)  --- value: 1

Iteration support

You can map a local (auto) variable to a virtual iteration variable, itervar, using __iter__(var).
The mapped variable can be referred using itervar and optional modifier (++ or --) can be specified.

    void func()
    {
        word loop;

        __iter__(loop);
        loop = 4;
        while(itervar--) {
            /** do something **/
        }
    }
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License