mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-01-15 16:30:02 +00:00
Changed align() to __align(). Closes #600
This commit is contained in:
parent
da789e007f
commit
0bdaa77876
@ -65,7 +65,7 @@ TYPEDEF: 'typedef' ;
|
||||
CONST: 'const' ;
|
||||
EXTERN: 'extern' ;
|
||||
EXPORT: 'export' ;
|
||||
ALIGN: 'align' ;
|
||||
ALIGN: '__align' ;
|
||||
INLINE: 'inline' ;
|
||||
VOLATILE: 'volatile' ;
|
||||
STATIC: 'static' ;
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -174,7 +174,7 @@ IMPORT_COMMENT_BLOCK=153
|
||||
'const'=40
|
||||
'extern'=41
|
||||
'export'=42
|
||||
'align'=43
|
||||
'__align'=43
|
||||
'inline'=44
|
||||
'volatile'=45
|
||||
'static'=46
|
||||
|
@ -42,7 +42,7 @@ null
|
||||
'const'
|
||||
'extern'
|
||||
'export'
|
||||
'align'
|
||||
'__align'
|
||||
'inline'
|
||||
'volatile'
|
||||
'static'
|
||||
|
@ -83,7 +83,7 @@ public class KickCParser extends Parser {
|
||||
"'...'", "'?'", null, "'->'", null, null, null, null, "'%'", "'++'",
|
||||
"'--'", "'&'", "'~'", "'^'", "'|'", null, null, "'=='", "'!='", null,
|
||||
"'<='", "'>='", null, "'&&'", "'||'", "'='", null, "'typedef'", "'const'",
|
||||
"'extern'", "'export'", "'align'", "'inline'", "'volatile'", "'static'",
|
||||
"'extern'", "'export'", "'__align'", "'inline'", "'volatile'", "'static'",
|
||||
"'__interrupt'", "'register'", "'__zp_reserve'", "'__address'", "'__zp'",
|
||||
"'__mem'", "'__ssa'", "'__ma'", "'__intrinsic'", null, "'if'", "'else'",
|
||||
"'while'", "'do'", "'for'", "'switch'", "'return'", "'break'", "'continue'",
|
||||
|
@ -174,7 +174,7 @@ IMPORT_COMMENT_BLOCK=153
|
||||
'const'=40
|
||||
'extern'=41
|
||||
'export'=42
|
||||
'align'=43
|
||||
'__align'=43
|
||||
'inline'=44
|
||||
'volatile'=45
|
||||
'static'=46
|
||||
|
@ -6,13 +6,13 @@
|
||||
|
||||
// mulf_sqr tables will contain f(x)=int(x*x/4) and g(x) = f(x-255).
|
||||
// <f(x) = <(( x * x )/4)
|
||||
char align($100) mulf_sqr1_lo[512];
|
||||
char __align($100) mulf_sqr1_lo[512];
|
||||
// >f(x) = >(( x * x )/4)
|
||||
char align($100) mulf_sqr1_hi[512];
|
||||
char __align($100) mulf_sqr1_hi[512];
|
||||
// <g(x) = <((( x - 255) * ( x - 255 ))/4)
|
||||
char align($100) mulf_sqr2_lo[512];
|
||||
char __align($100) mulf_sqr2_lo[512];
|
||||
// >g(x) = >((( x - 255) * ( x - 255 ))/4)
|
||||
char align($100) mulf_sqr2_hi[512];
|
||||
char __align($100) mulf_sqr2_hi[512];
|
||||
|
||||
// Initialize the mulf_sqr multiplication tables with f(x)=int(x*x/4)
|
||||
void mulf_init() {
|
||||
|
@ -10,7 +10,7 @@ byte* SCREEN = 0x0400;
|
||||
|
||||
byte plots_per_frame[0x100];
|
||||
|
||||
align(0x100) signed word SINE[512];
|
||||
__align(0x100) signed word SINE[512];
|
||||
|
||||
void main() {
|
||||
sin16s_gen2(SINE, 512, -0x1001, 0x1001);
|
||||
|
@ -10,7 +10,7 @@ byte* SCREEN = 0x0400;
|
||||
|
||||
byte plots_per_frame[0x100];
|
||||
|
||||
align(0x100) signed word SINE[512];
|
||||
__align(0x100) signed word SINE[512];
|
||||
|
||||
void main() {
|
||||
sin16s_gen2(SINE, 512, -0x1001, 0x1001);
|
||||
|
@ -7,7 +7,7 @@
|
||||
byte* BITMAP = 0x2000;
|
||||
byte* SCREEN = 0x0400;
|
||||
|
||||
byte align(0x100) SINTAB[0x180] = kickasm {{ .fill $180, 99.5+99.5*sin(i*2*PI/256) }};
|
||||
byte __align(0x100) SINTAB[0x180] = kickasm {{ .fill $180, 99.5+99.5*sin(i*2*PI/256) }};
|
||||
byte* COSTAB = SINTAB+0x40;
|
||||
|
||||
void main() {
|
||||
|
@ -14,7 +14,7 @@ char __address(0x2000) DYPPA_CHARSET[0x0800] = kickasm(resource "dyppacharset.bi
|
||||
|
||||
// The DYPPA tables mapping the slopes, offsets and pixels to the right character in the charset
|
||||
// for(offset:0..7) for(slope:0..f) for(pixels: 0..f) glyph_id(offset,slope,pixels)
|
||||
char align(0x100) DYPPA_TABLE[0x0800] = kickasm(resource "dyppacharset.bin") {{
|
||||
char __align(0x100) DYPPA_TABLE[0x0800] = kickasm(resource "dyppacharset.bin") {{
|
||||
.var dyppaFile2 = LoadBinary("dyppacharset.bin", "Charset=$000,Tables=$800")
|
||||
.fill dyppaFile2.getTablesSize(), dyppaFile2.getTables(i)
|
||||
}};
|
||||
|
@ -52,7 +52,7 @@ void main() {
|
||||
// Sprite Buffer (in GAME RAM)
|
||||
// Will be transferred to the PPU via DMA during vblank
|
||||
#pragma data_seg(GameRam)
|
||||
struct SpriteData align(0x100) SPRITE_BUFFER[0x40];
|
||||
struct SpriteData __align(0x100) SPRITE_BUFFER[0x40];
|
||||
|
||||
// Data (in PRG ROM)
|
||||
#pragma data_seg(Data)
|
||||
|
@ -147,7 +147,7 @@ export char TILES[] = kickasm(resource "lazydata.chr") {{
|
||||
// Sprite Buffer (in GAME RAM)
|
||||
// Will be transferred to the PPU via DMA during vblank
|
||||
#pragma data_seg(GameRam)
|
||||
struct SpriteData align(0x100) SPRITE_BUFFER[0x100];
|
||||
struct SpriteData __align(0x100) SPRITE_BUFFER[0x100];
|
||||
|
||||
// Interrupt Vectors (in PRG ROM)
|
||||
#pragma data_seg(Vectors)
|
||||
|
@ -147,7 +147,7 @@ export char TILES[] = kickasm(resource "lazydata.chr") {{
|
||||
// Sprite Buffer (in GAME RAM)
|
||||
// Will be transferred to the PPU via DMA during vblank
|
||||
#pragma data_seg(GameRam)
|
||||
struct SpriteData align(0x100) SPRITE_BUFFER[0x100];
|
||||
struct SpriteData __align(0x100) SPRITE_BUFFER[0x100];
|
||||
|
||||
// Interrupt Vectors (in PRG ROM)
|
||||
#pragma data_seg(Vectors)
|
||||
|
@ -33,7 +33,7 @@ char volatile canvas_show_memory = toD018(SCREEN, CANVAS2);
|
||||
char volatile canvas_show_flag = 0;
|
||||
|
||||
// SIN/COS tables
|
||||
char align(0x100) SINTAB[0x140] = kickasm {{
|
||||
char __align(0x100) SINTAB[0x140] = kickasm {{
|
||||
.fill $200, round(63 + 63*sin(i*2*PI/$100))
|
||||
}};
|
||||
char* COSTAB = SINTAB+0x40;
|
||||
|
@ -21,7 +21,7 @@ const char PROTO_BOB[3*3*8] = kickasm(resource "smiley.png") {{
|
||||
// Sine and Cosine tables
|
||||
// Angles: $00=0, $80=PI,$100=2*PI
|
||||
// Sine/Cosine: signed fixed [-$7f,$7f]
|
||||
signed char align(0x40) SIN[0x140] = kickasm {{
|
||||
signed char __align(0x40) SIN[0x140] = kickasm {{
|
||||
.for(var i=0;i<$140;i++)
|
||||
.byte >round($7fff*sin(i*2*PI/256))
|
||||
}};
|
||||
|
@ -21,7 +21,7 @@ const char PROTO_BOB[3*3*8] = kickasm(resource "smiley.png") {{
|
||||
// Sine and Cosine tables
|
||||
// Angles: $00=0, $80=PI,$100=2*PI
|
||||
// Sine/Cosine: signed fixed [-$7f,$7f]
|
||||
signed char align(0x40) SIN[0x140] = kickasm {{
|
||||
signed char __align(0x40) SIN[0x140] = kickasm {{
|
||||
.for(var i=0;i<$140;i++)
|
||||
.byte >round($7fff*sin(i*2*PI/256))
|
||||
}};
|
||||
@ -29,11 +29,11 @@ signed char align(0x40) SIN[0x140] = kickasm {{
|
||||
signed char* COS = SIN+$40; // sin(x) = cos(x+PI/2)
|
||||
|
||||
// Vogel Sunflower polar coordinates
|
||||
align(0x100) const char VOGEL_THETA[] = kickasm {{
|
||||
__align(0x100) const char VOGEL_THETA[] = kickasm {{
|
||||
.const PHI = (1+sqrt(5))/2
|
||||
.fill 100, round(mod(256*i/(PHI*PHI),256))
|
||||
}};
|
||||
align(0x100) const char VOGEL_R[] = kickasm {{ .fill 100, round(sqrt(i)*15) }};
|
||||
__align(0x100) const char VOGEL_R[] = kickasm {{ .fill 100, round(sqrt(i)*15) }};
|
||||
|
||||
// The BASIC screen
|
||||
char* const SCREEN_BASIC = 0x0400;
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <keyboard.h>
|
||||
|
||||
// The BOB sprite
|
||||
align(0x1000) char SPRITE[] = kickasm(resource "smiley.png") {{
|
||||
__align(0x1000) char SPRITE[] = kickasm(resource "smiley.png") {{
|
||||
.var pic = LoadPicture("smiley.png", List().add($000000, $ffffff))
|
||||
.for (var y=0; y<21; y++)
|
||||
.for (var x=0;x<3; x++)
|
||||
@ -16,7 +16,7 @@ align(0x1000) char SPRITE[] = kickasm(resource "smiley.png") {{
|
||||
// Sine and Cosine tables
|
||||
// Angles: $00=0, $80=PI,$100=2*PI
|
||||
// Sine/Cosine: signed fixed [-$7f,$7f]
|
||||
align(0x40) signed char SIN[0x140] = kickasm {{
|
||||
__align(0x40) signed char SIN[0x140] = kickasm {{
|
||||
.for(var i=0;i<$140;i++)
|
||||
.byte >round($7fff*sin(i*2*PI/256))
|
||||
}};
|
||||
|
@ -108,7 +108,7 @@ void bitmap_plot_spline_8seg() {
|
||||
// Sine and Cosine tables
|
||||
// Angles: $00=0, $80=PI,$100=2*PI
|
||||
// Sine/Cosine: signed fixed [-$7f,$7f]
|
||||
signed char align(0x40) SIN[0x140] = kickasm {{
|
||||
signed char __align(0x40) SIN[0x140] = kickasm {{
|
||||
.for(var i=0;i<$140;i++)
|
||||
.byte >round($7fff*sin(i*2*PI/256))
|
||||
}};
|
||||
|
@ -18,11 +18,11 @@ char SPRITE_0 = toSpritePtr(SPRITES);
|
||||
|
||||
char FONT[0x0800];
|
||||
|
||||
char align(0x100) YSIN[0x100] = kickasm {{
|
||||
char __align(0x100) YSIN[0x100] = kickasm {{
|
||||
.fill $100, round(142+89.5*sin(toRadians(360*i/256)))
|
||||
}};
|
||||
|
||||
char align(0x100) XMOVEMENT[0x200] = kickasm {{
|
||||
char __align(0x100) XMOVEMENT[0x200] = kickasm {{
|
||||
//.lohifill $100, round(344-i*344/$100-86*sin(toRadians(360*i/$100)))
|
||||
//.lohifill $100, round(344-i*344/$100-129*sin(toRadians(360*i/$100)))
|
||||
.lohifill $100, round(344-i*344/$100 -86*sin(toRadians(360*i/$100)) -43*sin(toRadians(360*i/$80)))
|
||||
|
@ -2,7 +2,7 @@
|
||||
// The tetris pieces
|
||||
|
||||
// The T-piece
|
||||
align(0x40) char PIECE_T[64] = {
|
||||
__align(0x40) char PIECE_T[64] = {
|
||||
0, 0, 0, 0,
|
||||
1, 1, 1, 0,
|
||||
0, 1, 0, 0,
|
||||
@ -25,7 +25,7 @@ align(0x40) char PIECE_T[64] = {
|
||||
};
|
||||
|
||||
// The S-piece
|
||||
align(0x40) char PIECE_S[64] = {
|
||||
__align(0x40) char PIECE_S[64] = {
|
||||
0, 0, 0, 0,
|
||||
0, 1, 1, 0,
|
||||
1, 1, 0, 0,
|
||||
@ -49,7 +49,7 @@ align(0x40) char PIECE_S[64] = {
|
||||
};
|
||||
|
||||
// The Z-piece
|
||||
align(0x40) char PIECE_Z[64] = {
|
||||
__align(0x40) char PIECE_Z[64] = {
|
||||
0, 0, 0, 0,
|
||||
1, 1, 0, 0,
|
||||
0, 1, 1, 0,
|
||||
@ -73,7 +73,7 @@ align(0x40) char PIECE_Z[64] = {
|
||||
};
|
||||
|
||||
// The L-piece
|
||||
align(0x40) char PIECE_L[64] = {
|
||||
__align(0x40) char PIECE_L[64] = {
|
||||
0, 0, 0, 0,
|
||||
1, 1, 1, 0,
|
||||
1, 0, 0, 0,
|
||||
@ -97,7 +97,7 @@ align(0x40) char PIECE_L[64] = {
|
||||
};
|
||||
|
||||
// The J-piece
|
||||
align(0x40) char PIECE_J[64] = {
|
||||
__align(0x40) char PIECE_J[64] = {
|
||||
0, 0, 0, 0,
|
||||
1, 1, 1, 0,
|
||||
0, 0, 1, 0,
|
||||
@ -121,7 +121,7 @@ align(0x40) char PIECE_J[64] = {
|
||||
};
|
||||
|
||||
// The O-piece
|
||||
align(0x40) char PIECE_O[64] = {
|
||||
__align(0x40) char PIECE_O[64] = {
|
||||
0, 0, 0, 0,
|
||||
0, 1, 1, 0,
|
||||
0, 1, 1, 0,
|
||||
@ -145,7 +145,7 @@ align(0x40) char PIECE_O[64] = {
|
||||
};
|
||||
|
||||
// The I-piece
|
||||
align(0x40) char PIECE_I[64] = {
|
||||
__align(0x40) char PIECE_I[64] = {
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
1, 1, 1, 1,
|
||||
|
@ -38,8 +38,8 @@ char PIECES_COLORS_2[] = {
|
||||
|
||||
// Pointers to the screen address for rendering each playfield line
|
||||
// The lines for screen 1 is aligned with 0x80 and screen 2 with 0x40 - so XOR'ing with 0x40 gives screen 2 lines.
|
||||
align(0x80) char* screen_lines_1[PLAYFIELD_LINES];
|
||||
align(0x40) char* screen_lines_2[PLAYFIELD_LINES];
|
||||
__align(0x80) char* screen_lines_1[PLAYFIELD_LINES];
|
||||
__align(0x40) char* screen_lines_2[PLAYFIELD_LINES];
|
||||
|
||||
// Initialize rendering
|
||||
void render_init() {
|
||||
|
@ -64,6 +64,6 @@ export struct SysCall SYSCALLS[] = {
|
||||
{ JMP, &syscall2, NOP }
|
||||
};
|
||||
|
||||
export align(0x100) struct SysCall SYSCALL_RESET[] = {
|
||||
export __align(0x100) struct SysCall SYSCALL_RESET[] = {
|
||||
{ JMP, &main, NOP }
|
||||
};
|
||||
|
@ -385,7 +385,7 @@ void rotate_matrix(signed char x, signed char y, signed char z) {
|
||||
|
||||
// mulf_sqr tables will contain f(x)=int(x*x) and g(x) = f(1-x).
|
||||
// f(x) = >(( x * x ))
|
||||
char align(0x100) mulf_sqr1[0x200] = kickasm {{
|
||||
char __align(0x100) mulf_sqr1[0x200] = kickasm {{
|
||||
.for(var i=0;i<$200;i++) {
|
||||
.if(i<=159) { .byte round((i*i)/256) }
|
||||
.if(i>159 && i<=351 ) { .byte round(((i-256)*(i-256))/256) }
|
||||
@ -394,7 +394,7 @@ char align(0x100) mulf_sqr1[0x200] = kickasm {{
|
||||
}};
|
||||
|
||||
// g(x) = >((( 1 - x ) * ( 1 - x )))
|
||||
char align(0x100) mulf_sqr2[0x200] = kickasm {{
|
||||
char __align(0x100) mulf_sqr2[0x200] = kickasm {{
|
||||
.for(var i=0;i<$200;i++) {
|
||||
.if(i<=159) { .byte round((-i-1)*(-i-1)/256) }
|
||||
.if(i>159 && i<=351 ) { .byte round(((255-i)*(255-i))/256) }
|
||||
@ -413,9 +413,9 @@ char align(0x100) mulf_sqr2[0x200] = kickasm {{
|
||||
// - http://codebase64.org/doku.php?id=magazines:chacking16
|
||||
// mulf_sqr tables will contain f(x)=int(x*x) and g(x) = f(1-x).
|
||||
// f(x) = >(( x * x ))
|
||||
byte align($100) mulf_sqr1[512];
|
||||
byte __align($100) mulf_sqr1[512];
|
||||
// g(x) = >((( 1 - x ) * ( 1 - x )))
|
||||
byte align($100) mulf_sqr2[512];
|
||||
byte __align($100) mulf_sqr2[512];
|
||||
|
||||
// Initialize the mulf_sqr multiplication tables with f(x)=int(x*x) and g(x) = f(1-x)
|
||||
void mulf_init() {
|
||||
@ -446,7 +446,7 @@ __address(0x3000) char SPRITE[] = kickasm(resource "balloon.png") {{
|
||||
}};
|
||||
|
||||
// Perspective multiplication table containing (d/(z0-z)[z] for each z-value
|
||||
signed char align(0x100) PERSP_Z[0x100] = kickasm {{
|
||||
signed char __align(0x100) PERSP_Z[0x100] = kickasm {{
|
||||
{
|
||||
.var d = 256.0
|
||||
.var z0 = 6.0
|
||||
@ -464,7 +464,7 @@ signed char align(0x100) PERSP_Z[0x100] = kickasm {{
|
||||
// Sine and Cosine Tables
|
||||
// Angles: $00=0, $80=PI,$100=2*PI
|
||||
// Half Sine/Cosine: signed fixed [-$20;20]
|
||||
signed char align(0x40) SINH[0x140] = kickasm {{
|
||||
signed char __align(0x40) SINH[0x140] = kickasm {{
|
||||
{
|
||||
.var min = -$2000
|
||||
.var max = $2000
|
||||
@ -478,7 +478,7 @@ signed char align(0x40) SINH[0x140] = kickasm {{
|
||||
signed char* COSH = SINH+$40; // sin(x) = cos(x+PI/2)
|
||||
|
||||
// Quarter Sine/Cosine: signed fixed [-$10,$10]
|
||||
signed char align(0x40) SINQ[0x140] = kickasm {{
|
||||
signed char __align(0x40) SINQ[0x140] = kickasm {{
|
||||
{
|
||||
.var min = -$1000
|
||||
.var max = $1000
|
||||
@ -494,7 +494,7 @@ signed char* COSQ = SINQ+$40; // sin(x) = cos(x+PI/2)
|
||||
// 16 bit Sine and Cosine Tables
|
||||
// Angles: $00=0, $80=PI,$100=2*PI
|
||||
// Half Sine/Cosine: signed fixed [-$1f,$1f]
|
||||
char align(0x40) SINH_LO[0x140] = kickasm {{
|
||||
char __align(0x40) SINH_LO[0x140] = kickasm {{
|
||||
{
|
||||
.var min = -$2000
|
||||
.var max = $2000
|
||||
@ -507,7 +507,7 @@ char align(0x40) SINH_LO[0x140] = kickasm {{
|
||||
}};
|
||||
char* COSH_LO = SINH_LO+$40; // sin(x) = cos(x+PI/2)
|
||||
|
||||
char align(0x40) SINH_HI[0x140] = kickasm {{
|
||||
char __align(0x40) SINH_HI[0x140] = kickasm {{
|
||||
{
|
||||
.var min = -$2000
|
||||
.var max = $2000
|
||||
@ -521,7 +521,7 @@ char align(0x40) SINH_HI[0x140] = kickasm {{
|
||||
char* COSH_HI = SINH_HI+$40; // sin(x) = cos(x+PI/2)
|
||||
|
||||
// Quarter Sine/Cosine: signed fixed [-$0f,$0f]
|
||||
char align(0x40) SINQ_LO[0x140] = kickasm {{
|
||||
char __align(0x40) SINQ_LO[0x140] = kickasm {{
|
||||
{
|
||||
.var min = -$1000
|
||||
.var max = $1000
|
||||
@ -534,7 +534,7 @@ char align(0x40) SINQ_LO[0x140] = kickasm {{
|
||||
}};
|
||||
char* COSQ_LO = SINQ_LO+$40; // sin(x) = cos(x+PI/2)
|
||||
|
||||
char align(0x40) SINQ_HI[0x140] = kickasm {{
|
||||
char __align(0x40) SINQ_HI[0x140] = kickasm {{
|
||||
{
|
||||
.var min = -$1000
|
||||
.var max = $1000
|
||||
|
@ -97,9 +97,9 @@ void perspective(signed char x, signed char y, signed char z) {
|
||||
// - http://codebase64.org/doku.php?id=magazines:chacking16
|
||||
// mulf_sqr tables will contain f(x)=int(x*x) and g(x) = f(1-x).
|
||||
// f(x) = >(( x * x ))
|
||||
char align($100) mulf_sqr1[512];
|
||||
char __align($100) mulf_sqr1[512];
|
||||
// g(x) = >((( 1 - x ) * ( 1 - x )))
|
||||
char align($100) mulf_sqr2[512];
|
||||
char __align($100) mulf_sqr2[512];
|
||||
|
||||
// Initialize the mulf_sqr multiplication tables with f(x)=int(x*x) and g(x) = f(1-x)
|
||||
void mulf_init() {
|
||||
@ -121,7 +121,7 @@ void mulf_init() {
|
||||
}
|
||||
|
||||
// Perspective multiplication table containing (d/(z0-z)[z] for each z-value
|
||||
signed char align(0x100) PERSP_Z[0x100] = kickasm {{
|
||||
signed char __align(0x100) PERSP_Z[0x100] = kickasm {{
|
||||
{
|
||||
.var d = 256.0
|
||||
.var z0 = 5.0
|
||||
|
@ -6,13 +6,13 @@
|
||||
#include <6502.h>
|
||||
#include <string.h>
|
||||
|
||||
align(0x100) char SIN[256] = kickasm {{
|
||||
__align(0x100) char SIN[256] = kickasm {{
|
||||
.fill 256, 99+99*sin(i*2*PI/256)
|
||||
}};
|
||||
|
||||
align(0x100) char BARS[230];
|
||||
__align(0x100) char BARS[230];
|
||||
|
||||
align(0x100) char BAR[32] = {
|
||||
__align(0x100) char BAR[32] = {
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
|
||||
0x1f, 0x1e, 0x1d, 0x1c, 0x1b, 0x1a, 0x19, 0x18, 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10,
|
||||
};
|
||||
|
@ -8,7 +8,7 @@
|
||||
#define NUM_SPRITES 32
|
||||
|
||||
// A 64*64 8bpp TUT sprite and palette
|
||||
align(0x1000) char SPRITE_PIXELS[64*64+0x200] = kickasm(resource "tut.png") {{
|
||||
__align(0x1000) char SPRITE_PIXELS[64*64+0x200] = kickasm(resource "tut.png") {{
|
||||
.var pic = LoadPicture("tut.png")
|
||||
// palette: rgb->idx
|
||||
.var palette = Hashtable()
|
||||
@ -76,13 +76,13 @@ void main() {
|
||||
|
||||
// X sine [0;640-64]
|
||||
const char SINX_LEN = 241;
|
||||
align(0x100) unsigned int SINX[SINX_LEN] = kickasm {{
|
||||
__align(0x100) unsigned int SINX[SINX_LEN] = kickasm {{
|
||||
.fillword 256, 288+288*sin(i*2*PI/SINX_LEN)
|
||||
}};
|
||||
|
||||
// Y sine [0;480-64]
|
||||
const char SINY_LEN = 251;
|
||||
align(0x100) unsigned int SINY[SINY_LEN] = kickasm {{
|
||||
__align(0x100) unsigned int SINY[SINY_LEN] = kickasm {{
|
||||
.fillword 256, 208+208*sin(i*2*PI/SINY_LEN)
|
||||
}};
|
||||
|
||||
|
@ -71,7 +71,7 @@ signed char fmul8(signed char a, signed char b) {
|
||||
|
||||
// mulf_sqr tables will contain f(x)=int(x*x) and g(x) = f(1-x).
|
||||
// f(x) = >(( x * x ))
|
||||
char align(0x100) mulf_sqr1[0x200] = kickasm {{
|
||||
char __align(0x100) mulf_sqr1[0x200] = kickasm {{
|
||||
.for(var i=0;i<$200;i++) {
|
||||
.if(i<=159) { .byte round((i*i)/256) }
|
||||
.if(i>159 && i<=351 ) { .byte round(((i-256)*(i-256))/256) }
|
||||
@ -81,7 +81,7 @@ char align(0x100) mulf_sqr1[0x200] = kickasm {{
|
||||
|
||||
|
||||
// g(x) = >((( 1 - x ) * ( 1 - x )))
|
||||
char align(0x100) mulf_sqr2[0x200] = kickasm {{
|
||||
char __align(0x100) mulf_sqr2[0x200] = kickasm {{
|
||||
.for(var i=0;i<$200;i++) {
|
||||
.if(i<=159) { .byte round((-i-1)*(-i-1)/256) }
|
||||
.if(i>159 && i<=351 ) { .byte round(((255-i)*(255-i))/256) }
|
||||
|
@ -6,7 +6,7 @@
|
||||
char* const SCREEN = 0x0400;
|
||||
char* const FONT_ORIGINAL = 0x2000;
|
||||
char* const FONT_COMPRESSED = 0x2800;
|
||||
char align(0x100) FONT_COMPRESSED_MAP[0x100];
|
||||
char __align(0x100) FONT_COMPRESSED_MAP[0x100];
|
||||
|
||||
void main() {
|
||||
// Create 2x2 font from CHARGEN
|
||||
|
@ -5,7 +5,7 @@
|
||||
// Location of screen & sprites
|
||||
char* SCREEN = $400;
|
||||
|
||||
char align(0x100) YSIN[0x100] = kickasm {{
|
||||
char __align(0x100) YSIN[0x100] = kickasm {{
|
||||
.var min = 50
|
||||
.var max = 250-21
|
||||
.var ampl = max-min;
|
||||
|
@ -115,7 +115,7 @@ export char TILES[] = kickasm(resource "smb1_chr.bin") {{
|
||||
// Sprite Buffer (in GAME RAM)
|
||||
// Will be transferred to the PPU via DMA during vblank
|
||||
#pragma data_seg(GameRam)
|
||||
struct SpriteData align(0x100) SPRITE_BUFFER[0x40];
|
||||
struct SpriteData __align(0x100) SPRITE_BUFFER[0x40];
|
||||
|
||||
// Interrupt Vectors (in PRG ROM)
|
||||
#pragma data_seg(Vectors)
|
||||
|
@ -110,7 +110,7 @@ export char TILES[] = kickasm(resource "characters.901225-01.bin") {{
|
||||
// Sprite Buffer (in GAME RAM)
|
||||
// Will be transferred to the PPU via DMA during vblank
|
||||
#pragma data_seg(GameRam)
|
||||
struct SpriteData align(0x100) SPRITE_BUFFER[0x100];
|
||||
struct SpriteData __align(0x100) SPRITE_BUFFER[0x100];
|
||||
|
||||
// Interrupt Vectors (in PRG ROM)
|
||||
#pragma data_seg(Vectors)
|
||||
|
@ -12,7 +12,7 @@
|
||||
unsigned char* const SCREEN1 = $2800;
|
||||
unsigned char* const CHARSET = $2000;
|
||||
|
||||
const unsigned char align(0x100) SINTABLE[0x100] = kickasm {{
|
||||
const unsigned char __align(0x100) SINTABLE[0x100] = kickasm {{
|
||||
.for(var i=0;i<$100;i++)
|
||||
.byte round(127.5+127.5*sin(toRadians(360*i/256)))
|
||||
}};
|
||||
|
@ -11,7 +11,7 @@ char* const SCREEN1 = 0x2800;
|
||||
char* const SCREEN2 = 0x2c00;
|
||||
char* const CHARSET = 0x2000;
|
||||
|
||||
const char align(0x100) SINTABLE[0x100] = kickasm {{
|
||||
const char __align(0x100) SINTABLE[0x100] = kickasm {{
|
||||
.for(var i=0;i<$100;i++)
|
||||
.byte round(127.5+127.5*sin(2*PI*i/256))
|
||||
}};
|
||||
|
@ -10,7 +10,7 @@ char* SCREEN = $0400;
|
||||
// Sine and Cosine tables
|
||||
// Angles: $00=0, $80=PI,$100=2*PI
|
||||
// Sine/Cosine: signed fixed [-$7f,$7f]
|
||||
char align(0x40) SIN[0x140] = kickasm {{
|
||||
char __align(0x40) SIN[0x140] = kickasm {{
|
||||
.for(var i=0;i<$140;i++)
|
||||
.byte >round($7fff*sin(i*2*PI/256))
|
||||
}};
|
||||
|
@ -13,7 +13,7 @@ __address(0x2000) char LOGO[6*40*8] = kickasm(resource "logo.png") {{
|
||||
|
||||
const unsigned int XSIN_SIZE = 512;
|
||||
|
||||
signed int align($100) xsin[XSIN_SIZE];
|
||||
signed int __align($100) xsin[XSIN_SIZE];
|
||||
|
||||
void main() {
|
||||
asm { sei }
|
||||
|
@ -10,7 +10,7 @@ char* BITMAP = $2000;
|
||||
|
||||
const unsigned int SIN_SIZE = 512;
|
||||
|
||||
signed int align($100) sin[512];
|
||||
signed int __align($100) sin[512];
|
||||
|
||||
signed int sin2[512] = kickasm {{
|
||||
.for(var i=0; i<512; i++) {
|
||||
|
@ -55,11 +55,11 @@ void print_mulf8s127(signed char a, signed char b) {
|
||||
|
||||
// mulf_sqr tables will contain f(x)=int(x*x/4) and g(x) = f(x-255).
|
||||
// f(x) = ( x * x )/4
|
||||
unsigned char align($100) mulf127_sqr1_lo[512] = kickasm{{ .fill 512, <round((i/127*i/127)*127/4) }};
|
||||
unsigned char align($100) mulf127_sqr1_hi[512] = kickasm{{ .fill 512, >round((i/127*i/127)*127/4) }};
|
||||
unsigned char __align($100) mulf127_sqr1_lo[512] = kickasm{{ .fill 512, <round((i/127*i/127)*127/4) }};
|
||||
unsigned char __align($100) mulf127_sqr1_hi[512] = kickasm{{ .fill 512, >round((i/127*i/127)*127/4) }};
|
||||
// g(x) = <((( x - 255) * ( x - 255 ))/4)
|
||||
unsigned char align($100) mulf127_sqr2_lo[512] = kickasm{{ .fill 512, <round(((i-255)/127*(i-255)/127)*127/4) }};
|
||||
unsigned char align($100) mulf127_sqr2_hi[512] = kickasm{{ .fill 512, >round(((i-255)/127*(i-255)/127)*127/4) }};
|
||||
unsigned char __align($100) mulf127_sqr2_lo[512] = kickasm{{ .fill 512, <round(((i-255)/127*(i-255)/127)*127/4) }};
|
||||
unsigned char __align($100) mulf127_sqr2_hi[512] = kickasm{{ .fill 512, >round(((i-255)/127*(i-255)/127)*127/4) }};
|
||||
|
||||
unsigned word mulf8u127(unsigned char a, unsigned char b) {
|
||||
byte* const memA = $fc;
|
||||
|
@ -1,3 +1,3 @@
|
||||
|
||||
byte align($100) b;
|
||||
byte __align($100) b;
|
||||
|
||||
|
@ -19,7 +19,7 @@ void main() {
|
||||
}
|
||||
}
|
||||
|
||||
const char align(0x100) SINTABLE[0x100] = kickasm {{
|
||||
const char __align(0x100) SINTABLE[0x100] = kickasm {{
|
||||
.for(var i=0;i<$100;i++)
|
||||
.byte round(127.5+127.5*sin(2*PI*i/256))
|
||||
}};
|
||||
|
@ -1,9 +1,9 @@
|
||||
// Test that memory alignment of arrays work
|
||||
|
||||
byte align($100) bs[$100];
|
||||
byte __align($100) bs[$100];
|
||||
|
||||
void main() {
|
||||
byte align($100) cs[$100];
|
||||
byte __align($100) cs[$100];
|
||||
for( byte i: 0..255) {
|
||||
bs[i] = i;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ char* const CHARSET = 0xE800;
|
||||
const char PAGE1 = ((((unsigned int)SCREEN1) >> 6) & 0xF0) | (((unsigned int)CHARSET >> 10) & 0x0E);
|
||||
const char PAGE2 = ((((unsigned int)SCREEN2) >> 6) & 0xF0) | (((unsigned int)CHARSET >> 10) & 0x0E);
|
||||
|
||||
const char align($100) sinetable[0x100] = {
|
||||
const char __align($100) sinetable[0x100] = {
|
||||
0x80, 0x7d, 0x7a, 0x77, 0x74, 0x70, 0x6d, 0x6a,
|
||||
0x67, 0x64, 0x61, 0x5e, 0x5b, 0x58, 0x55, 0x52,
|
||||
0x4f, 0x4d, 0x4a, 0x47, 0x44, 0x41, 0x3f, 0x3c,
|
||||
|
@ -4,7 +4,7 @@
|
||||
const unsigned int COUNT = 16384;
|
||||
const char SQRT_COUNT = 128;
|
||||
|
||||
align(0x0100) char Sieve[COUNT];
|
||||
__align(0x0100) char Sieve[COUNT];
|
||||
|
||||
void round(void) {
|
||||
register char* S;
|
||||
|
@ -25,13 +25,13 @@ void main() {
|
||||
|
||||
// mulf_sqr tables will contain f(x)=int(x*x/4) and g(x) = f(x-255).
|
||||
// <f(x) = <(( x * x )/4)
|
||||
byte align($100) mulf_sqr1_lo[512];
|
||||
byte __align($100) mulf_sqr1_lo[512];
|
||||
// >f(x) = >(( x * x )/4)
|
||||
byte align($100) mulf_sqr1_hi[512];
|
||||
byte __align($100) mulf_sqr1_hi[512];
|
||||
// <g(x) = <((( x - 255) * ( x - 255 ))/4)
|
||||
byte align($100) mulf_sqr2_lo[512];
|
||||
byte __align($100) mulf_sqr2_lo[512];
|
||||
// >g(x) = >((( x - 255) * ( x - 255 ))/4)
|
||||
byte align($100) mulf_sqr2_hi[512];
|
||||
byte __align($100) mulf_sqr2_hi[512];
|
||||
|
||||
// Initialize the mulf_sqr multiplication tables with f(x)=int(x*x/4)
|
||||
void mulf_init() {
|
||||
|
@ -4,14 +4,14 @@
|
||||
// Location of screen & sprites
|
||||
char* SCREEN = 0x0400;
|
||||
|
||||
char align(0x40) SPRITE[0x40] = kickasm(resource "balloon.png") {{
|
||||
char __align(0x40) SPRITE[0x40] = kickasm(resource "balloon.png") {{
|
||||
.var pic = LoadPicture("balloon.png", List().add($000000, $ffffff))
|
||||
.for (var y=0; y<21; y++)
|
||||
.for (var x=0;x<3; x++)
|
||||
.byte pic.getSinglecolorByte(x,y)
|
||||
}};
|
||||
|
||||
char align(0x100) YSIN[0x100] = kickasm {{
|
||||
char __align(0x100) YSIN[0x100] = kickasm {{
|
||||
.fill $100, round(139.5+89.5*sin(toRadians(360*i/256)))
|
||||
}};
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include <atan2.h>
|
||||
#include <print.h>
|
||||
|
||||
const char align(0x100) SINTABLE[0x200] = kickasm {{
|
||||
const char __align(0x100) SINTABLE[0x200] = kickasm {{
|
||||
.for(var i=0;i<$200;i++)
|
||||
.byte round(127.5+127.5*sin(2*PI*i/256))
|
||||
}};
|
||||
|
@ -45,13 +45,13 @@ signed word muls8s(signed byte a, signed byte b) {
|
||||
|
||||
// ASM based multiplication tables
|
||||
// <(( x * x )/4)
|
||||
byte align($100) mula_sqr1_lo[512];
|
||||
byte __align($100) mula_sqr1_lo[512];
|
||||
// >(( x * x )/4)
|
||||
byte align($100) mula_sqr1_hi[512];
|
||||
byte __align($100) mula_sqr1_hi[512];
|
||||
// <((( x - 255) * ( x - 255 ))/4)
|
||||
byte align($100) mula_sqr2_lo[512];
|
||||
byte __align($100) mula_sqr2_lo[512];
|
||||
// >((( x - 255) * ( x - 255 ))/4)
|
||||
byte align($100) mula_sqr2_hi[512];
|
||||
byte __align($100) mula_sqr2_hi[512];
|
||||
// Initialize the multiplication tables using ASM code from
|
||||
// http://codebase64.org/doku.php?id=base:seriously_fast_multiplication
|
||||
void mulf_init_asm() {
|
||||
|
@ -4,18 +4,18 @@
|
||||
#include <c64.h>
|
||||
|
||||
// A 256-byte (co)sine (with $ff in the first two entries)
|
||||
const unsigned char align(0x100) SINTABLE[0x100] = kickasm {{
|
||||
const unsigned char __align(0x100) SINTABLE[0x100] = kickasm {{
|
||||
.for(var i=0;i<$100;i++)
|
||||
.byte round(127.5+127.5*cos(toRadians(360*i/256)))
|
||||
}};
|
||||
|
||||
// Storage for saving/restoring zeropage
|
||||
const unsigned char align(0x100) ZP_STORAGE[0x100];
|
||||
const unsigned char __align(0x100) ZP_STORAGE[0x100];
|
||||
|
||||
char* const SCREEN = 0x0400;
|
||||
|
||||
// A single sprite to animate
|
||||
const align(0x40) char SPRITE[0x40] = kickasm {{ .fill $40,$ff }};
|
||||
const __align(0x40) char SPRITE[0x40] = kickasm {{ .fill $40,$ff }};
|
||||
|
||||
void main() {
|
||||
// Stop interrupts
|
||||
|
Loading…
x
Reference in New Issue
Block a user