use
<tscreen><verb>
- ...
- ++i;
- ...
+ ...
+ ++i;
+ ...
</verb></tscreen>
instead of
<tscreen><verb>
- ...
- i++;
- ...
+ ...
+ i++;
+ ...
</verb></tscreen>
So, to access direct memory locations, use
<tscreen><verb>
- #define VDC_STATUS 0xD601
- *(char*)VDC_STATUS = 0x01;
+ #define VDC_STATUS 0xD601
+ *(char*)VDC_STATUS = 0x01;
</verb></tscreen>
That will be translated to
<tscreen><verb>
- lda #$01
- sta $D601
+ lda #$01
+ sta $D601
</verb></tscreen>
The constant value detection works also for struct pointers and arrays, if the
subscript is a constant. So
<tscreen><verb>
- #define VDC ((unsigned char*)0xD600)
- #define STATUS 0x01
- VDC[STATUS] = 0x01;
+ #define VDC ((unsigned char*)0xD600)
+ #define STATUS 0x01
+ VDC[STATUS] = 0x01;
</verb></tscreen>
will also work.
code. So, use
<tscreen><verb>
- int i = 1;
+ int i = 1;
</verb></tscreen>
instead of
<tscreen><verb>
- int i;
- i = 1;
+ int i;
+ i = 1;
</verb></tscreen>
But beware: To maximize your savings, don't mix uninitialized and initialized
variables each time, it parses an initialized one. So do this:
<tscreen><verb>
- int i, j;
- int a = 3;
- int b = 0;
+ int i, j;
+ int a = 3;
+ int b = 0;
</verb></tscreen>
instead of
<tscreen><verb>
- int i;
- int a = 3;
- int j;
- int b = 0;
+ int i;
+ int a = 3;
+ int j;
+ int b = 0;
</verb></tscreen>
The latter will work, but will create larger and slower code.
Don't use
<tscreen><verb>
- char* a;
- char b, c;
- char b = *(a + c);
+ char* a;
+ char b, c;
+ char b = *(a + c);
</verb></tscreen>
Use
<tscreen><verb>
- char* a;
- char b, c;
- char b = a[c];
+ char* a;
+ char b, c;
+ char b = a[c];
</verb></tscreen>
instead.