mirror of
https://github.com/jeremysrand/BuGS.git
synced 2025-01-22 19:32:03 +00:00
Add some infrastructure to block the player from passing through mushrooms. The next step will be to code that algorithm. Also, added a build improvement to better handle assembly errors and pass them in to Xcode.
This commit is contained in:
parent
ae8dde2d87
commit
94c7e3f9e4
@ -200,39 +200,21 @@ updatePlayer_noMousePoll anop
|
|||||||
jmp updatePlayer_skipDeltas
|
jmp updatePlayer_skipDeltas
|
||||||
|
|
||||||
updatePlayer_handleDeltas anop
|
updatePlayer_handleDeltas anop
|
||||||
; The X register has the deltaX
|
; The X and Y register also has a bit in each which indicates whether a
|
||||||
|
; mouse button is down or not.
|
||||||
txa
|
txa
|
||||||
bit #$40
|
and #$0080
|
||||||
bne updatePlayer_negX
|
beq updatePlayer_mouseDown
|
||||||
and #$3f
|
tya
|
||||||
inc a
|
and #$0080
|
||||||
lsr a
|
beq updatePlayer_mouseDown
|
||||||
cmp #9
|
lda #1
|
||||||
blt updatePlayer_posXNoClamp
|
sta mouseDown
|
||||||
lda #8
|
bra updatePlayer_doY
|
||||||
updatePlayer_posXNoClamp anop
|
updatePlayer_mouseDown anop
|
||||||
clc
|
stz mouseDown
|
||||||
adc mouseX
|
|
||||||
cmp #MOUSE_MAX_X
|
|
||||||
blt updatePlayer_doneX
|
|
||||||
lda #MOUSE_MAX_X-1
|
|
||||||
bra updatePlayer_doneX
|
|
||||||
updatePlayer_negX anop
|
|
||||||
ora #$ffc0
|
|
||||||
dec a
|
|
||||||
lsr a
|
|
||||||
ora #$8000
|
|
||||||
cmp #$fff8
|
|
||||||
bge updatePlayer_negXNoClamp
|
|
||||||
lda #$fff8
|
|
||||||
updatePlayer_negXNoClamp anop
|
|
||||||
clc
|
|
||||||
adc mouseX
|
|
||||||
bpl updatePlayer_doneX
|
|
||||||
lda #0
|
|
||||||
updatePlayer_doneX anop
|
|
||||||
sta mouseX
|
|
||||||
|
|
||||||
|
updatePlayer_doY anop
|
||||||
; The Y register has the deltaY
|
; The Y register has the deltaY
|
||||||
tya
|
tya
|
||||||
bit #$40
|
bit #$40
|
||||||
@ -240,6 +222,7 @@ updatePlayer_doneX anop
|
|||||||
and #$3f
|
and #$3f
|
||||||
inc a
|
inc a
|
||||||
lsr a
|
lsr a
|
||||||
|
beq updatePlayer_doX
|
||||||
cmp #9
|
cmp #9
|
||||||
blt updatePlayer_posYNoClamp
|
blt updatePlayer_posYNoClamp
|
||||||
lda #8
|
lda #8
|
||||||
@ -266,20 +249,40 @@ updatePlayer_negYNoClamp anop
|
|||||||
updatePlayer_doneY anop
|
updatePlayer_doneY anop
|
||||||
sta mouseY
|
sta mouseY
|
||||||
|
|
||||||
; The X and Y register also has a bit in each which indicates whether a
|
updatePlayer_doX anop
|
||||||
; mouse button is down or not.
|
; The X register has the deltaX
|
||||||
|
|
||||||
txa
|
txa
|
||||||
and #$0080
|
bit #$40
|
||||||
beq updatePlayer_mouseDown
|
bne updatePlayer_negX
|
||||||
tya
|
and #$3f
|
||||||
and #$0080
|
inc a
|
||||||
beq updatePlayer_mouseDown
|
lsr a
|
||||||
lda #1
|
beq updatePlayer_skipDeltas
|
||||||
sta mouseDown
|
cmp #9
|
||||||
bra updatePlayer_skipDeltas
|
blt updatePlayer_posXNoClamp
|
||||||
updatePlayer_mouseDown anop
|
lda #8
|
||||||
stz mouseDown
|
updatePlayer_posXNoClamp anop
|
||||||
|
clc
|
||||||
|
adc mouseX
|
||||||
|
cmp #MOUSE_MAX_X
|
||||||
|
blt updatePlayer_doneX
|
||||||
|
lda #MOUSE_MAX_X-1
|
||||||
|
bra updatePlayer_doneX
|
||||||
|
updatePlayer_negX anop
|
||||||
|
ora #$ffc0
|
||||||
|
dec a
|
||||||
|
lsr a
|
||||||
|
ora #$8000
|
||||||
|
cmp #$fff8
|
||||||
|
bge updatePlayer_negXNoClamp
|
||||||
|
lda #$fff8
|
||||||
|
updatePlayer_negXNoClamp anop
|
||||||
|
clc
|
||||||
|
adc mouseX
|
||||||
|
bpl updatePlayer_doneX
|
||||||
|
lda #0
|
||||||
|
updatePlayer_doneX anop
|
||||||
|
sta mouseX
|
||||||
|
|
||||||
updatePlayer_skipDeltas anop
|
updatePlayer_skipDeltas anop
|
||||||
lda mouseDown
|
lda mouseDown
|
||||||
|
@ -27,11 +27,15 @@ sed -i "" "s:^s7d1 *=.*$:s7d1 = $DISKIMAGE:" config.txt
|
|||||||
|
|
||||||
# This magic ensure that clicking stop in Xcode results in the emulator terminating.
|
# This magic ensure that clicking stop in Xcode results in the emulator terminating.
|
||||||
|
|
||||||
|
if true
|
||||||
|
then
|
||||||
$EMULATORPATH -fullscreen -mem 1572864 &
|
$EMULATORPATH -fullscreen -mem 1572864 &
|
||||||
PID=$!
|
PID=$!
|
||||||
#cd "/Users/jrand/Library/Application Support/Ample"
|
else
|
||||||
#/Applications/Ample.app/Contents/MacOS/mame64 apple2gs -skip_gameinfo -mouse -window -resolution 1408x1056 -ramsize 4M -sl7 cffa202 -hard1 "$DISKIMAGE" &
|
cd "/Users/jrand/Library/Application Support/Ample"
|
||||||
#PID=$!
|
/Applications/Ample.app/Contents/MacOS/mame64 apple2gs -skip_gameinfo -mouse -window -resolution 1408x1056 -ramsize 4M -sl7 cffa202 -hard1 "$DISKIMAGE" &
|
||||||
|
PID=$!
|
||||||
|
fi
|
||||||
|
|
||||||
trap 'kill $PID' SIGTERM SIGINT SIGHUP EXIT
|
trap 'kill $PID' SIGTERM SIGINT SIGHUP EXIT
|
||||||
wait
|
wait
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
TMPFILE=/tmp/orca-macgen.$$
|
TMPFILE=/tmp/orca-macgen.$$
|
||||||
|
ERROUTPUT=/tmp/orca-asm-errs.$$
|
||||||
|
|
||||||
FILENAME="$1"
|
FILENAME="$1"
|
||||||
shift
|
shift
|
||||||
@ -54,15 +55,39 @@ DIRNAME=`dirname $FILENAME`
|
|||||||
BASENAME=`basename $FILENAME .s`
|
BASENAME=`basename $FILENAME .s`
|
||||||
|
|
||||||
pushd "$DIRNAME" > /dev/null
|
pushd "$DIRNAME" > /dev/null
|
||||||
$ORCA assemble $* keep="${BASENAME}" "${BASENAME}.s"
|
$ORCA assemble $* keep="${BASENAME}" "${BASENAME}.s" 2> $ERROUTPUT
|
||||||
RESULT=$?
|
RESULT=$?
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
|
|
||||||
|
if [ -s $ERROUTPUT ]
|
||||||
|
then
|
||||||
|
RESULT=1
|
||||||
|
awk '
|
||||||
|
{
|
||||||
|
print $0
|
||||||
|
}
|
||||||
|
|
||||||
|
/^Error /{
|
||||||
|
$1=""
|
||||||
|
$2=""
|
||||||
|
LINENO=$3
|
||||||
|
$3=""
|
||||||
|
printf("%s/%s:%d:0: error: %s\n", PWD, FILE, LINENO, $0)
|
||||||
|
}
|
||||||
|
' "PWD=`pwd`" "FILE=${BASENAME}.s" $ERROUTPUT
|
||||||
|
fi
|
||||||
|
rm -f $ERROUTPUT
|
||||||
|
|
||||||
if [ "$RESULT" -ne 0 ]
|
if [ "$RESULT" -ne 0 ]
|
||||||
then
|
then
|
||||||
rm -f "$SRCROOTNAME"
|
rm -f "$SRCROOTNAME"
|
||||||
rm -f "$SRCMACROSNAME"
|
rm -f "$SRCMACROSNAME"
|
||||||
rm -f "$SRCOBJNAME"
|
rm -f "$SRCOBJNAME"
|
||||||
|
rm -f "$DESTROOTNAME"
|
||||||
|
rm -f "$DESTMACROSNAME"
|
||||||
|
rm -f "$DESTOBJNAME"
|
||||||
|
rm -f "$DESTDEPSNAME"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p `dirname "$DESTROOTNAME"`
|
mkdir -p `dirname "$DESTROOTNAME"`
|
||||||
|
@ -95,6 +95,10 @@ our @gDirtyNonGameTiles = ("INVALID_TILE_NUM") x $gEquates{"NUM_NON_GAME_TILES"}
|
|||||||
our $gNumDirtyNonGameTiles = 0;
|
our $gNumDirtyNonGameTiles = 0;
|
||||||
|
|
||||||
our @gMouseYAddress = (0) x $gEquates{"MOUSE_MAX_Y"};
|
our @gMouseYAddress = (0) x $gEquates{"MOUSE_MAX_Y"};
|
||||||
|
our @gMouseYTileAbove = (0) x $gEquates{"MOUSE_MAX_Y"};
|
||||||
|
our @gMouseYTileBelow = (0) x $gEquates{"MOUSE_MAX_Y"};
|
||||||
|
our @gMouseXTileLeft = (0) x $gEquates{"MOUSE_MAX_X"};
|
||||||
|
our @gMouseXTileRight = (0) x $gEquates{"MOUSE_MAX_X"};
|
||||||
our @gScreenToTileOffset = (0) x ($gEquates{"SCREEN_PIXELS_TALL"} * $gEquates{"SCREEN_BYTES_PER_ROW"} / $gEquates{"SIZEOF_TILE_INFO"});
|
our @gScreenToTileOffset = (0) x ($gEquates{"SCREEN_PIXELS_TALL"} * $gEquates{"SCREEN_BYTES_PER_ROW"} / $gEquates{"SIZEOF_TILE_INFO"});
|
||||||
|
|
||||||
|
|
||||||
@ -360,10 +364,47 @@ sub initTiles
|
|||||||
|
|
||||||
# Calculate the memory address of the 0th row of the player's mouse position.
|
# Calculate the memory address of the 0th row of the player's mouse position.
|
||||||
$lastOffset = $gEquates{"SCREEN_ADDRESS"} + ($gEquates{"LHS_NUM_TILES_WIDE"} * $gEquates{"TILE_BYTE_WIDTH"}) + (($gEquates{"GAME_NUM_TILES_TALL"} - $gEquates{"PLAYER_TILES_HIGH"}) * $gEquates{"TILE_PIXEL_HEIGHT"} * $gEquates{"SCREEN_BYTES_PER_ROW"});
|
$lastOffset = $gEquates{"SCREEN_ADDRESS"} + ($gEquates{"LHS_NUM_TILES_WIDE"} * $gEquates{"TILE_BYTE_WIDTH"}) + (($gEquates{"GAME_NUM_TILES_TALL"} - $gEquates{"PLAYER_TILES_HIGH"}) * $gEquates{"TILE_PIXEL_HEIGHT"} * $gEquates{"SCREEN_BYTES_PER_ROW"});
|
||||||
|
$tileX = 0;
|
||||||
|
$tileY = $gEquates{"GAME_NUM_TILES_TALL"} - $gEquates{"PLAYER_TILES_HIGH"} - 1;
|
||||||
for (my $y = 0; $y < $gEquates{"MOUSE_MAX_Y"}; $y++)
|
for (my $y = 0; $y < $gEquates{"MOUSE_MAX_Y"}; $y++)
|
||||||
{
|
{
|
||||||
$gMouseYAddress[$y] = $lastOffset;
|
$gMouseYAddress[$y] = $lastOffset;
|
||||||
$lastOffset += $gEquates{"SCREEN_BYTES_PER_ROW"};
|
$lastOffset += $gEquates{"SCREEN_BYTES_PER_ROW"};
|
||||||
|
|
||||||
|
if (($y % $gEquates{"TILE_PIXEL_HEIGHT"}) == 0)
|
||||||
|
{
|
||||||
|
$tileY++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$gMouseYTileAbove[$y] = gameXYToTileOffset($tileX, $tileY);
|
||||||
|
if (($y % $gEquates{"TILE_PIXEL_HEIGHT"}) == 0)
|
||||||
|
{
|
||||||
|
$gMouseYTileBelow[$y] = gameXYToTileOffset($tileX, $tileY);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$gMouseYTileBelow[$y] = gameXYToTileOffset($tileX, $tileY + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$tileX = -1;
|
||||||
|
$tileY = 0;
|
||||||
|
for (my $x = 0; $x < $gEquates{"MOUSE_MAX_X"}; $x++)
|
||||||
|
{
|
||||||
|
if (($x % $gEquates{"TILE_PIXEL_WIDTH"}) == 0)
|
||||||
|
{
|
||||||
|
$tileX++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$gMouseXTileLeft[$x] = gameXYToTileOffset($tileX, $tileY);
|
||||||
|
if (($x % $gEquates{"TILE_PIXEL_WIDTH"}) == 0)
|
||||||
|
{
|
||||||
|
$gMouseXTileRight[$x] = gameXYToTileOffset($tileX, $tileY);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$gMouseXTileRight[$x] = gameXYToTileOffset($tileX + 1, $tileY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -449,6 +490,10 @@ printTileData($fh, "tileBitOffset", @gTileBitOffset);
|
|||||||
printTileData($fh, "tileBitMask", @gTileBitMask);
|
printTileData($fh, "tileBitMask", @gTileBitMask);
|
||||||
printTileData($fh, "dirtyNonGameTiles", @gDirtyNonGameTiles);
|
printTileData($fh, "dirtyNonGameTiles", @gDirtyNonGameTiles);
|
||||||
printTileData($fh, "mouseYAddress", @gMouseYAddress);
|
printTileData($fh, "mouseYAddress", @gMouseYAddress);
|
||||||
|
printTileData($fh, "mouseYTileAbove", @gMouseYTileAbove);
|
||||||
|
printTileData($fh, "mouseYTileBelow", @gMouseYTileBelow);
|
||||||
|
printTileData($fh, "mouseXTileLeft", @gMouseXTileLeft);
|
||||||
|
printTileData($fh, "mouseXTileRight", @gMouseXTileRight);
|
||||||
|
|
||||||
|
|
||||||
$text = << "EOF";
|
$text = << "EOF";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user