need to move the ocmments to readme
This commit is contained in:
parent
3badd74977
commit
e9ff1405df
1 changed files with 3 additions and 33 deletions
36
src/main.c
36
src/main.c
|
@ -1,36 +1,21 @@
|
|||
#include <stdio.h>
|
||||
#define BYTE unsigned char
|
||||
|
||||
// bit-mapped graphics memory is located $2000-$3FFF (8192-16383)
|
||||
// and that the video RAM lies at $0400-$07FF (1024-2047).
|
||||
// This makes it impossible to work with text and graphics at the same time
|
||||
|
||||
// The C heap is located at the end of the program and grows towards the C runtime stack.
|
||||
|
||||
// https://cc65.github.io/doc/c64.html#ss4.1
|
||||
// The C runtime stack is located at $CFFF (53247) and growing downwards.
|
||||
// Should be plenty of stack space between the top of the graphics memory
|
||||
|
||||
|
||||
short i;
|
||||
short x; // maybe if the ant does not go tooo far it could be an int..
|
||||
short x;
|
||||
short y;
|
||||
short direction; // 0 = right, 64 = up, 128 = left, 192 = down
|
||||
BYTE direction;
|
||||
void setHiRes(void) {
|
||||
*(BYTE*)0xd011 = *(BYTE*)0xd011 | 0xb0 ; // Graphics on
|
||||
*(BYTE*)0xd016 = *(BYTE*)0xd016 & 240; //Multi color off
|
||||
*(BYTE*)0xd018 = *(BYTE*)0xd018 | 8 ; // Graphics to $2000
|
||||
}
|
||||
void clearHiRes(void) {
|
||||
// Hi-res is turned on by setting bits 5 and 6 (bit 6 must be set in any event)
|
||||
// of register 17 of the VIC and clearing bit 4 of register 22.
|
||||
// Clear memory
|
||||
for (i =0;i< 8000; i++)
|
||||
{
|
||||
*(BYTE*)(0x2000+i) = 0;
|
||||
}
|
||||
|
||||
// Clear colors
|
||||
for (i =0;i< 1000; i++)
|
||||
{
|
||||
*(BYTE*)(0x400+i) = 0xf0;
|
||||
|
@ -38,9 +23,6 @@ void clearHiRes(void) {
|
|||
}
|
||||
|
||||
void fillHiRes(void) {
|
||||
// Hi-res is turned on by setting bits 5 and 6 (bit 6 must be set in any event)
|
||||
// of register 17 of the VIC and clearing bit 4 of register 22.
|
||||
// Clear memory
|
||||
for (i =0;i< 8000; i++)
|
||||
{
|
||||
*(BYTE*)(0x2000+i) = 0xff;
|
||||
|
@ -53,7 +35,6 @@ void setAndClearHiRes(){
|
|||
clearHiRes();
|
||||
}
|
||||
|
||||
// need to think
|
||||
BYTE isPositionWhite(short x, BYTE y)
|
||||
{
|
||||
short ra = (320 * (BYTE)(y/8)) + (y & 7);
|
||||
|
@ -99,14 +80,10 @@ void moveForward() {
|
|||
|
||||
void turnLeft(){
|
||||
direction = direction + 64;
|
||||
if (direction >= 255)
|
||||
direction = 0;
|
||||
}
|
||||
|
||||
void turnRight(){
|
||||
direction = direction - 64;
|
||||
if (direction <0)
|
||||
direction = 192;
|
||||
}
|
||||
|
||||
|
||||
|
@ -121,11 +98,7 @@ void makeMove() {
|
|||
moveForward();
|
||||
}
|
||||
|
||||
unsigned short line;
|
||||
unsigned short foo;
|
||||
unsigned short j;
|
||||
int main(void) {
|
||||
|
||||
setAndClearHiRes();
|
||||
x = 160;
|
||||
y = 100;
|
||||
|
@ -134,8 +107,5 @@ int main(void) {
|
|||
{
|
||||
makeMove();
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue