Post by gurce on Apr 29, 2018 4:59:58 GMT
Thought I'd document some of my experiences from last weekend of using Kaleidoscope V4.0 to draw some PETSCII art for my first demo.
Download
I grabbed it from here:
ahearttowitness.com/kscope/
Docs
I found the docs tucked away on the disk, which you accessed via a reader app.
Reading the docs on your PC
If you'd just prefer the comfort of reading the docs on your pc, I exported out the "K.SCOPE4.DOCS" and "ANIMATOR.DOCS" files for easier viewing:
Reading the docs on your C64
Loading Kaleidoscope resources into your program
While I didn't find any docs on this, it proved fairly easy to do. The disk has a few example resource files you can try.
Loading via BASIC
I tried loading the "TETRIS" example on the disk via the following simple routine.
This got me this lovely animated output I had to use WARP mode in VICE for it to load quicker
Loading via Assembly
Well, my effort was more like c-code (via cc65) with some inline assembly, but hopefully there's enough here for someone to derive a 'pure' assembly version out of:
Download
I grabbed it from here:
ahearttowitness.com/kscope/
Docs
I found the docs tucked away on the disk, which you accessed via a reader app.
Reading the docs on your PC
If you'd just prefer the comfort of reading the docs on your pc, I exported out the "K.SCOPE4.DOCS" and "ANIMATOR.DOCS" files for easier viewing:
Reading the docs on your C64
- Run the program called "K.SCOPE4.READER" on the disk
- Press SPACEBAR on the title screen
- It then offers a "SCREEN OR PRINTER?" option, select "S"
- documentation then scrolls down the screen, you can pause and un-pause this scrolling with the SPACEBAR.
Loading Kaleidoscope resources into your program
While I didn't find any docs on this, it proved fairly easy to do. The disk has a few example resource files you can try.
Loading via BASIC
I tried loading the "TETRIS" example on the disk via the following simple routine.
5 POKE 53280,0:POKE 53281,0
10 OPEN 5,8,5,"TETRIS,S,R"
20 GET #5,T$
30 PRINT T$;
40 IF ST<>64 THEN GOTO 20
50 CLOSE 5
This got me this lovely animated output I had to use WARP mode in VICE for it to load quicker
Loading via Assembly
Well, my effort was more like c-code (via cc65) with some inline assembly, but hopefully there's enough here for someone to derive a 'pure' assembly version out of:
#pragma optimize(off)
void load_petscii(void)
{
char* file = "tetris,s,r";
// clear the screen
__asm__ ( "JSR $E544" );
// 10 OPEN 5,8,5,"TETRIS,S,R"
fname_len = strlen(file);
lo = (unsigned char)((int)file & 0xff);
hi = ((int)file >> 8) & 0xff;
__asm__ ( "LDA %v", fname_len); // A = length of the filename string
__asm__ ( "LDX %v", lo ); // LDX #<file;
__asm__ ( "LDY %v", hi ); // LDY #>file;
__asm__ ( "JSR $FFBD" ); // call SETNAM
// call SETLFS
__asm__ ( "LDA #$03" ); // set file-number to 3
__asm__ ( "LDX #$08" ); // device-number 8 (disk drive)
__asm__ ( "LDY #$03" ); // secondary address
__asm__ ( "JSR $FFBA" ); // call SETLFS
// call OPEN
__asm__ ( "JSR $FFC0" );
while (1)
{
// call CHKIN
__asm__ ( "LDX #$03" ); // file-number 3
__asm__ ( "JSR $FFC6" ); // call CHKIN (file 3 now used as input)
// 20 GET #5,T$
// call CHRIN
__asm__ ( "JSR $FFCF" ); // the next char is stored in the accumulator
// 30 PRINT T$;
__asm__ ( "JSR $FFD2" ); // call CHROUT
// 40 IF ST<>64 THEN GOTO 20
__asm__ ( "JSR $FFB7" ); // call READST
__asm__ ( "STA %v", st ); // store the st value for our c-code
if (st == 64)
break;
}
// 50 CLOSE 5
__asm__ ( "LDA #$03" ); // file-number 3
__asm__ ( "JSR $FFC3" ); // call CLOSE
__asm__ ( "JSR $FFCC" ); // call CLRCHN
}
#pragma optimize(on)