Bump the beta version number. Change the colour of the score bar on the right side of the screen. Add a new machine API and put the machine specific aspects of VBL in there. Slow down the CPU on the GS on launch and restore the speed on quit. Fix a problem where the "next level" text wasn't displayed correctly on the GS for some unknown reason.

This commit is contained in:
Jeremy Rand 2016-08-23 20:23:26 -04:00
parent ac41acedfc
commit 4ecae7ea50
6 changed files with 156 additions and 37 deletions

View File

@ -9,6 +9,8 @@
/* Begin PBXFileReference section */
9D3A9FB81D455CCF004C5897 /* joystick.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = joystick.h; sourceTree = "<group>"; };
9D3A9FB91D455CD8004C5897 /* joystick.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = joystick.c; sourceTree = "<group>"; };
9D4D1AA31D6D0E9B00D20BB8 /* machine.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = machine.c; sourceTree = "<group>"; };
9D4D1AA41D6D0E9B00D20BB8 /* machine.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = machine.h; sourceTree = "<group>"; };
9D509F911D654F9900161DDC /* mouseWrapper.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mouseWrapper.c; sourceTree = "<group>"; };
9D509F921D654F9900161DDC /* mouseWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = mouseWrapper.h; sourceTree = "<group>"; };
9D509F941D66AE2800161DDC /* a2e.stdmou.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = a2e.stdmou.s; sourceTree = "<group>"; };
@ -79,6 +81,8 @@
9D6B473F1D3FB5C800F6D704 /* dbllores.h */,
9D6B47451D426E6300F6D704 /* vbl.s */,
9D6B47471D42709200F6D704 /* vbl.h */,
9D4D1AA31D6D0E9B00D20BB8 /* machine.c */,
9D4D1AA41D6D0E9B00D20BB8 /* machine.h */,
9D6B47481D4270EC00F6D704 /* anim.c */,
9D6B47491D4270EC00F6D704 /* anim.h */,
9D6B472F1D3FB16F00F6D704 /* Makefile */,

View File

