have now programmed the vic20 with the cc65.
the help here from the forum was helpful with the cfg.
start of the prg: sys 8717
see vic20-32k.cfg
have the memory beginning at 8717byte because the
graphics start at 4352byte.
draw with the "w / s / a / d /" keys.
use the "r" key to clear the screen to redraw
with the key "t" back to vic20
maybe you can expand that with "LINE" and "DRAW"?
Who can help.
vic20-32k.cfg
Code: Select all
# sys 8717
SYMBOLS {
__LOADADDR__: type = import;
__EXEHDR__: type = import;
__STACKSIZE__: type = weak, value = $0800; # 2k stack
}
MEMORY {
ZP: file = "", define = yes, start = $0002, size = $001A;
LOADADDR: file = %O, start = $21FF, size = $0002;
HEADER: file = %O, start = $2201, size = $000C;
MAIN: file = %O, define = yes, start = $220D, size = $5DF3 - __STACKSIZE__;
}
SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
LOADADDR: load = LOADADDR, type = ro;
EXEHDR: load = HEADER, type = ro;
STARTUP: load = MAIN, type = ro;
LOWCODE: load = MAIN, type = ro, optional = yes;
ONCE: load = MAIN, type = ro, optional = yes;
CODE: load = MAIN, type = ro;
RODATA: load = MAIN, type = ro;
DATA: load = MAIN, type = rw;
INIT: load = MAIN, type = bss;
BSS: load = MAIN, type = bss, define = yes;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
segment = RODATA;
CONDES: type = interruptor,
label = __INTERRUPTOR_TABLE__,
count = __INTERRUPTOR_COUNT__,
segment = RODATA,
import = __CALLIRQ__;
}
Code: Select all
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <ctype.h>
#include <modload.h>
#include <peekpoke.h>
#include <string.h>
char a,x,y,ma;
int scradr;
int ad,ay,i;
void text() {
POKE(36864,12);
POKE(36866,22);
POKE(36867,174);
POKE(36869,192);
}
void grafcls() {
for(i= 4352; i <= 8047; i += 1)
{
POKE(i,0);
}
}
void scrgraf() {
for(i= 4352; i <= 8047; i += 1)
{
POKE(i,0);
}
POKE(36867,151);
POKE(36866,21);
POKE(36869,204);
POKE(36864,14);
for(i= 16; i <= 255; i += 1)
{
POKE(4096+i-16,i);
POKE(37888+i-16,6);
}
}
void plot() {
ad=4352;
ay=(y/16)*336+(y & 15);
ad=ad+16*(x/8)+ay;
ma= 1 << ((7-x) & 7);
POKE(ad,PEEK(ad) | ma);
}
void main(void)
{
scradr=4352;
scrgraf();
x=80;
y=95;
plot();
while (1)
{
a=PEEK(197);
if (a==17)
{
x=x-1;
if (x==255)
{
x=x+1;
}
plot();
}
if (a==18)
{
x=x+1;
if (x>=168)
{
x=x-1;
}
plot();
}
if (a==9)
{
y=y-1;
if (y==255)
{
y=y+1;
}
plot();
}
if (a==41)
{
y=y+1;
if (y>=176)
{
y=y-1;
}
plot();
}
if (a==10)
{
grafcls();
x=80;
y=95;
plot();
}
if (a==42)
{
text();
break;
}
}
}
greeting