This is the ML program version
Quote
pla
ldy #$00
bucle tya
sta ($58),y
iny
bne bucle
rts
This is the CC65 version
Quote
#define pokew(addr,val) (*(unsigned*) (addr) = (val))
#define peek(addr) (*(unsigned char*) (addr))
#define peekw(addr) (*(unsigned*) (addr))
int main (void)
{
int n = 0;
int x = peekw(0x58);
for(n=0;n<702;++n) // Print chars in screen
{
pokew(x+n,n % 256);
}
while(peekw(0xD01F)!=6) { // Wait key START
}
n=0; // Clear chars in screen
while(++n<702)
{
pokew(x+n,0);
}
while(peekw(0xD01F)!=6) { // Wait key START
}
}
I use to compile cl65 -t atari -Osir prueba.c -o prueba.xex
There are much difference between ML and CC65 speed. So ML has the advantage that only use one byte counter offset to print chars. After all, I study the ML resulting from CC65 compiler.
prueba.zip 1.22K
32 downloads
prueba2.zip 306bytes
36 downloadsP.D. I feel very fine to program in C and it's incredible for me to see after years that CC65 had grown. I'm sure complex logic projects will be developed in right way. Last example, show differences about using WHILE and FOR loops. In any way, commands loops stole much procesing time. But I read more about.
Edited by Allas, Wed Oct 19, 2005 12:32 AM.