@ -7,7 +7,6 @@
//
#include <apple2.h>
#include <conio.h>
#include <stdbool.h>
#include <stdint.h>
@ -17,7 +16,7 @@
#include "anim.h"
#include "dbllores.h"
#include "game.h"
#include "vbl.h"
#include "machine.h"
#include "ui.h"
@ -72,13 +71,8 @@ typedef struct tDropGemAnimState {
typedef void __fastcall__ (*tClearGemHandler)(tSquare square);
typedef void (*tVblWaitFunction)(void);
// Globals
static tVblWaitFunction gVblWait = vblWait;
static tStarAnimState gStarAnimState;
static tClearGemAnimState gClearGemAnimState;
static tDropGemAnimState gDropGemAnimState;
@ -118,25 +112,6 @@ static tClearGemHandler gClearGemHandler[] = {
// Implementation
void animInit(void)
{
switch (get_ostype()) {
case APPLE_IIC:
case APPLE_IIC35:
case APPLE_IICEXP:
case APPLE_IICREV:
case APPLE_IICPLUS:
gVblWait = vblWait2c;
break;
case APPLE_IIGS:
case APPLE_IIGS1:
case APPLE_IIGS3:
vblInit2gs();
break;
}
}
void drawGemAtSquare(tSquare square)
{

View File

@ -648,7 +648,7 @@ square: .BYTE $0
; A is a number from 0 to 24
tay
ldx #24
lda #$22
lda #$dd
sta color
sta LOWSCR
@L1:
@ -656,7 +656,7 @@ square: .BYTE $0
bmi @L2
cpy #0
bne @L3
lda #$aa
lda #$22
sta color
@L3:
dey

103
a2bejwld/machine.c Normal file
View File

@ -0,0 +1,103 @@
//
// machine.c
// a2bejwld
//
// Created by Jeremy Rand on 2016-08-23.
// Copyright © 2016 Jeremy Rand. All rights reserved.
//
#include <apple2.h>
#include <stdbool.h>
#include <stdint.h>
#include "machine.h"
#include "vbl.h"
// Typedefs
typedef enum {
GS_SPEED_SLOW,
GS_SPEED_FAST
} tMachineGSSpeed;
// Globals
tVblWaitFunction gVblWait = vblWait;
static tMachineGSSpeed gOldSpeed = GS_SPEED_SLOW;
// Implementation
static bool machineIs2c(void)
{
switch (get_ostype()) {
case APPLE_IIC:
case APPLE_IIC35:
case APPLE_IICEXP:
case APPLE_IICREV:
case APPLE_IICPLUS:
return true;
}
return false;
}
static bool machineIs2GS(void)
{
switch (get_ostype()) {
case APPLE_IIGS:
case APPLE_IIGS1:
case APPLE_IIGS3:
return true;
}
return false;
}
static tMachineGSSpeed setGSSpeed(tMachineGSSpeed newSpeed)
{
uint8_t *speedRegister = (uint8_t *)0xc036;
uint8_t value = *speedRegister;
tMachineGSSpeed oldSpeed;
if ((value & 0x80) != 0)
oldSpeed = GS_SPEED_FAST;
else
oldSpeed = GS_SPEED_SLOW;
if (oldSpeed != newSpeed) {
if (newSpeed == GS_SPEED_FAST) {
value |= 0x80;
} else {
value &= 0x7f;
}
*speedRegister = value;
}
return oldSpeed;
}
void initMachine(void)
{
if (machineIs2c()) {
gVblWait = vblWait2c;
} else if (machineIs2GS()) {
vblInit2gs();
gOldSpeed = setGSSpeed(GS_SPEED_SLOW);
}
}
void uninitMachine(void)
{
if (machineIs2GS()) {
setGSSpeed(gOldSpeed);
}
}

30
a2bejwld/machine.h Normal file
View File

@ -0,0 +1,30 @@
//
// machine.h
// a2bejwld
//
// Created by Jeremy Rand on 2016-08-23.
// Copyright © 2016 Jeremy Rand. All rights reserved.
//
#ifndef __a2bejwld__machine__
#define __a2bejwld__machine__
// Typedefs
typedef void (*tVblWaitFunction)(void);
// Globals
extern tVblWaitFunction gVblWait;
// API
extern void initMachine(void);
extern void uninitMachine(void);
#endif /* defined(__a2bejwld__machine__) */

View File

@ -17,13 +17,14 @@
#include "dbllores.h"
#include "game.h"
#include "joystick.h"
#include "machine.h"
#include "mouseWrapper.h"
// Defines
#define SAVE_OPTIONS_FILE "a2bejwld.opts"
#define VERSION "v1.2b1"
#define VERSION "v1.2b2"
// Typedefs
@ -330,6 +331,9 @@ static void quitGame(void)
videomode(VIDEOMODE_40x24);
clrscr();
shutdownMouse();
uninitMachine();
exit(0);
}
@ -479,10 +483,11 @@ static void endGame(void)
{
mixedTextMode();
videomode(VIDEOMODE_80x24);
cputsxy(0, 20, " No more moves - GAME OVER!!");
gotoxy(0,21);
cprintf( " You made it to level %u", getLevel());
cputsxy(0,23, " Play again (Y/N)?");
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
printf(" No more moves - GAME OVER!!\n");
printf(" You made it to level %u\n\n", getLevel());
printf(" Play again (Y/N)?");
while (true) {
switch (cgetc()) {
@ -522,9 +527,10 @@ static void refreshLevel(tLevel level)
mixedTextMode();
videomode(VIDEOMODE_80x24);
gotoxy(0, 20);
cprintf( " Completed level %u!!", level);
cputsxy(0,22, " Press space to continue to the next level...");
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
printf(" Completed level %u!!\n", level);
printf(" Press space to continue to the next level...");
while (waiting) {
switch (cgetc()) {
@ -555,10 +561,11 @@ void initUI(void)
{
bool optionsLoaded;
initMachine();
optionsLoaded = loadOptions();
initGameEngine(&gCallbacks);
animInit();
if ((!optionsLoaded) ||
(gGameOptions.enableMouse)) {