mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-09-29 03:56:15 +00:00
Added slope initialization and a few fragments.
This commit is contained in:
parent
2c6947a600
commit
3de1834b35
@ -0,0 +1,7 @@
|
|||||||
|
clc
|
||||||
|
lda {c1}
|
||||||
|
adc #1
|
||||||
|
sta {m1}
|
||||||
|
lda {c1}+1
|
||||||
|
adc #0
|
||||||
|
sta {m1}+1
|
@ -0,0 +1,6 @@
|
|||||||
|
lda {c1}+1
|
||||||
|
lsr
|
||||||
|
sta {m1}+1
|
||||||
|
lda {c1}
|
||||||
|
ror
|
||||||
|
sta {m1}
|
@ -44,6 +44,8 @@ char line_dma_command[] = {
|
|||||||
DMA_OPTION_LINE_XSTEP_HI, (25*64 - 8) >> 8, // Line X step bytes 64x25
|
DMA_OPTION_LINE_XSTEP_HI, (25*64 - 8) >> 8, // Line X step bytes 64x25
|
||||||
DMA_OPTION_LINE_SLOPE_LO, 0, // Line Slope
|
DMA_OPTION_LINE_SLOPE_LO, 0, // Line Slope
|
||||||
DMA_OPTION_LINE_SLOPE_HI, 0, // Line Slope
|
DMA_OPTION_LINE_SLOPE_HI, 0, // Line Slope
|
||||||
|
DMA_OPTION_LINE_SLOPE_INIT_LO, 0, // Line slope init
|
||||||
|
DMA_OPTION_LINE_SLOPE_INIT_HI, 0, // Line slope init
|
||||||
DMA_OPTION_LINE_MODE, 0, // Line Mode
|
DMA_OPTION_LINE_MODE, 0, // Line Mode
|
||||||
DMA_OPTION_FORMAT_F018A, // F018A list format
|
DMA_OPTION_FORMAT_F018A, // F018A list format
|
||||||
DMA_OPTION_END, // end of options
|
DMA_OPTION_END, // end of options
|
||||||
@ -58,14 +60,16 @@ char line_dma_command[] = {
|
|||||||
|
|
||||||
// Offset of the DMA line SLOPE
|
// Offset of the DMA line SLOPE
|
||||||
const char LINE_DMA_COMMAND_SLOPE_OFFSET = 5;
|
const char LINE_DMA_COMMAND_SLOPE_OFFSET = 5;
|
||||||
|
// Offset of the DMA line SLOPE init
|
||||||
|
const char LINE_DMA_COMMAND_SLOPE_INIT_OFFSET = 9;
|
||||||
// Offset of the DMA line MODE
|
// Offset of the DMA line MODE
|
||||||
const char LINE_DMA_COMMAND_MODE_OFFSET = 9;
|
const char LINE_DMA_COMMAND_MODE_OFFSET = 13;
|
||||||
// Offset of the DMA count
|
// Offset of the DMA count
|
||||||
const char LINE_DMA_COMMAND_COUNT_OFFSET = 13;
|
const char LINE_DMA_COMMAND_COUNT_OFFSET = 17;
|
||||||
// Offset of the DMA source
|
// Offset of the DMA source
|
||||||
const char LINE_DMA_COMMAND_SRC_OFFSET = 15;
|
const char LINE_DMA_COMMAND_SRC_OFFSET = 19;
|
||||||
// Offset of the DMA destination
|
// Offset of the DMA destination
|
||||||
const char LINE_DMA_COMMAND_DEST_OFFSET = 18;
|
const char LINE_DMA_COMMAND_DEST_OFFSET = 22;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
|
||||||
@ -85,11 +89,26 @@ void main() {
|
|||||||
VICIV->CONTROLC |= VICIV_VFAST;
|
VICIV->CONTROLC |= VICIV_VFAST;
|
||||||
|
|
||||||
graphics_mode();
|
graphics_mode();
|
||||||
|
|
||||||
|
draw_line(0, 100, 319, 0, 1);
|
||||||
|
|
||||||
|
/*
|
||||||
draw_line(160, 100, 0, 199, 1);
|
draw_line(160, 100, 0, 199, 1);
|
||||||
draw_line(160, 100, 319, 199, 2);
|
draw_line(160, 100, 319, 199, 2);
|
||||||
draw_line( 0, 0, 160, 100, 3);
|
draw_line( 0, 0, 160, 100, 3);
|
||||||
draw_line(160, 100, 319, 0, 4);
|
draw_line(160, 100, 319, 0, 4);
|
||||||
|
|
||||||
|
for(int x1=0;x1<320;x1+=10) {
|
||||||
|
draw_line(x1, 0, 160, 199, 5);
|
||||||
|
draw_line(160, 0, x1, 199, 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int y1=0;y1<200;y1+=10) {
|
||||||
|
draw_line(0, y1, 319, 100, 6);
|
||||||
|
draw_line(0, 100, 319, y1, 6);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
for(;;) ;
|
for(;;) ;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -182,11 +201,15 @@ void draw_line(int x1, int y1, int x2, int y2, unsigned char colour) {
|
|||||||
|
|
||||||
// Slope is the most significant bytes of the fractional part
|
// Slope is the most significant bytes of the fractional part
|
||||||
// of the division result
|
// of the division result
|
||||||
int slope = *MATH_DIVOUT_FRAC_INT1;
|
unsigned int slope = (unsigned int)*MATH_DIVOUT_FRAC_INT1;
|
||||||
|
|
||||||
// Put slope into DMA options
|
// Put slope into DMA options
|
||||||
line_dma_command[LINE_DMA_COMMAND_SLOPE_OFFSET] = LOBYTE(slope);
|
line_dma_command[LINE_DMA_COMMAND_SLOPE_OFFSET] = LOBYTE(slope);
|
||||||
line_dma_command[LINE_DMA_COMMAND_SLOPE_OFFSET + 2] = HIBYTE(slope);
|
line_dma_command[LINE_DMA_COMMAND_SLOPE_OFFSET + 2] = HIBYTE(slope);
|
||||||
|
// Put slope init into DMA options
|
||||||
|
unsigned int slope_init = slope/2;
|
||||||
|
line_dma_command[LINE_DMA_COMMAND_SLOPE_INIT_OFFSET] = LOBYTE(slope_init);
|
||||||
|
line_dma_command[LINE_DMA_COMMAND_SLOPE_INIT_OFFSET + 2] = HIBYTE(slope_init);
|
||||||
|
|
||||||
// Load DMA dest address with the address of the first pixel
|
// Load DMA dest address with the address of the first pixel
|
||||||
unsigned long addr = GRAPHICS + (x1/8) * 64 * 25 + (y1*8) + (x1&7);
|
unsigned long addr = GRAPHICS + (x1/8) * 64 * 25 + (y1*8) + (x1&7);
|
||||||
@ -236,12 +259,17 @@ void draw_line(int x1, int y1, int x2, int y2, unsigned char colour) {
|
|||||||
VICIV->BORDER_COLOR = 0;
|
VICIV->BORDER_COLOR = 0;
|
||||||
|
|
||||||
// Slope is the most significant bytes of the fractional part of the division result
|
// Slope is the most significant bytes of the fractional part of the division result
|
||||||
int slope = *MATH_DIVOUT_FRAC_INT1;
|
unsigned int slope = (unsigned int)*MATH_DIVOUT_FRAC_INT1;
|
||||||
|
|
||||||
// Put slope into DMA options
|
// Put slope into DMA options
|
||||||
line_dma_command[LINE_DMA_COMMAND_SLOPE_OFFSET] = LOBYTE(slope);
|
line_dma_command[LINE_DMA_COMMAND_SLOPE_OFFSET] = LOBYTE(slope);
|
||||||
line_dma_command[LINE_DMA_COMMAND_SLOPE_OFFSET + 2] = HIBYTE(slope);
|
line_dma_command[LINE_DMA_COMMAND_SLOPE_OFFSET + 2] = HIBYTE(slope);
|
||||||
|
|
||||||
|
// Put slope init into DMA options
|
||||||
|
unsigned int slope_init = slope/2;
|
||||||
|
line_dma_command[LINE_DMA_COMMAND_SLOPE_INIT_OFFSET] = LOBYTE(slope_init);
|
||||||
|
line_dma_command[LINE_DMA_COMMAND_SLOPE_INIT_OFFSET + 2] = HIBYTE(slope_init);
|
||||||
|
|
||||||
// Load DMA dest address with the address of the first pixel
|
// Load DMA dest address with the address of the first pixel
|
||||||
unsigned long addr = GRAPHICS + (x1/8) * 64 * 25 + (y1*8) + (x1&7);
|
unsigned long addr = GRAPHICS + (x1/8) * 64 * 25 + (y1*8) + (x1&7);
|
||||||
line_dma_command[LINE_DMA_COMMAND_DEST_OFFSET + 0] = BYTE0(addr);
|
line_dma_command[LINE_DMA_COMMAND_DEST_OFFSET + 0] = BYTE0(addr);
|
||||||
|
Loading…
Reference in New Issue
Block a user