mirror of
https://github.com/nippur72/apple1-videocard-lib.git
synced 2024-06-06 00:29:30 +00:00
prepare for KickC upgrade
This commit is contained in:
parent
ec773f2ac2
commit
5e1618b4de
|
@ -40,11 +40,13 @@ void ck_init() {
|
||||||
void ck_drawpiece(sprite *pl) {
|
void ck_drawpiece(sprite *pl) {
|
||||||
tile_offset *data = get_piece_offsets(pl->piece, pl->angle);
|
tile_offset *data = get_piece_offsets(pl->piece, pl->angle);
|
||||||
for(byte t=0; t<4; t++) {
|
for(byte t=0; t<4; t++) {
|
||||||
// int x = pl->x; byte x1 = data->offset_x; x+= (int) x1;
|
#ifdef KICKC_NIGHTLY
|
||||||
// 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;
|
||||||
int x = pl->x + (int) data->offset_x;
|
#else
|
||||||
int y = pl->y + (int) data->offset_y;
|
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);
|
WRITE_BOARD(y,x,pl->piece);
|
||||||
data++;
|
data++;
|
||||||
|
@ -55,12 +57,12 @@ void ck_drawpiece(sprite *pl) {
|
||||||
void ck_erasepiece(sprite *pl) {
|
void ck_erasepiece(sprite *pl) {
|
||||||
tile_offset *data = get_piece_offsets(pl->piece, pl->angle);
|
tile_offset *data = get_piece_offsets(pl->piece, pl->angle);
|
||||||
for(byte t=0; t<4; t++) {
|
for(byte t=0; t<4; t++) {
|
||||||
#ifdef BUG736
|
#ifdef KICKC_NIGHTLY
|
||||||
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
|
|
||||||
int x = pl->x + (int) data->offset_x;
|
int x = pl->x + (int) data->offset_x;
|
||||||
int y = pl->y + (int) data->offset_y;
|
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
|
#endif
|
||||||
|
|
||||||
WRITE_BOARD(y,x,EMPTY);
|
WRITE_BOARD(y,x,EMPTY);
|
||||||
|
@ -72,12 +74,12 @@ void ck_erasepiece(sprite *pl) {
|
||||||
void ck_markpiece(sprite *pl) {
|
void ck_markpiece(sprite *pl) {
|
||||||
tile_offset *data = get_piece_offsets(pl->piece, pl->angle);
|
tile_offset *data = get_piece_offsets(pl->piece, pl->angle);
|
||||||
for(byte t=0; t<4; t++) {
|
for(byte t=0; t<4; t++) {
|
||||||
#ifdef BUG736
|
#ifdef KICKC_NIGHTLY
|
||||||
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
|
|
||||||
int x = pl->x + (int) data->offset_x;
|
int x = pl->x + (int) data->offset_x;
|
||||||
int y = pl->y + (int) data->offset_y;
|
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
|
#endif
|
||||||
|
|
||||||
WRITE_BOARD(y,x,MARKED);
|
WRITE_BOARD(y,x,MARKED);
|
||||||
|
@ -89,12 +91,12 @@ void ck_markpiece(sprite *pl) {
|
||||||
int collides(sprite *pl) {
|
int collides(sprite *pl) {
|
||||||
tile_offset *data = get_piece_offsets(pl->piece, pl->angle);
|
tile_offset *data = get_piece_offsets(pl->piece, pl->angle);
|
||||||
for(byte t=0; t<4; t++) {
|
for(byte t=0; t<4; t++) {
|
||||||
#ifdef BUG736
|
#ifdef KICKC_NIGHTLY
|
||||||
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
|
|
||||||
int x = pl->x + (int) data->offset_x;
|
int x = pl->x + (int) data->offset_x;
|
||||||
int y = pl->y + (int) data->offset_y;
|
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
|
#endif
|
||||||
if(x<0) return 1; // does it collide with left border?
|
if(x<0) return 1; // does it collide with left border?
|
||||||
if(x>=BCOLS) return 1; // does it collide with right border?
|
if(x>=BCOLS) return 1; // does it collide with right border?
|
||||||
|
|
|
@ -188,8 +188,13 @@ void gr_erasepiece(sprite *p) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for(byte t=0; t<4; t++) {
|
for(byte t=0; t<4; t++) {
|
||||||
int x = px + (int) data->offset_x;
|
#ifdef KICKC_NIGHTLY
|
||||||
int y = py + (int) data->offset_y;
|
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++;
|
data++;
|
||||||
draw_tile((byte)x,(byte)y,EMPTY_GR_CHAR,EMPTY_GR_COLOR);
|
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;
|
py += STARTBOARD_Y;
|
||||||
|
|
||||||
for(byte t=0; t<4; t++) {
|
for(byte t=0; t<4; t++) {
|
||||||
#ifdef BUG736
|
#ifdef KICKC_NIGHTLY
|
||||||
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
|
|
||||||
int x = px + (int) data->offset_x;
|
int x = px + (int) data->offset_x;
|
||||||
int y = py + (int) data->offset_y;
|
int y = py + (int) data->offset_y;
|
||||||
|
|
||||||
int cx = p->x + (int) data->offset_x;
|
int cx = p->x + (int) data->offset_x;
|
||||||
int cy = p->y + (int) data->offset_y;
|
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
|
#endif
|
||||||
|
|
||||||
data++;
|
data++;
|
||||||
|
@ -248,12 +253,12 @@ void gr_drawpiece(sprite *p) {
|
||||||
|
|
||||||
byte piece = p->piece;
|
byte piece = p->piece;
|
||||||
for(byte t=0; t<4; t++) {
|
for(byte t=0; t<4; t++) {
|
||||||
#ifdef BUG736
|
#ifdef KICKC_NIGHTLY
|
||||||
int x = px + (int) data->offset_x;
|
|
||||||
int y = py + (int) data->offset_y;
|
|
||||||
else
|
|
||||||
int x = px + (int) data->offset_x;
|
int x = px + (int) data->offset_x;
|
||||||
int y = py + (int) data->offset_y;
|
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
|
#endif
|
||||||
data++;
|
data++;
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,6 @@
|
||||||
// previous implementations for the Laser 310 and Laser 500
|
// previous implementations for the Laser 310 and Laser 500
|
||||||
//
|
//
|
||||||
|
|
||||||
// KickC bug waiting to be fixed
|
|
||||||
#define BUG736 1
|
|
||||||
|
|
||||||
// standard libraries
|
// standard libraries
|
||||||
#include <string.h> // memset, memcopy (memcopy no longer necessary)
|
#include <string.h> // memset, memcopy (memcopy no longer necessary)
|
||||||
#include <stdlib.h> // for sprintf, rand
|
#include <stdlib.h> // for sprintf, rand
|
||||||
|
|
|
@ -119,7 +119,7 @@ byte apple1_readkey() {
|
||||||
|
|
||||||
inline void apple1_eprom_init() {
|
inline void apple1_eprom_init() {
|
||||||
// copy the initializaton data from ROM to lowram where "Data" segment is allocated
|
// 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
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -11,18 +11,18 @@ inline void acknowledge_interrupt() {
|
||||||
asm { lda VDP_REG };
|
asm { lda VDP_REG };
|
||||||
}
|
}
|
||||||
|
|
||||||
export __address(0) byte IRQ_JUMP_OPCODE; // location 0 contains the opcode for "JMP"
|
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(1) word IRQ_JUMP_ADDRESS; // location 1 and 2 contain the jump address
|
||||||
|
|
||||||
// storage for a simple watch timer
|
// storage for a simple watch timer
|
||||||
export volatile byte _ticks;
|
EXPORT volatile byte _ticks;
|
||||||
export volatile byte _seconds;
|
EXPORT volatile byte _seconds;
|
||||||
export volatile byte _minutes;
|
EXPORT volatile byte _minutes;
|
||||||
export volatile byte _hours;
|
EXPORT volatile byte _hours;
|
||||||
export volatile byte _irq_trigger;
|
EXPORT volatile byte _irq_trigger;
|
||||||
|
|
||||||
// interrupt routine called every 1/60th by the CPU after TMS9918 sets the /INT pin
|
// 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
|
// update the watch
|
||||||
if(++_ticks == 60) {
|
if(++_ticks == 60) {
|
||||||
_ticks = 0;
|
_ticks = 0;
|
||||||
|
|
|
@ -17,11 +17,11 @@
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
#ifdef APPLE1
|
#ifdef APPLE1
|
||||||
const byte *VDP_DATA = 0xCC00; // TMS9918 data port (VRAM)
|
const byte *VDP_DATA = (byte *) 0xCC00; // TMS9918 data port (VRAM)
|
||||||
const byte *VDP_REG = 0xCC01; // TMS9918 register port (write) or status (read)
|
const byte *VDP_REG = (byte *) 0xCC01; // TMS9918 register port (write) or status (read)
|
||||||
#else
|
#else
|
||||||
const byte *VDP_DATA = 0xA000; // TMS9918 data port (VRAM)
|
const byte *VDP_DATA = (byte *) 0xA000; // TMS9918 data port (VRAM)
|
||||||
const byte *VDP_REG = 0xA001; // TMS9918 register port (write) or status (read)
|
const byte *VDP_REG = (byte *) 0xA001; // TMS9918 register port (write) or status (read)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// control port bits
|
// control port bits
|
||||||
|
|
|
@ -4,8 +4,15 @@
|
||||||
#define POKE(a,b) (*((byte *)(a))=(byte)(b))
|
#define POKE(a,b) (*((byte *)(a))=(byte)(b))
|
||||||
#define PEEK(a) (*((byte *)(a)))
|
#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 HIBYTE(c) (>(c))
|
||||||
#define LOBYTE(c) (<(c))
|
#define LOBYTE(c) (<(c))
|
||||||
|
#define EXPORT export
|
||||||
|
#endif
|
||||||
|
|
||||||
#define NOP asm { nop }
|
#define NOP asm { nop }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user