initial commit
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
#include <c64/vic.h>
|
||||
#include <c64/rasterirq.h>
|
||||
#include <string.h>
|
||||
|
||||
const char Text[] =
|
||||
S"LABORUM RERUM QUO. QUASI IN, SEQUI, TENETUR VOLUPTATEM RERUM "
|
||||
S"PORRO NON ET MAIORES ALIAS ODIO EST EOS. MAGNAM APERIAM CUM ET "
|
||||
S"ESSE TEMPORE ITAQUE TEMPORA VOLUPTAS ET IPSAM IPSAM EARUM. ID "
|
||||
S"SUSCIPIT QUIA RERUM REPREHENDERIT ERROR ET UT. DOLOR ID "
|
||||
S"CORPORIS, EOS? UNDE VERO ISTE QUIA? EAQUE EAQUE. IN. AUT ID "
|
||||
S"EXPEDITA ILLUM MOLESTIAS, ";
|
||||
|
||||
// Raster interrupt command structure for change to scrolled and back
|
||||
|
||||
RIRQCode scroll, restore;
|
||||
|
||||
int x;
|
||||
|
||||
// Loop through text
|
||||
__interrupt void doscroll(void)
|
||||
{
|
||||
vic.color_border++;
|
||||
|
||||
// Update raster IRQ for scroll line with new horizontal scroll offset
|
||||
rirq_data(&scroll, 1, 7 - (x & 7));
|
||||
// Copy scrolled version of text when switching over char border
|
||||
if ((x & 7) == 0)
|
||||
memcpy((char *)0x0400 + 40 * 24, Text + ((x >> 3) & 255), 40);
|
||||
x++;
|
||||
|
||||
vic.color_border--;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
// initialize raster IRQ
|
||||
rirq_init(true);
|
||||
|
||||
// Build switch to scroll line IRQ
|
||||
rirq_build(&scroll, 2);
|
||||
// Delay for one line to get to right border
|
||||
rirq_delay(&scroll, 11);
|
||||
// Change control register two with this IRQ
|
||||
rirq_write(&scroll, 1, &vic.ctrl2, 0);
|
||||
// Put it onto the scroll line
|
||||
rirq_set(0, 49 + 24 * 8, &scroll);
|
||||
|
||||
// Build the switch to normal IRQ
|
||||
rirq_build(&restore, 2);
|
||||
// re-enable left and right column and reset horizontal scroll
|
||||
rirq_write(&restore, 0, &vic.ctrl2, VIC_CTRL2_CSEL);
|
||||
// call scroll copy code
|
||||
rirq_call(&restore, 1, doscroll);
|
||||
// place this at the top of the screen before the display starts
|
||||
rirq_set(1, 250, &restore);
|
||||
|
||||
// sort the raster IRQs
|
||||
rirq_sort();
|
||||
|
||||
// start raster IRQ processing
|
||||
rirq_start();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
../../bin/oscar64 colorbars.c
|
||||
../../bin/oscar64 openborder.c
|
||||
../../bin/oscar64 textcrawler.c
|
||||
../../bin/oscar64 movingbars.c -n
|
||||
@@ -0,0 +1,32 @@
|
||||
#include <c64/vic.h>
|
||||
#include <c64/rasterirq.h>
|
||||
#include <conio.h>
|
||||
|
||||
// Prepare small 14 color bars and one IRQ for back to normal
|
||||
RIRQCode bars[15];
|
||||
|
||||
int main(void)
|
||||
{
|
||||
// initialize raster IRQ
|
||||
rirq_init(true);
|
||||
|
||||
for(int i=0; i<15; i++)
|
||||
{
|
||||
// Build color change raster IRQ
|
||||
rirq_build(bars + i, 2);
|
||||
// Change border color
|
||||
rirq_write(bars + i, 0, &vic.color_border, i);
|
||||
// Change background color
|
||||
rirq_write(bars + i, 1, &vic.color_back, i);
|
||||
// Place it on screen
|
||||
rirq_set(i, 80 + 8 * i, bars + i);
|
||||
}
|
||||
|
||||
// Sort all raster IRQs
|
||||
rirq_sort();
|
||||
|
||||
// Start raster IRQs
|
||||
rirq_start();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
@@ -0,0 +1,5 @@
|
||||
call ..\..\bin\oscar64 colorbars.c
|
||||
call ..\..\bin\oscar64 openborder.c
|
||||
call ..\..\bin\oscar64 textcrawler.c
|
||||
call ..\..\bin\oscar64 movingbars.c -n
|
||||
call ..\..\bin\oscar64 autocrawler.c -n
|
||||
@@ -0,0 +1,11 @@
|
||||
%.prg: %.c
|
||||
@echo "Compiling sample file" $<
|
||||
@$(OSCAR64_CC) $(OSCAR64_CFLAGS) $<
|
||||
|
||||
all: colorbars.prg openborder.prg textcrawler.prg movingbars.prg
|
||||
|
||||
movingbars.prg: movingbars.c
|
||||
@$(OSCAR64_CC) $(OSCAR64_CFLAGS) $< -n
|
||||
|
||||
clean:
|
||||
@$(RM) *.asm *.int *.lbl *.map *.prg *.bcs
|
||||
@@ -0,0 +1,94 @@
|
||||
#include <c64/vic.h>
|
||||
#include <c64/rasterirq.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <conio.h>
|
||||
|
||||
// Five raster IRQs for top and bottom of the two chasing bars, and the bottom
|
||||
// of the screen
|
||||
RIRQCode ftop, fbottom, btop, bbottom, final ;
|
||||
|
||||
char sintab[256];
|
||||
|
||||
int main(void)
|
||||
{
|
||||
rirq_init(true);
|
||||
|
||||
rirq_build(&ftop, 3);
|
||||
rirq_delay(&ftop, 10);
|
||||
rirq_write(&ftop, 1, &vic.color_back, 2);
|
||||
rirq_write(&ftop, 2, &vic.color_border, 2);
|
||||
|
||||
rirq_build(&fbottom, 3);
|
||||
rirq_delay(&fbottom, 10);
|
||||
rirq_write(&fbottom, 1, &vic.color_back, 6);
|
||||
rirq_write(&fbottom, 2, &vic.color_border, 14);
|
||||
|
||||
rirq_build(&btop, 3);
|
||||
rirq_delay(&btop, 10);
|
||||
rirq_write(&btop, 1, &vic.color_back, 7);
|
||||
rirq_write(&btop, 2, &vic.color_border, 7);
|
||||
|
||||
rirq_build(&bbottom, 3);
|
||||
rirq_delay(&bbottom, 10);
|
||||
rirq_write(&bbottom, 1, &vic.color_back, 6);
|
||||
rirq_write(&bbottom, 2, &vic.color_border, 14);
|
||||
|
||||
rirq_build(&final, 0);
|
||||
|
||||
char yfront = 100, yback = 200;
|
||||
|
||||
rirq_set(0, yfront, &ftop);
|
||||
rirq_set(1, yfront + 16, &fbottom);
|
||||
rirq_set(2, yback, &btop);
|
||||
rirq_set(3, yback + 16, &bbottom);
|
||||
rirq_set(4, 250, &final);
|
||||
rirq_sort();
|
||||
|
||||
|
||||
rirq_start();
|
||||
|
||||
for(int i=0; i<32; i++)
|
||||
sintab[i] = (int)(120 + 60 * sin(i * PI / 16)) | 1;
|
||||
|
||||
char fi = 3, bi = 0;
|
||||
for(;;)
|
||||
{
|
||||
yfront = sintab[fi & 31];
|
||||
yback = sintab[bi & 31];
|
||||
|
||||
rirq_move(0, yfront);
|
||||
if (yback == yfront)
|
||||
{
|
||||
rirq_move(1, yfront + 16);
|
||||
rirq_clear(2);
|
||||
rirq_clear(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (yback < yfront || yback > yfront + 16)
|
||||
{
|
||||
rirq_move(1, yfront + 16);
|
||||
rirq_move(2, yback);
|
||||
}
|
||||
else
|
||||
{
|
||||
rirq_clear(1);
|
||||
rirq_move(2, yfront + 16);
|
||||
}
|
||||
if (yback < yfront - 16 || yback > yfront)
|
||||
rirq_move(3, yback + 16);
|
||||
else
|
||||
rirq_clear(3);
|
||||
}
|
||||
|
||||
rirq_sort();
|
||||
rirq_wait();
|
||||
|
||||
fi ++;
|
||||
bi ++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
#include <c64/vic.h>
|
||||
#include <c64/rasterirq.h>
|
||||
#include <conio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
char spdata[] = {
|
||||
#embed "../resources/friendlybear.bin"
|
||||
};
|
||||
|
||||
// Raster IRQs for last line of screen and below
|
||||
RIRQCode open, bottom;
|
||||
|
||||
int main(void)
|
||||
{
|
||||
// initialize raster IRQ
|
||||
rirq_init(true);
|
||||
|
||||
// Build open border raster IRQ
|
||||
rirq_build(&open, 1);
|
||||
// Reduce vertical screen size to fool VIC counter
|
||||
rirq_write(&open, 0, &vic.ctrl1, VIC_CTRL1_DEN | 3);
|
||||
// Place it into the last line of the screen
|
||||
rirq_set(0, 50 + 200 - 3, &open);
|
||||
|
||||
// Build switch to normal raster IRQ
|
||||
rirq_build(&bottom, 1);
|
||||
rirq_write(&bottom, 0, &vic.ctrl1, VIC_CTRL1_DEN | VIC_CTRL1_RSEL | 3 );
|
||||
rirq_set(1, 50, &bottom);
|
||||
|
||||
// sort the raster IRQs
|
||||
rirq_sort();
|
||||
|
||||
// start raster IRQ processing
|
||||
rirq_start();
|
||||
|
||||
// Copy the sprite data
|
||||
memcpy((char *)0x0380, spdata, 128);
|
||||
|
||||
// Initialize sprites
|
||||
*(char *)(0x7f8) = 0x03c0 / 64;
|
||||
*(char *)(0x7f9) = 0x0380 / 64;
|
||||
*(char *)(0x7fa) = 0x03c0 / 64;
|
||||
*(char *)(0x7fb) = 0x0380 / 64;
|
||||
*(char *)(0x7fc) = 0x03c0 / 64;
|
||||
*(char *)(0x7fd) = 0x0380 / 64;
|
||||
*(char *)(0x7fe) = 0x03c0 / 64;
|
||||
*(char *)(0x7ff) = 0x0380 / 64;
|
||||
|
||||
vic.spr_enable = 0b11111111;
|
||||
vic.spr_multi = 0b10101010;
|
||||
vic.spr_color[0] = VCOL_BLACK;
|
||||
vic.spr_color[1] = VCOL_ORANGE;
|
||||
vic.spr_color[2] = VCOL_BLACK;
|
||||
vic.spr_color[3] = VCOL_ORANGE;
|
||||
vic.spr_color[4] = VCOL_BLACK;
|
||||
vic.spr_color[5] = VCOL_ORANGE;
|
||||
vic.spr_color[6] = VCOL_BLACK;
|
||||
vic.spr_color[7] = VCOL_ORANGE;
|
||||
vic.spr_mcolor0 = VCOL_BROWN;
|
||||
vic.spr_mcolor1 = VCOL_WHITE;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
// Move sprites through all vertical positions
|
||||
for(int i=0; i<255; i++)
|
||||
{
|
||||
vic_sprxy(0, 100, 1 * i); vic_sprxy(1, 100, 1 * i);
|
||||
vic_sprxy(2, 140, 2 * i); vic_sprxy(3, 140, 2 * i);
|
||||
vic_sprxy(4, 180, 3 * i); vic_sprxy(5, 180, 3 * i);
|
||||
vic_sprxy(6, 220, 4 * i); vic_sprxy(7, 220, 4 * i);
|
||||
|
||||
rirq_wait();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
#include <c64/vic.h>
|
||||
#include <c64/rasterirq.h>
|
||||
#include <string.h>
|
||||
|
||||
const char * Text =
|
||||
S"LABORUM RERUM QUO. QUASI IN, SEQUI, TENETUR VOLUPTATEM RERUM "
|
||||
S"PORRO NON ET MAIORES ALIAS ODIO EST EOS. MAGNAM APERIAM CUM ET "
|
||||
S"ESSE TEMPORE ITAQUE TEMPORA VOLUPTAS ET IPSAM IPSAM EARUM. ID "
|
||||
S"SUSCIPIT QUIA RERUM REPREHENDERIT ERROR ET UT. DOLOR ID "
|
||||
S"CORPORIS, EOS? UNDE VERO ISTE QUIA? EAQUE EAQUE. IN. AUT ID "
|
||||
S"EXPEDITA ILLUM MOLESTIAS, ";
|
||||
|
||||
// Raster interrupt command structure for change to scrolled and back
|
||||
|
||||
RIRQCode scroll, bottom;
|
||||
|
||||
int main(void)
|
||||
{
|
||||
// initialize raster IRQ
|
||||
rirq_init(true);
|
||||
|
||||
// Build switch to scroll line IRQ
|
||||
rirq_build(&scroll, 2);
|
||||
// Delay for one line to get to right border
|
||||
rirq_delay(&scroll, 11);
|
||||
// Change control register two with this IRQ
|
||||
rirq_write(&scroll, 1, &vic.ctrl2, 0);
|
||||
// Put it onto the scroll line
|
||||
rirq_set(0, 49 + 24 * 8, &scroll);
|
||||
|
||||
// Build the switch to normal IRQ
|
||||
rirq_build(&bottom, 1);
|
||||
// re-enable left and right column and reset horizontal scroll
|
||||
rirq_write(&bottom, 0, &vic.ctrl2, VIC_CTRL2_CSEL);
|
||||
// place this at the bottom
|
||||
rirq_set(1, 250, &bottom);
|
||||
|
||||
// sort the raster IRQs
|
||||
rirq_sort();
|
||||
|
||||
// start raster IRQ processing
|
||||
rirq_start();
|
||||
|
||||
// Loop through text
|
||||
int x = 0;
|
||||
for(;;)
|
||||
{
|
||||
// wait for raster reaching bottom of screen
|
||||
rirq_wait();
|
||||
// Update raster IRQ for scroll line with new horizontal scroll offset
|
||||
rirq_data(&scroll, 1, 7 - (x & 7));
|
||||
// Copy scrolled version of text when switching over char border
|
||||
if ((x & 7) == 0)
|
||||
memcpy((char *)0x0400 + 40 * 24, Text + ((x >> 3) & 255), 40);
|
||||
x++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user