prepare for KickC upgrade

This commit is contained in:
nino-porcino 2021-12-23 14:28:59 +01:00
parent ec773f2ac2
commit 5e1618b4de
7 changed files with 57 additions and 46 deletions

View File

@ -40,11 +40,13 @@ void ck_init() {
void ck_drawpiece(sprite *pl) {
tile_offset *data = get_piece_offsets(pl->piece, pl->angle);
for(byte t=0; t<4; t++) {
// int x = pl->x; byte x1 = data->offset_x; x+= (int) x1;
// int y = pl->y; byte y1 = data->offset_y; y+= (int) y1;
int x = pl->x + (int) data->offset_x;
int y = pl->y + (int) data->offset_y;
#ifdef KICKC_NIGHTLY
int x = pl->x + (int) data->offset_x;
int y = pl->y + (int) data->offset_y;
#else
int x = pl->x; byte x1 = data->offset_x; x+= (int) x1;
int y = pl->y; byte y1 = data->offset_y; y+= (int) y1;
#endif
WRITE_BOARD(y,x,pl->piece);
data++;
@ -55,12 +57,12 @@ void ck_drawpiece(sprite *pl) {
void ck_erasepiece(sprite *pl) {
tile_offset *data = get_piece_offsets(pl->piece, pl->angle);
for(byte t=0; t<4; t++) {
#ifdef BUG736
int x = pl->x; byte x1 = data->offset_x; x+= (int) x1;
int y = pl->y; byte y1 = data->offset_y; y+= (int) y1;
#else
#ifdef KICKC_NIGHTLY
int x = pl->x + (int) data->offset_x;
int y = pl->y + (int) data->offset_y;
#else
int x = pl->x; byte x1 = data->offset_x; x+= (int) x1;
int y = pl->y; byte y1 = data->offset_y; y+= (int) y1;
#endif
WRITE_BOARD(y,x,EMPTY);
@ -72,12 +74,12 @@ void ck_erasepiece(sprite *pl) {
void ck_markpiece(sprite *pl) {
tile_offset *data = get_piece_offsets(pl->piece, pl->angle);
for(byte t=0; t<4; t++) {
#ifdef BUG736
int x = pl->x; byte x1 = data->offset_x; x+= (int) x1;
int y = pl->y; byte y1 = data->offset_y; y+= (int) y1;
#else
#ifdef KICKC_NIGHTLY
int x = pl->x + (int) data->offset_x;
int y = pl->y + (int) data->offset_y;
#else
int x = pl->x; byte x1 = data->offset_x; x+= (int) x1;
int y = pl->y; byte y1 = data->offset_y; y+= (int) y1;
#endif
WRITE_BOARD(y,x,MARKED);
@ -89,12 +91,12 @@ void ck_markpiece(sprite *pl) {
int collides(sprite *pl) {
tile_offset *data = get_piece_offsets(pl->piece, pl->angle);
for(byte t=0; t<4; t++) {
#ifdef BUG736
int x = pl->x; byte x1 = data->offset_x; x+= (int) x1;
int y = pl->y; byte y1 = data->offset_y; y+= (int) y1;
#else
#ifdef KICKC_NIGHTLY
int x = pl->x + (int) data->offset_x;
int y = pl->y + (int) data->offset_y;
#else
int x = pl->x; byte x1 = data->offset_x; x+= (int) x1;
int y = pl->y; byte y1 = data->offset_y; y+= (int) y1;
#endif
if(x<0) return 1; // does it collide with left border?
if(x>=BCOLS) return 1; // does it collide with right border?

View File

@ -188,8 +188,13 @@ void gr_erasepiece(sprite *p) {
}
for(byte t=0; t<4; t++) {
int x = px + (int) data->offset_x;
int y = py + (int) data->offset_y;
#ifdef KICKC_NIGHTLY
int x = px + (int) data->offset_x;
int y = py + (int) data->offset_y;
#else
int x = px; byte x1 = data->offset_x; x+= (int) x1;
int y = py; byte y1 = data->offset_y; y+= (int) y1;
#endif
data++;
draw_tile((byte)x,(byte)y,EMPTY_GR_CHAR,EMPTY_GR_COLOR);
}
@ -208,18 +213,18 @@ void gr_erasepiece_unmarked(sprite *p) {
py += STARTBOARD_Y;
for(byte t=0; t<4; t++) {
#ifdef BUG736
int x = px; byte x1 = data->offset_x; x+= (int) x1;
int y = py; byte y1 = data->offset_y; y+= (int) y1;
int cx = p->x; cx += (int) x1;
int cy = p->y; cy += (int) y1;
#else
#ifdef KICKC_NIGHTLY
int x = px + (int) data->offset_x;
int y = py + (int) data->offset_y;
int cx = p->x + (int) data->offset_x;
int cy = p->y + (int) data->offset_y;
#else
int x = px; byte x1 = data->offset_x; x+= (int) x1;
int y = py; byte y1 = data->offset_y; y+= (int) y1;
int cx = p->x; cx += (int) x1;
int cy = p->y; cy += (int) y1;
#endif
data++;
@ -248,12 +253,12 @@ void gr_drawpiece(sprite *p) {
byte piece = p->piece;
for(byte t=0; t<4; t++) {
#ifdef BUG736
int x = px + (int) data->offset_x;
int y = py + (int) data->offset_y;
else
#ifdef KICKC_NIGHTLY
int x = px + (int) data->offset_x;
int y = py + (int) data->offset_y;
#else
int x = px; byte x1 = data->offset_x; x+= (int) x1;
int y = py; byte y1 = data->offset_y; y+= (int) y1;
#endif
data++;

View File

@ -10,9 +10,6 @@
// previous implementations for the Laser 310 and Laser 500
//
// KickC bug waiting to be fixed
#define BUG736 1
// standard libraries
#include <string.h> // memset, memcopy (memcopy no longer necessary)
#include <stdlib.h> // for sprintf, rand

View File

@ -119,7 +119,7 @@ byte apple1_readkey() {
inline void apple1_eprom_init() {
// copy the initializaton data from ROM to lowram where "Data" segment is allocated
memcpy(LOWRAM_START, DATAINCODE, LOWRAM_SIZE);
memcpy((byte *)LOWRAM_START, (byte *)DATAINCODE, LOWRAM_SIZE);
}
#endif

View File

@ -11,18 +11,18 @@ inline void acknowledge_interrupt() {
asm { lda VDP_REG };
}
export __address(0) byte IRQ_JUMP_OPCODE; // location 0 contains the opcode for "JMP"
export __address(1) word IRQ_JUMP_ADDRESS; // location 1 and 2 contain the jump address
EXPORT __address(0) byte IRQ_JUMP_OPCODE; // location 0 contains the opcode for "JMP"
EXPORT __address(1) word IRQ_JUMP_ADDRESS; // location 1 and 2 contain the jump address
// storage for a simple watch timer
export volatile byte _ticks;
export volatile byte _seconds;
export volatile byte _minutes;
export volatile byte _hours;
export volatile byte _irq_trigger;
EXPORT volatile byte _ticks;
EXPORT volatile byte _seconds;
EXPORT volatile byte _minutes;
EXPORT volatile byte _hours;
EXPORT volatile byte _irq_trigger;
// interrupt routine called every 1/60th by the CPU after TMS9918 sets the /INT pin
export __interrupt(hardware_all) void interrupt_handler() {
EXPORT __interrupt(hardware_all) void interrupt_handler() {
// update the watch
if(++_ticks == 60) {
_ticks = 0;

View File

@ -17,11 +17,11 @@
#include "utils.h"
#ifdef APPLE1
const byte *VDP_DATA = 0xCC00; // TMS9918 data port (VRAM)
const byte *VDP_REG = 0xCC01; // TMS9918 register port (write) or status (read)
const byte *VDP_DATA = (byte *) 0xCC00; // TMS9918 data port (VRAM)
const byte *VDP_REG = (byte *) 0xCC01; // TMS9918 register port (write) or status (read)
#else
const byte *VDP_DATA = 0xA000; // TMS9918 data port (VRAM)
const byte *VDP_REG = 0xA001; // TMS9918 register port (write) or status (read)
const byte *VDP_DATA = (byte *) 0xA000; // TMS9918 data port (VRAM)
const byte *VDP_REG = (byte *) 0xA001; // TMS9918 register port (write) or status (read)
#endif
// control port bits

View File

@ -4,8 +4,15 @@
#define POKE(a,b) (*((byte *)(a))=(byte)(b))
#define PEEK(a) (*((byte *)(a)))
#ifdef KICKC_NIGHTLY
#define HIBYTE(c) (BYTE1(c))
#define LOBYTE(c) (BYTE0(c))
#define EXPORT __export
#else
#define HIBYTE(c) (>(c))
#define LOBYTE(c) (<(c))
#define EXPORT export
#endif
#define NOP asm { nop }