mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-12-27 10:29:40 +00:00
Merge branch 'master' of https://github.com/badvision/lawless-legends
This commit is contained in:
commit
e7308b9ab6
Binary file not shown.
@ -16,6 +16,7 @@ import javafx.scene.Scene;
|
||||
import javafx.scene.canvas.Canvas;
|
||||
import javafx.scene.canvas.GraphicsContext;
|
||||
import javafx.scene.effect.DropShadow;
|
||||
import javafx.scene.effect.Glow;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.image.WritableImage;
|
||||
@ -128,10 +129,15 @@ public class MapEditor extends Editor<Map, MapEditor.DrawMode> implements EventH
|
||||
});
|
||||
drawCanvas.addEventFilter(ScrollEvent.ANY, scrollHandler);
|
||||
drawCanvas.setOnMousePressed(this);
|
||||
drawCanvas.setOnMouseMoved(this);
|
||||
drawCanvas.setOnMouseDragged(this);
|
||||
drawCanvas.setOnMouseDragReleased(this);
|
||||
drawCanvas.setOnMouseReleased(this);
|
||||
anchorPane.getChildren().add(0, drawCanvas);
|
||||
cursorAssistant = new Rectangle(tileWidth, tileHeight, new Color(0.2,0.2,1.0,0.4));
|
||||
cursorAssistant.setMouseTransparent(true);
|
||||
cursorAssistant.setEffect(new Glow(1.0));
|
||||
anchorPane.getChildren().add(cursorAssistant);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -215,14 +221,9 @@ public class MapEditor extends Editor<Map, MapEditor.DrawMode> implements EventH
|
||||
@Override
|
||||
public void redraw() {
|
||||
redrawRequested = System.nanoTime();
|
||||
if (redrawThread == null || redrawThread.isAlive()) {
|
||||
if (redrawThread == null || !redrawThread.isAlive()) {
|
||||
redrawThread = new Thread(() -> {
|
||||
long test = redrawRequested;
|
||||
try {
|
||||
Thread.sleep(10);
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(MapEditor.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
long test = 0;
|
||||
while (test != redrawRequested) {
|
||||
test = redrawRequested;
|
||||
try {
|
||||
@ -447,6 +448,17 @@ public class MapEditor extends Editor<Map, MapEditor.DrawMode> implements EventH
|
||||
setSelectionArea(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
Rectangle cursorAssistant;
|
||||
private void updateCursorAssistant(MouseEvent t) {
|
||||
if (t.getEventType() == MouseEvent.MOUSE_EXITED) {
|
||||
cursorAssistant.setVisible(false);
|
||||
} else {
|
||||
cursorAssistant.setVisible(true);
|
||||
cursorAssistant.setTranslateX(t.getX() - (t.getX() % tileWidth));
|
||||
cursorAssistant.setTranslateY(t.getY() - (t.getY() % tileHeight));
|
||||
}
|
||||
}
|
||||
|
||||
public static enum DrawMode {
|
||||
|
||||
Pencil1px, Pencil3px, Pencil5px, FilledRect, Eraser
|
||||
@ -531,8 +543,9 @@ public class MapEditor extends Editor<Map, MapEditor.DrawMode> implements EventH
|
||||
|
||||
@Override
|
||||
public void handle(MouseEvent t) {
|
||||
updateCursorAssistant(t);
|
||||
if (!t.isPrimaryButtonDown() && drawMode != DrawMode.FilledRect && t.getEventType() != MouseEvent.MOUSE_RELEASED) return;
|
||||
if (getCurrentTile() == null && drawMode != DrawMode.Eraser) {
|
||||
System.out.println("No tile selected, ignoring");
|
||||
return;
|
||||
}
|
||||
t.consume();
|
||||
@ -576,7 +589,7 @@ public class MapEditor extends Editor<Map, MapEditor.DrawMode> implements EventH
|
||||
case FilledRect:
|
||||
if (t.getEventType().equals(MouseEvent.MOUSE_RELEASED)) {
|
||||
fillSelection(t.getX(), t.getY());
|
||||
} else {
|
||||
} else if (t.isPrimaryButtonDown()) {
|
||||
updateSelection(t.getX(), t.getY());
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ import java.util.Set;
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.scene.image.WritableImage;
|
||||
import javafx.scene.paint.Color;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.xml.bind.JAXBElement;
|
||||
import org.badvision.outlaweditor.Application;
|
||||
import org.badvision.outlaweditor.Platform;
|
||||
@ -85,7 +84,7 @@ public class TileMap extends ArrayList<ArrayList<Tile>> implements Serializable
|
||||
|
||||
private void registerLocationScript(int x, int y, Script s) {
|
||||
if (!scriptColors.containsKey(s)) {
|
||||
scriptColors.put(s, Color.hsb(HUE, SATURATION, VALUE));
|
||||
scriptColors.put(s, Color.hsb(HUE, SATURATION, 0.75 + Math.cos(HUE / Math.PI / 2.0)/8.0));
|
||||
HUE = (HUE + 27) % 360;
|
||||
}
|
||||
int loc = getMortonNumber(x, y);
|
||||
|
@ -46,6 +46,9 @@ public abstract class ApplicationUIController {
|
||||
@FXML
|
||||
abstract public void imageTabActivated(Event event);
|
||||
|
||||
@FXML
|
||||
abstract public void scriptTabActivated(Event event);
|
||||
|
||||
@FXML // This method is called by the FXMLLoader when initialization is complete
|
||||
public void initialize() {
|
||||
}
|
||||
|
@ -84,8 +84,7 @@ public class ApplicationUIControllerImpl extends ApplicationUIController {
|
||||
}
|
||||
|
||||
public static enum TABS {
|
||||
|
||||
image, map, tile
|
||||
image, map, tile, scripting
|
||||
};
|
||||
TABS currentTab;
|
||||
|
||||
@ -104,6 +103,11 @@ public class ApplicationUIControllerImpl extends ApplicationUIController {
|
||||
currentTab = TABS.tile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scriptTabActivated(Event event) {
|
||||
currentTab = TABS.scripting;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Editor getVisibleEditor() {
|
||||
switch (currentTab) {
|
||||
@ -113,9 +117,10 @@ public class ApplicationUIControllerImpl extends ApplicationUIController {
|
||||
return mapController.getCurrentEditor();
|
||||
case tile:
|
||||
return tileController.getCurrentTileEditor();
|
||||
}
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static final DataFormat SCRIPT_DATA_FORMAT = new DataFormat("MythosScript");
|
||||
|
||||
|
@ -0,0 +1,67 @@
|
||||
package org.badvision.outlaweditor.ui.impl;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.ListView;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
*
|
||||
* @author blurry
|
||||
*/
|
||||
public class GlobalScriptTabControllerImpl implements Initializable {
|
||||
@FXML
|
||||
private ListView<?> globalScriptList;
|
||||
@FXML
|
||||
private ListView<?> dataTypeList;
|
||||
@FXML
|
||||
private ListView<?> variableList;
|
||||
|
||||
/**
|
||||
* Initializes the controller class.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void onScriptAddPressed(ActionEvent event) {
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void onScriptDeletePressed(ActionEvent event) {
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void onScriptClonePressed(ActionEvent event) {
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void onDataTypeAddPressed(ActionEvent event) {
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void onDataTypeDeletePressed(ActionEvent event) {
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void onDeleteClonePressed(ActionEvent event) {
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void onVariableAddPressed(ActionEvent event) {
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void onVariableDeletePressed(ActionEvent event) {
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void onVariableClonePressed(ActionEvent event) {
|
||||
}
|
||||
|
||||
}
|
@ -13,6 +13,8 @@ import javafx.scene.control.cell.ComboBoxListCell;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.image.WritableImage;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.scene.text.FontWeight;
|
||||
import javafx.util.Callback;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import org.badvision.outlaweditor.Application;
|
||||
@ -26,7 +28,6 @@ import org.badvision.outlaweditor.data.TileUtils;
|
||||
import org.badvision.outlaweditor.data.xml.Map;
|
||||
import org.badvision.outlaweditor.data.xml.Script;
|
||||
import org.badvision.outlaweditor.data.xml.Tile;
|
||||
import org.badvision.outlaweditor.ui.ApplicationUIController;
|
||||
import org.badvision.outlaweditor.ui.EntitySelectorCell;
|
||||
import org.badvision.outlaweditor.ui.MapEditorTabController;
|
||||
import org.badvision.outlaweditor.ui.ToolType;
|
||||
@ -383,6 +384,7 @@ public class MapEditorTabControllerImpl extends MapEditorTabController {
|
||||
@Override
|
||||
public ListCell<Script> call(ListView<Script> param) {
|
||||
final ListCell<Script> cell = new ListCell<Script>() {
|
||||
|
||||
@Override
|
||||
protected void updateItem(Script item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
@ -397,6 +399,7 @@ public class MapEditorTabControllerImpl extends MapEditorTabController {
|
||||
setGraphic(visibleIcon);
|
||||
getCurrentEditor().getCurrentMap().getScriptColor(item).ifPresent(this::setTextFill);
|
||||
setText(item.getName());
|
||||
setFont(Font.font(null, FontWeight.BOLD, 12.0));
|
||||
scriptDragDrop.registerDragSupport(this, item);
|
||||
visibleIcon.setMouseTransparent(false);
|
||||
}
|
||||
@ -442,6 +445,9 @@ public class MapEditorTabControllerImpl extends MapEditorTabController {
|
||||
}
|
||||
|
||||
private void sortScripts(Map m) {
|
||||
if (m == null || m.getScripts() == null || m.getScripts().getScript() == null) {
|
||||
return;
|
||||
}
|
||||
m.getScripts().getScript().sort((a, b) -> {
|
||||
if (a.getName().equalsIgnoreCase("init")) {
|
||||
return -1;
|
||||
|
@ -27,6 +27,11 @@
|
||||
<fx:include fx:id="image" source="imageEditorTab.fxml" />
|
||||
</content>
|
||||
</Tab>
|
||||
<Tab onSelectionChanged="#scriptTabActivated" text="Scripting">
|
||||
<content>
|
||||
<fx:include fx:id="scripting" source="globalScriptEditorTab.fxml" />
|
||||
</content>
|
||||
</Tab>
|
||||
</tabs>
|
||||
</TabPane>
|
||||
</children>
|
||||
|
84
OutlawEditor/src/main/resources/globalScriptEditorTab.fxml
Normal file
84
OutlawEditor/src/main/resources/globalScriptEditorTab.fxml
Normal file
@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.*?>
|
||||
<?import java.lang.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
|
||||
<AnchorPane id="mapsTab" minHeight="0.0" minWidth="0.0" prefHeight="480.0" prefWidth="677.0" stylesheets="@styles/applicationui.css" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.badvision.outlaweditor.ui.impl.GlobalScriptTabControllerImpl">
|
||||
<children>
|
||||
<HBox prefHeight="438.0" prefWidth="677.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<children>
|
||||
<VBox HBox.hgrow="ALWAYS">
|
||||
<children>
|
||||
<Label text="Scripts" />
|
||||
<ToolBar prefWidth="200.0">
|
||||
<items>
|
||||
<Button mnemonicParsing="false" onAction="#onScriptAddPressed" text="+" />
|
||||
<Button mnemonicParsing="false" onAction="#onScriptDeletePressed" text="-" />
|
||||
<Button mnemonicParsing="false" onAction="#onScriptClonePressed" text="Clone" />
|
||||
</items>
|
||||
</ToolBar>
|
||||
<ScrollPane fitToHeight="true" fitToWidth="true" prefHeight="419.0" prefWidth="201.0">
|
||||
<content>
|
||||
<AnchorPane id="Content" minHeight="0.0" minWidth="0.0" prefHeight="95.0" prefWidth="198.0">
|
||||
<children>
|
||||
<ListView fx:id="globalScriptList" editable="true" prefHeight="130.0" prefWidth="199.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</content>
|
||||
</ScrollPane>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets right="5.0" />
|
||||
</padding>
|
||||
</VBox>
|
||||
<VBox layoutX="10.0" layoutY="10.0" HBox.hgrow="ALWAYS">
|
||||
<children>
|
||||
<Label text="Data Types" />
|
||||
<ToolBar prefWidth="200.0">
|
||||
<items>
|
||||
<Button mnemonicParsing="false" onAction="#onDataTypeAddPressed" text="+" />
|
||||
<Button mnemonicParsing="false" onAction="#onDataTypeDeletePressed" text="-" />
|
||||
<Button mnemonicParsing="false" onAction="#onDeleteClonePressed" text="Clone" />
|
||||
</items>
|
||||
</ToolBar>
|
||||
<ScrollPane fitToHeight="true" fitToWidth="true" prefHeight="419.0" prefWidth="201.0">
|
||||
<content>
|
||||
<AnchorPane id="Content" minHeight="0.0" minWidth="0.0" prefHeight="95.0" prefWidth="198.0">
|
||||
<children>
|
||||
<ListView fx:id="dataTypeList" editable="true" prefHeight="130.0" prefWidth="199.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</content>
|
||||
</ScrollPane>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets right="5.0" />
|
||||
</padding>
|
||||
</VBox>
|
||||
<VBox layoutX="211.0" layoutY="10.0" HBox.hgrow="ALWAYS">
|
||||
<children>
|
||||
<Label text="Global Variables" />
|
||||
<ToolBar prefWidth="200.0">
|
||||
<items>
|
||||
<Button mnemonicParsing="false" onAction="#onVariableAddPressed" text="+" />
|
||||
<Button mnemonicParsing="false" onAction="#onVariableDeletePressed" text="-" />
|
||||
<Button mnemonicParsing="false" onAction="#onVariableClonePressed" text="Clone" />
|
||||
</items>
|
||||
</ToolBar>
|
||||
<ScrollPane fitToHeight="true" fitToWidth="true" prefHeight="419.0" prefWidth="201.0">
|
||||
<content>
|
||||
<AnchorPane id="Content" minHeight="0.0" minWidth="0.0" prefHeight="95.0" prefWidth="198.0">
|
||||
<children>
|
||||
<ListView fx:id="variableList" editable="true" prefHeight="130.0" prefWidth="199.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</content>
|
||||
</ScrollPane>
|
||||
</children>
|
||||
</VBox>
|
||||
</children>
|
||||
</HBox>
|
||||
</children>
|
||||
</AnchorPane>
|
Binary file not shown.
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 16 KiB |
BIN
OutlawEditor/src/main/resources/images/revolver_icon.png
Normal file
BIN
OutlawEditor/src/main/resources/images/revolver_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 153 KiB |
22
Platform/C64/README.txt
Normal file
22
Platform/C64/README.txt
Normal file
@ -0,0 +1,22 @@
|
||||
Screen memory specification:
|
||||
|
||||
Screen is available in Bank #1 ($4000 - $7FFF)
|
||||
Bitmap is available from $6000 to $7F3F
|
||||
Video Color RAM is available from $5C00 to $5FF7
|
||||
Color RAM is available from $D800 to $DBE7 (this range is a default Color RAM range on a C64, cannot be changed)
|
||||
|
||||
Sprite pointers are available from $5FF8 to $5FFF
|
||||
Sprites are available from $5b80 to $5bff (just two sprites)
|
||||
|
||||
Features:
|
||||
Graphic displayed in multicolor bitmap mode
|
||||
Map size can be freely changed (size of map is saved in header)
|
||||
64 tiles (each tile contains 4 characters (8x8 pixels each in multicolor mode))
|
||||
Joystick and keyboard control (WASD keys)
|
||||
Text can be added to any location
|
||||
Added some fonts
|
||||
|
||||
Tools used:
|
||||
64tass compiler
|
||||
GangEd for tiles (data saved separately as videomem, colormem and bitmap) and fonts
|
||||
SpritePad for sprites
|
BIN
Platform/C64/data/fonts.GEP
Normal file
BIN
Platform/C64/data/fonts.GEP
Normal file
Binary file not shown.
BIN
Platform/C64/data/sprites.spd
Normal file
BIN
Platform/C64/data/sprites.spd
Normal file
Binary file not shown.
BIN
Platform/C64/data/tiles.GEP
Normal file
BIN
Platform/C64/data/tiles.GEP
Normal file
Binary file not shown.
BIN
Platform/C64/demos/2d-demo-2015-05-21.prg
Normal file
BIN
Platform/C64/demos/2d-demo-2015-05-21.prg
Normal file
Binary file not shown.
BIN
Platform/C64/demos/2d-demo-2015-05-23.prg
Normal file
BIN
Platform/C64/demos/2d-demo-2015-05-23.prg
Normal file
Binary file not shown.
298
Platform/C64/src/2d.asm
Normal file
298
Platform/C64/src/2d.asm
Normal file
@ -0,0 +1,298 @@
|
||||
|
||||
RASTER_TOP_FRAME=170
|
||||
REGISTER_01=%00110101 ;#$35 (53)
|
||||
|
||||
mapPosX = $0a ;and $0b
|
||||
mapPosY = $0c ;and $0d
|
||||
mapSizeX = $0e ;and $0f
|
||||
mapSizeY = $10 ;$and 11
|
||||
|
||||
tile = $12
|
||||
x = $13
|
||||
y = $14
|
||||
|
||||
tileBitmapPointer_LO = $15
|
||||
tileBitmapPointer_HI = $16
|
||||
mapBitmapPointer_LO = $17
|
||||
mapBitmapPointer_HI = $18
|
||||
mapBitmapPointer2_LO = $19
|
||||
mapBitmapPointer2_HI = $1a
|
||||
screenVideoRamPointer_LO = $1b
|
||||
screenVideoRamPointer_HI = $1c
|
||||
colorRamPointer_LO = $1d
|
||||
colorRamPointer_HI = $1e
|
||||
|
||||
posX = $1f ;Sprite position X
|
||||
posY = $20 ;Sprite position Y
|
||||
|
||||
mapSizeXAdc = $21 ;and $22
|
||||
mapPointer_LO = $23
|
||||
mapPointer_HI = $24
|
||||
|
||||
mapPosXMax = $25 ;and $26
|
||||
mapPosYMax = $27 ;and $28
|
||||
|
||||
movementBuffer = $29
|
||||
|
||||
textCursor = $2a
|
||||
|
||||
calculateDiffer_LO = $2b
|
||||
calculateDiffer_HI = $2c
|
||||
|
||||
locationX = $2d ;and $2e
|
||||
locationY = $2f ;and $30
|
||||
|
||||
textPointerData_LO = $31
|
||||
textPointerData_HI = $32
|
||||
|
||||
mapOffsetPointer_LO = $33
|
||||
mapOffsetPointer_HI = $34
|
||||
|
||||
playerPosition_LO = $35
|
||||
playerPosition_HI = $36
|
||||
|
||||
BANK_START_ADDR=$4000 ;$4000 - $7FFF
|
||||
SCREEN=$6000 ;Bitmap range: $6000 - $7F3F
|
||||
SCREEN_VIDEO_RAM=$5C00 ;Screen Video RAM range: $5C00 - $5FFF
|
||||
SCREEN_COLOR_RAM=$d800 ;Screen Color RAM range: $d800 - $dbe7
|
||||
|
||||
;View Port: size of 18 x 18 characters
|
||||
VIEWPORT_BITMAP_OFFSET=320*3+16
|
||||
VIEWPORT_SCREEN_OFFSET=40*3+2
|
||||
|
||||
;Text Port: size of 16 x 14 characters
|
||||
TEXTPORT_BITMAP_OFFSET=320*3+16+8*20
|
||||
TEXTPORT_SCREEN_OFFSET=40*3+2+20
|
||||
|
||||
SPRITE_POINTER=SCREEN_VIDEO_RAM+$03F8
|
||||
SPRITES=$5b80
|
||||
SPRITE_BASE=(SPRITES - BANK_START_ADDR) / 64 ;calculate where first pointer to sprite bank is located
|
||||
|
||||
TILES=$8000 ;Max: 64 tiles, each tile contains 4 quadrates (each quadrates 8x8 pixel size)
|
||||
TILES_VIDEO_RAM=TILES+64*4*8
|
||||
TILES_COLOR_RAM=TILES_VIDEO_RAM+64*4
|
||||
|
||||
FONTS=$9000
|
||||
|
||||
MAP_DATA=$3000
|
||||
|
||||
MSX=$A000 ;somewhere around $A000 - $BFFF we will go with music if any (8k free for zaks)
|
||||
|
||||
MOVEMENT_DELAY = #6
|
||||
|
||||
*=$0801
|
||||
.word ss,10
|
||||
.null $9e,^start
|
||||
ss .word 0
|
||||
start
|
||||
|
||||
sei ;Disable IRQ's
|
||||
|
||||
lda #$7f ;Disable CIA IRQ's
|
||||
sta $dc0d ;Disable timer interrupts
|
||||
sta $dd0d
|
||||
|
||||
lda #REGISTER_01 ;Bank out kernal and basic ($e000-$ffff)
|
||||
sta $01
|
||||
|
||||
lda #<Top_Frame_IRQ ;Install RASTER IRQ
|
||||
ldx #>Top_Frame_IRQ ;into Hardware
|
||||
sta $fffe ;Interrupt Vector
|
||||
stx $ffff
|
||||
|
||||
lda #$01
|
||||
sta $d01a ;Enable RASTER IRQs
|
||||
|
||||
lda #RASTER_TOP_FRAME ;IRQ on line RASTER_TOP_FRAME
|
||||
sta $d012
|
||||
|
||||
asl $d019 ;acknowledge video interrupts
|
||||
bit $dc0d ;acknowledge CIA interrupts
|
||||
bit $dd0d
|
||||
|
||||
lda #0
|
||||
sta $d020
|
||||
sta $d021
|
||||
|
||||
sta mapPosX
|
||||
sta mapPosX+1
|
||||
sta mapPosY
|
||||
sta mapPosY+1
|
||||
sta mapSizeXAdc
|
||||
sta mapSizeXAdc+1
|
||||
|
||||
sta movementBuffer
|
||||
|
||||
lda #4
|
||||
sta posX
|
||||
sta posY
|
||||
|
||||
;Get map size
|
||||
lda MAP_DATA
|
||||
sta mapSizeX
|
||||
lda MAP_DATA+1
|
||||
sta mapSizeX+1
|
||||
|
||||
lda MAP_DATA+2
|
||||
sta mapSizeY
|
||||
lda MAP_DATA+3
|
||||
sta mapSizeY+1
|
||||
|
||||
;Get map boundaries
|
||||
lda MAP_DATA ;first for x
|
||||
sec
|
||||
sbc #8
|
||||
sta mapPosXMax
|
||||
lda MAP_DATA+1
|
||||
sec
|
||||
sbc #0
|
||||
sta mapPosXMax+1
|
||||
|
||||
lda MAP_DATA+2 ;then for y
|
||||
sec
|
||||
sbc #8
|
||||
sta mapPosYMax
|
||||
lda MAP_DATA+3
|
||||
sec
|
||||
sbc #0
|
||||
sta mapPosYMax+1
|
||||
|
||||
;Set length of a single row
|
||||
clc
|
||||
lda mapSizeX
|
||||
adc #1
|
||||
sta mapSizeXAdc
|
||||
lda mapSizeX+1
|
||||
adc #0
|
||||
sta mapSizeXAdc+1
|
||||
|
||||
;Clear View Port Screen
|
||||
lda #0
|
||||
ldx #160
|
||||
clearViewPortLoop
|
||||
.for part=0, part<=49, part=part+1
|
||||
sta SCREEN + part*160-1,x
|
||||
.next
|
||||
dex
|
||||
|
||||
beq +
|
||||
jmp clearViewPortLoop
|
||||
+
|
||||
|
||||
;Clear Text Port Screen
|
||||
lda #1
|
||||
|
||||
ldy #16
|
||||
|
||||
-
|
||||
.for part=0, part<=13, part=part+1
|
||||
sta SCREEN_VIDEO_RAM + TEXTPORT_SCREEN_OFFSET -1 + part*40,y
|
||||
sta SCREEN_COLOR_RAM + TEXTPORT_SCREEN_OFFSET -1 + part*40,y
|
||||
.next
|
||||
dey
|
||||
bne -
|
||||
|
||||
|
||||
;Set Screen Bank
|
||||
lda #$3b
|
||||
sta $d011 ;Enable Bitmap Mode
|
||||
|
||||
lda #$18
|
||||
sta $d016 ;Enable Multicolor Mode
|
||||
|
||||
;Set Bank #1 (from $4000 - $7FFF)
|
||||
lda #%00000010
|
||||
sta $dd00
|
||||
|
||||
;Set Video Memory for $2C00 offset ($5C00 - $5FFF for bits 4-7 = %0111) and second half of bank for bitmap (bits 1-3 = %100)
|
||||
lda #%01111000
|
||||
sta $d018
|
||||
|
||||
cli ;Allow IRQ's
|
||||
|
||||
;Draw a map
|
||||
jsr drawMap
|
||||
|
||||
;Set sprites
|
||||
lda #SPRITE_BASE+0
|
||||
sta SPRITE_POINTER+1
|
||||
|
||||
lda #SPRITE_BASE+1
|
||||
sta SPRITE_POINTER+0
|
||||
|
||||
;Enable sprites
|
||||
lda #1+2
|
||||
sta $d015
|
||||
|
||||
;Set multicolor mode for sprites
|
||||
lda $d01c
|
||||
ora #$FF
|
||||
sta $d01c
|
||||
|
||||
;Set sprites colours
|
||||
lda #8
|
||||
sta $d027+0
|
||||
|
||||
lda #0
|
||||
sta $d027+1
|
||||
|
||||
;Set global multi colours for sprites
|
||||
lda #3
|
||||
sta $d025
|
||||
lda #1
|
||||
sta $d026
|
||||
|
||||
;Set sprites hi byte positions
|
||||
lda #%00000000
|
||||
sta $d010
|
||||
|
||||
;no graphic overlay on sprites
|
||||
lda #%00000000
|
||||
sta $d01b
|
||||
|
||||
;Set player on the screen
|
||||
jsr setPlayer
|
||||
jsr searchText
|
||||
|
||||
;Infinity Loop!
|
||||
jmp *
|
||||
|
||||
;IRQs
|
||||
.include "includes/irqs/topFrameIRQ.asm"
|
||||
|
||||
;Includes
|
||||
.include "includes/drawMap.asm"
|
||||
.include "includes/drawTile.asm"
|
||||
.include "includes/drawPlayer.asm"
|
||||
.include "includes/searchText.asm"
|
||||
.include "includes/drawText.asm"
|
||||
.include "includes/checkTerrain.asm"
|
||||
|
||||
;Tables
|
||||
.include "includes/tables/drawTileTables.asm"
|
||||
.include "includes/tables/playerPositionTables.asm"
|
||||
.include "includes/tables/textTables.asm"
|
||||
|
||||
*=TILES
|
||||
.binary "binary/bitmap.PRG",2,64*4*8
|
||||
|
||||
*=TILES_VIDEO_RAM
|
||||
.binary "binary/videomem.PRG",2,64*4
|
||||
|
||||
*=TILES_COLOR_RAM
|
||||
.binary "binary/colormem.PRG",2,64*4
|
||||
|
||||
*=FONTS
|
||||
.binary "binary/fonts.PRG",2,8*26+8*26+8*3
|
||||
|
||||
*=MAP_DATA
|
||||
;.binary "binary/map.bin" ;TODO: As we have no map file yet, let's use fake map for test purposes
|
||||
.include "binary/map.asm"
|
||||
|
||||
*=SPRITES
|
||||
.binary "binary/sprites.raw",0,64*2 ;only two sprites!
|
||||
|
||||
Raster_Indicator
|
||||
.byte 0
|
||||
Raster_Indicator_Key_Pressed
|
||||
.byte 0
|
BIN
Platform/C64/src/binary/bitmap.PRG
Normal file
BIN
Platform/C64/src/binary/bitmap.PRG
Normal file
Binary file not shown.
BIN
Platform/C64/src/binary/colormem.PRG
Normal file
BIN
Platform/C64/src/binary/colormem.PRG
Normal file
Binary file not shown.
BIN
Platform/C64/src/binary/fonts.PRG
Normal file
BIN
Platform/C64/src/binary/fonts.PRG
Normal file
Binary file not shown.
55
Platform/C64/src/binary/map.asm
Normal file
55
Platform/C64/src/binary/map.asm
Normal file
@ -0,0 +1,55 @@
|
||||
|
||||
MAP_HEADER
|
||||
.byte 29, 0 ;Size X of map (LO, HI)
|
||||
.byte 29, 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
.byte 5, 0, $a, 0, <text2, >text2
|
||||
|
||||
TEXTS
|
||||
text1
|
||||
.byte 26, 54, 18, 20, 1, 19, 11, 4, 54, 1, 17, 4, 4, 25, 4, 54
|
||||
.byte 18, 19, 8, 17, 18, 54, 3, 20, 18, 19, 54, 54, 54, 54, 54, 54
|
||||
.byte 0, 2, 17, 14, 18, 18, 54, 19, 7, 4, 54, 3, 17, 24, 54, 54
|
||||
.byte 3, 4, 18, 4, 17, 19, 54, 5, 11, 14, 14, 17, 52
|
||||
.byte $FF
|
||||
|
||||
text2
|
||||
.byte 26, 54, 2, 7, 4, 18, 19, 52
|
||||
.byte $FF
|
BIN
Platform/C64/src/binary/sprites.raw
Normal file
BIN
Platform/C64/src/binary/sprites.raw
Normal file
Binary file not shown.
BIN
Platform/C64/src/binary/videomem.PRG
Normal file
BIN
Platform/C64/src/binary/videomem.PRG
Normal file
Binary file not shown.
56
Platform/C64/src/includes/checkTerrain.asm
Normal file
56
Platform/C64/src/includes/checkTerrain.asm
Normal file
@ -0,0 +1,56 @@
|
||||
|
||||
checkTerrainLeft
|
||||
lda playerPosition_LO
|
||||
sec
|
||||
sbc #1
|
||||
sta mapPointer_LO
|
||||
lda playerPosition_HI
|
||||
sbc #0
|
||||
sta mapPointer_HI
|
||||
jmp checkTerrain
|
||||
|
||||
checkTerrainRight
|
||||
lda playerPosition_LO
|
||||
clc
|
||||
adc #1
|
||||
sta mapPointer_LO
|
||||
lda playerPosition_HI
|
||||
adc #0
|
||||
sta mapPointer_HI
|
||||
jmp checkTerrain
|
||||
|
||||
checkTerrainUp
|
||||
lda playerPosition_LO
|
||||
sec
|
||||
sbc mapSizeXAdc
|
||||
sta mapPointer_LO
|
||||
lda playerPosition_HI
|
||||
sbc mapSizeXAdc+1
|
||||
sta mapPointer_HI
|
||||
jmp checkTerrain
|
||||
|
||||
checkTerrainDown
|
||||
lda playerPosition_LO
|
||||
clc
|
||||
adc mapSizeXAdc
|
||||
sta mapPointer_LO
|
||||
lda playerPosition_HI
|
||||
adc mapSizeXAdc+1
|
||||
sta mapPointer_HI
|
||||
jmp checkTerrain
|
||||
|
||||
checkTerrain
|
||||
|
||||
ldy #0
|
||||
lda (mapPointer_LO),y
|
||||
cmp #1
|
||||
beq cannotAccess
|
||||
|
||||
;Can access
|
||||
lda #1
|
||||
rts
|
||||
|
||||
cannotAccess
|
||||
;Cannot access
|
||||
lda #0
|
||||
rts
|
94
Platform/C64/src/includes/drawMap.asm
Normal file
94
Platform/C64/src/includes/drawMap.asm
Normal file
@ -0,0 +1,94 @@
|
||||
drawMap
|
||||
|
||||
lda Raster_Indicator
|
||||
beq +
|
||||
lda #2
|
||||
sta $d020
|
||||
+
|
||||
|
||||
clc
|
||||
lda #<MAP
|
||||
adc mapPosX
|
||||
sta mapPointer_LO
|
||||
lda #>MAP
|
||||
adc mapPosX+1
|
||||
sta mapPointer_HI
|
||||
|
||||
;Increment map pointer by a multiplication of row length if map Y position more than 0
|
||||
lda mapPosY+1
|
||||
bne setCalculateDiffer
|
||||
lda mapPosY
|
||||
beq +
|
||||
|
||||
setCalculateDiffer
|
||||
;Set differ
|
||||
lda mapPosY
|
||||
sta calculateDiffer_LO
|
||||
lda mapPosY+1
|
||||
sta calculateDiffer_HI
|
||||
|
||||
calculateY
|
||||
|
||||
;Calculate row on the map (length of rows vary for a particular map so it cannot be pre-calculated in table)
|
||||
clc
|
||||
lda mapPointer_LO
|
||||
adc mapSizeXAdc
|
||||
sta mapPointer_LO
|
||||
|
||||
lda mapPointer_HI
|
||||
adc mapSizeXAdc+1
|
||||
sta mapPointer_HI
|
||||
|
||||
lda calculateDiffer_LO
|
||||
sec
|
||||
sbc #1
|
||||
sta calculateDiffer_LO
|
||||
lda calculateDiffer_HI
|
||||
sbc #0
|
||||
sta calculateDiffer_HI
|
||||
|
||||
;Is it everything?
|
||||
calculateDiffer
|
||||
lda calculateDiffer_LO
|
||||
bne calculateY
|
||||
lda calculateDiffer_HI
|
||||
bne calculateY
|
||||
|
||||
|
||||
+
|
||||
|
||||
;Remember offset of a map, used for checking terrain type
|
||||
clc
|
||||
lda mapPointer_LO
|
||||
sta mapOffsetPointer_LO
|
||||
lda mapPointer_HI
|
||||
sta mapOffsetPointer_HI
|
||||
|
||||
.for row=0,row<=8,row=row+1
|
||||
.for tileN=0,tileN<=8,tileN=tileN+1
|
||||
ldy #0 + tileN
|
||||
lda (mapPointer_LO),y
|
||||
ldx #0 + tileN
|
||||
ldy #0 + row
|
||||
jsr drawTile
|
||||
.next
|
||||
|
||||
clc
|
||||
lda mapPointer_LO
|
||||
adc mapSizeXAdc
|
||||
sta mapPointer_LO
|
||||
|
||||
lda mapPointer_HI
|
||||
adc mapSizeXAdc+1
|
||||
sta mapPointer_HI
|
||||
|
||||
.next
|
||||
|
||||
lda Raster_Indicator
|
||||
beq +
|
||||
lda #0
|
||||
sta $d020
|
||||
+
|
||||
|
||||
rts
|
||||
|
13
Platform/C64/src/includes/drawPlayer.asm
Normal file
13
Platform/C64/src/includes/drawPlayer.asm
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
setPlayer
|
||||
ldy posX
|
||||
lda playerPosTableX,y
|
||||
sta $d000
|
||||
sta $d002
|
||||
|
||||
ldy posY
|
||||
lda playerPosTableY,y
|
||||
sta $d001
|
||||
sta $d003
|
||||
|
||||
rts
|
59
Platform/C64/src/includes/drawText.asm
Normal file
59
Platform/C64/src/includes/drawText.asm
Normal file
@ -0,0 +1,59 @@
|
||||
drawText
|
||||
|
||||
stx textPointer+1
|
||||
sty textPointer+2
|
||||
|
||||
lda #$FF
|
||||
sta textCursor
|
||||
|
||||
drawTextLoop
|
||||
inc textCursor
|
||||
ldy textCursor
|
||||
textPointer
|
||||
lda $1234,y
|
||||
cmp #$FF
|
||||
beq drawTextDone
|
||||
sta letter+1
|
||||
|
||||
ldy textCursor
|
||||
|
||||
lda textPortTable_LO,y
|
||||
sta textPortPointer+1
|
||||
lda textPortTable_HI,y
|
||||
sta textPortPointer+2
|
||||
|
||||
lda textPortColorTable_LO,y
|
||||
sta textPortColor+1
|
||||
lda textPortColorTable_HI,y
|
||||
sta textPortColor+2
|
||||
|
||||
;Draw a letter
|
||||
letter
|
||||
ldy #0
|
||||
lda fontsTable_LO,y
|
||||
sta fontPointer+1
|
||||
lda fontsTable_HI,y
|
||||
sta fontPointer+2
|
||||
|
||||
ldy #8
|
||||
-
|
||||
|
||||
;Switch colour on for this letter
|
||||
lda #1
|
||||
textPortColor
|
||||
sta $1234
|
||||
|
||||
fontPointer
|
||||
lda $1234,y
|
||||
textPortPointer
|
||||
sta $1234,y
|
||||
dey
|
||||
bne -
|
||||
|
||||
jmp drawTextLoop
|
||||
|
||||
drawTextDone
|
||||
|
||||
rts
|
||||
|
||||
|
118
Platform/C64/src/includes/drawTile.asm
Normal file
118
Platform/C64/src/includes/drawTile.asm
Normal file
@ -0,0 +1,118 @@
|
||||
;Draw tile
|
||||
drawTile
|
||||
|
||||
sta tile
|
||||
stx x
|
||||
sty y
|
||||
|
||||
;Get a tile
|
||||
tay
|
||||
lda tilesBitmapTable_LO,y
|
||||
sta tileBitmapPointer_LO
|
||||
lda tilesBitmapTable_HI,y
|
||||
sta tileBitmapPointer_HI
|
||||
|
||||
clc
|
||||
lda y
|
||||
tay
|
||||
lda multiplyBy9,y ;Multiply y by 9
|
||||
adc x
|
||||
tay
|
||||
|
||||
|
||||
lda mapBitmapTable_LO,y
|
||||
sta mapBitmapPointer_LO
|
||||
lda mapBitmapTable_HI,y
|
||||
sta mapBitmapPointer_HI
|
||||
|
||||
lda mapBitmapTable2_LO,y
|
||||
sta mapBitmapPointer2_LO
|
||||
lda mapBitmapTable2_HI,y
|
||||
sta mapBitmapPointer2_HI
|
||||
|
||||
lda screenVideoRamTable_LO,y
|
||||
sta screenVideoRamPointer_LO
|
||||
lda screenVideoRamTable_HI,y
|
||||
sta screenVideoRamPointer_HI
|
||||
|
||||
lda colorRamTable_LO,y
|
||||
sta colorRamPointer_LO
|
||||
lda colorRamTable_HI,y
|
||||
sta colorRamPointer_HI
|
||||
|
||||
ldy #16
|
||||
-
|
||||
lda (tileBitmapPointer_LO),y
|
||||
sta (mapBitmapPointer_LO),y
|
||||
|
||||
dey
|
||||
bne -
|
||||
|
||||
ldx #16
|
||||
ldy #32
|
||||
-
|
||||
lda (tileBitmapPointer_LO),y
|
||||
sta (mapBitmapPointer2_LO),y
|
||||
|
||||
dey
|
||||
dex
|
||||
bne -
|
||||
|
||||
;Draw Video RAM
|
||||
lda tile
|
||||
asl
|
||||
asl
|
||||
tax
|
||||
|
||||
ldy #0
|
||||
|
||||
lda TILES_VIDEO_RAM,x
|
||||
sta (screenVideoRamPointer_LO),y
|
||||
|
||||
inx
|
||||
ldy #1
|
||||
|
||||
lda TILES_VIDEO_RAM,x
|
||||
sta (screenVideoRamPointer_LO),y
|
||||
|
||||
inx
|
||||
ldy #40
|
||||
|
||||
lda TILES_VIDEO_RAM,x
|
||||
sta (screenVideoRamPointer_LO),y
|
||||
|
||||
inx
|
||||
ldy #41
|
||||
|
||||
lda TILES_VIDEO_RAM,x
|
||||
sta (screenVideoRamPointer_LO),y
|
||||
|
||||
;Draw Color RAM
|
||||
dex
|
||||
dex
|
||||
dex
|
||||
|
||||
ldy #0
|
||||
|
||||
lda TILES_COLOR_RAM,x
|
||||
sta (colorRamPointer_LO),y
|
||||
|
||||
inx
|
||||
ldy #1
|
||||
|
||||
lda TILES_COLOR_RAM,x
|
||||
sta (colorRamPointer_LO),y
|
||||
|
||||
inx
|
||||
ldy #40
|
||||
|
||||
lda TILES_COLOR_RAM,x
|
||||
sta (colorRamPointer_LO),y
|
||||
|
||||
inx
|
||||
ldy #41
|
||||
|
||||
lda TILES_COLOR_RAM,x
|
||||
sta (colorRamPointer_LO),y
|
||||
rts
|
||||
|
281
Platform/C64/src/includes/irqs/topFrameIRQ.asm
Normal file
281
Platform/C64/src/includes/irqs/topFrameIRQ.asm
Normal file
@ -0,0 +1,281 @@
|
||||
|
||||
Top_Frame_IRQ
|
||||
pha ;store register A in stack
|
||||
txa
|
||||
pha ;store register X in stack
|
||||
tya
|
||||
pha
|
||||
|
||||
inc $d019
|
||||
|
||||
lda Raster_Indicator
|
||||
beq +
|
||||
lda #2
|
||||
sta $d020
|
||||
+
|
||||
|
||||
lda movementBuffer
|
||||
beq calculatePlayerPosition
|
||||
dec movementBuffer
|
||||
jmp moveFinished
|
||||
|
||||
calculatePlayerPosition ;calculate position of player for further operations like checkTerrain procedure
|
||||
clc
|
||||
lda mapOffsetPointer_LO
|
||||
adc posX
|
||||
sta playerPosition_LO
|
||||
lda mapOffsetPointer_HI
|
||||
adc #0
|
||||
sta playerPosition_HI
|
||||
|
||||
ldy posY
|
||||
beq +
|
||||
-
|
||||
clc
|
||||
lda playerPosition_LO
|
||||
adc mapSizeXAdc
|
||||
sta playerPosition_LO
|
||||
|
||||
lda playerPosition_HI
|
||||
adc mapSizeXAdc+1
|
||||
sta playerPosition_HI
|
||||
|
||||
dey
|
||||
bne -
|
||||
+
|
||||
|
||||
checkIsUp
|
||||
lda #%00000001 ;when joystick up
|
||||
bit $dc00
|
||||
beq +
|
||||
lda #%11111101 ;when key "W" hit
|
||||
sta $dc00
|
||||
lda $dc01
|
||||
cmp #%11111101
|
||||
bne checkIsLeft
|
||||
|
||||
+
|
||||
;Joystick Up
|
||||
jsr checkTerrainUp
|
||||
bne +
|
||||
jmp moveFinished
|
||||
+
|
||||
lda MOVEMENT_DELAY
|
||||
sta movementBuffer
|
||||
|
||||
lda mapPosY
|
||||
cmp #1
|
||||
bcc ++
|
||||
|
||||
lda posY
|
||||
cmp #5
|
||||
bcs ++
|
||||
|
||||
dec mapPosY
|
||||
lda mapPosY
|
||||
cmp #$FF
|
||||
bne +
|
||||
dec mapPosY+1
|
||||
+
|
||||
jsr drawMap
|
||||
jsr setPlayer
|
||||
jsr searchText
|
||||
jmp moveFinished
|
||||
+
|
||||
lda posY
|
||||
beq +
|
||||
dec posY
|
||||
jsr setPlayer
|
||||
jsr searchText
|
||||
+
|
||||
jmp moveFinished
|
||||
|
||||
checkIsLeft
|
||||
lda #%00000100 ;when joystick left
|
||||
bit $dc00
|
||||
beq +
|
||||
lda #%11111101 ;when key "A" hit
|
||||
sta $dc00
|
||||
lda $dc01
|
||||
cmp #%11111011
|
||||
bne checkIsRight
|
||||
+
|
||||
;Joystick Left
|
||||
jsr checkTerrainLeft
|
||||
bne +
|
||||
jmp moveFinished
|
||||
+
|
||||
lda MOVEMENT_DELAY
|
||||
sta movementBuffer
|
||||
|
||||
lda mapPosX
|
||||
cmp #1
|
||||
bcc ++
|
||||
|
||||
lda posX
|
||||
cmp #5
|
||||
bcs ++
|
||||
|
||||
dec mapPosX
|
||||
lda mapPosX
|
||||
cmp #$FF
|
||||
bne +
|
||||
dec mapPosX+1
|
||||
+
|
||||
jsr drawMap
|
||||
jsr setPlayer
|
||||
jsr searchText
|
||||
jmp moveFinished
|
||||
+
|
||||
lda posX
|
||||
beq +
|
||||
dec posX
|
||||
jsr setPlayer
|
||||
jsr searchText
|
||||
+
|
||||
jmp moveFinished
|
||||
|
||||
checkIsRight
|
||||
lda #%00001000 ;when joystick right
|
||||
bit $dc00
|
||||
beq +
|
||||
lda #%11111011 ;when key "D" hit
|
||||
sta $dc00
|
||||
lda $dc01
|
||||
cmp #%11111011
|
||||
bne checkIsDown
|
||||
+
|
||||
|
||||
;Joystick Right
|
||||
jsr checkTerrainRight
|
||||
bne +
|
||||
jmp moveFinished
|
||||
+
|
||||
lda MOVEMENT_DELAY
|
||||
sta movementBuffer
|
||||
|
||||
lda mapPosX+1
|
||||
cmp mapPosXMax+1
|
||||
bcc +
|
||||
|
||||
lda mapPosX
|
||||
cmp mapPosXMax
|
||||
bcs +++
|
||||
|
||||
+
|
||||
lda posX
|
||||
cmp #4
|
||||
bcc ++
|
||||
|
||||
inc mapPosX
|
||||
bne +
|
||||
inc mapPosX+1
|
||||
+
|
||||
jsr drawMap
|
||||
jsr setPlayer
|
||||
jsr searchText
|
||||
jmp moveFinished
|
||||
+
|
||||
lda posX
|
||||
cmp #8
|
||||
beq +
|
||||
inc posX
|
||||
jsr setPlayer
|
||||
jsr searchText
|
||||
+
|
||||
jmp moveFinished
|
||||
|
||||
checkIsDown
|
||||
lda #%00000010 ;when joystick down
|
||||
bit $dc00
|
||||
beq +
|
||||
lda #%11111101 ;when key "S" hit
|
||||
sta $dc00
|
||||
lda $dc01
|
||||
cmp #%11011111
|
||||
bne moveFinished
|
||||
+
|
||||
;Joystick Down
|
||||
jsr checkTerrainDown
|
||||
bne +
|
||||
jmp moveFinished
|
||||
+
|
||||
lda MOVEMENT_DELAY
|
||||
sta movementBuffer
|
||||
|
||||
lda mapPosY+1
|
||||
cmp mapPosYMax+1
|
||||
bcc +
|
||||
|
||||
lda mapPosY
|
||||
cmp mapPosYMax
|
||||
bcs +++
|
||||
|
||||
+
|
||||
lda posY
|
||||
cmp #4
|
||||
bcc ++
|
||||
|
||||
inc mapPosY
|
||||
bne +
|
||||
inc mapPosY+1
|
||||
+
|
||||
jsr drawMap
|
||||
jsr setPlayer
|
||||
jsr searchText
|
||||
jmp moveFinished
|
||||
+
|
||||
lda posY
|
||||
cmp #8
|
||||
beq +
|
||||
inc posY
|
||||
jsr setPlayer
|
||||
jsr searchText
|
||||
+
|
||||
jmp moveFinished
|
||||
|
||||
moveFinished
|
||||
|
||||
lda #$FB ;when key "R" hit
|
||||
sta $dc00
|
||||
lda $dc01
|
||||
cmp #$FD
|
||||
bne Free_Raster_Indicator_Key_Pressed
|
||||
lda Raster_Indicator_Key_Pressed
|
||||
bne +
|
||||
lda #1
|
||||
sta Raster_Indicator_Key_Pressed
|
||||
|
||||
;Display raster lines when "R" pressed
|
||||
lda Raster_Indicator
|
||||
eor #1
|
||||
sta Raster_Indicator
|
||||
|
||||
|
||||
lda Raster_Indicator
|
||||
bne +
|
||||
lda #0
|
||||
sta $d020
|
||||
|
||||
jmp +
|
||||
Free_Raster_Indicator_Key_Pressed
|
||||
lda #0
|
||||
sta Raster_Indicator_Key_Pressed
|
||||
|
||||
+
|
||||
|
||||
lda #127 ;Disable keyboard detection
|
||||
sta $dc00
|
||||
|
||||
lda Raster_Indicator
|
||||
beq +
|
||||
lda #0
|
||||
sta $d020
|
||||
+
|
||||
|
||||
pla
|
||||
tay
|
||||
pla
|
||||
tax
|
||||
pla
|
||||
rti
|
87
Platform/C64/src/includes/searchText.asm
Normal file
87
Platform/C64/src/includes/searchText.asm
Normal file
@ -0,0 +1,87 @@
|
||||
|
||||
searchText
|
||||
|
||||
;Clear old text
|
||||
ldy #15
|
||||
lda #0
|
||||
-
|
||||
.for step=0, step<=15, step=step+1
|
||||
sta TEXTPORT_SCREEN_OFFSET+SCREEN_COLOR_RAM + step*40 - 1,y
|
||||
.next
|
||||
dey
|
||||
bne -
|
||||
|
||||
;Search for new one
|
||||
clc
|
||||
lda mapPosX
|
||||
adc posX
|
||||
sta locationX
|
||||
|
||||
lda mapPosX+1
|
||||
adc #0
|
||||
sta locationX+1
|
||||
|
||||
clc
|
||||
lda mapPosY
|
||||
adc posY
|
||||
sta locationY
|
||||
|
||||
lda mapPosY+1
|
||||
adc #0
|
||||
sta locationY+1
|
||||
|
||||
;Get how many text places are available on map in general so we can iterate through them
|
||||
ldx TEXT_HEADER
|
||||
|
||||
lda #<TEXT_POINTERS
|
||||
sta textPointerData_LO
|
||||
lda #>TEXT_POINTERS
|
||||
sta textPointerData_HI
|
||||
|
||||
-
|
||||
ldy #0
|
||||
lda (textPointerData_LO),y
|
||||
cmp locationX
|
||||
bne +
|
||||
|
||||
ldy #1
|
||||
lda (textPointerData_LO),y
|
||||
cmp locationX+1
|
||||
bne +
|
||||
|
||||
ldy #2
|
||||
lda (textPointerData_LO),y
|
||||
cmp locationY
|
||||
bne +
|
||||
|
||||
ldy #3
|
||||
lda (textPointerData_LO),y
|
||||
cmp locationY+1
|
||||
bne +
|
||||
|
||||
ldy #4
|
||||
lda (textPointerData_LO),y
|
||||
tax
|
||||
|
||||
ldy #5
|
||||
lda (textPointerData_LO),y
|
||||
tay
|
||||
|
||||
jsr drawText
|
||||
rts
|
||||
|
||||
+
|
||||
;Text not match location, search for the next one
|
||||
clc
|
||||
lda textPointerData_LO
|
||||
adc #6
|
||||
sta textPointerData_LO
|
||||
|
||||
lda textPointerData_HI
|
||||
adc #0
|
||||
sta textPointerData_HI
|
||||
|
||||
dex
|
||||
bne -
|
||||
|
||||
rts
|
71
Platform/C64/src/includes/tables/drawTileTables.asm
Normal file
71
Platform/C64/src/includes/tables/drawTileTables.asm
Normal file
@ -0,0 +1,71 @@
|
||||
|
||||
tilesBitmapTable_LO
|
||||
.for tileN=0, tileN<=63, tileN=tileN+1
|
||||
.byte <TILES+tileN*32-1
|
||||
.next
|
||||
|
||||
tilesBitmapTable_HI
|
||||
.for tileN=0, tileN<=63, tileN=tileN+1
|
||||
.byte >TILES+tileN*32-1
|
||||
.next
|
||||
|
||||
mapBitmapTable_LO
|
||||
.for tileY=0, tileY<=9*2, tileY=tileY+2
|
||||
.for tileX=0, tileX<=8, tileX=tileX+1
|
||||
.byte <VIEWPORT_BITMAP_OFFSET+SCREEN+tileY*320+tileX*16-1-640
|
||||
.next
|
||||
.next
|
||||
|
||||
mapBitmapTable_HI
|
||||
.for tileY=0, tileY<=9*2, tileY=tileY+2
|
||||
.for tileX=0, tileX<=8, tileX=tileX+1
|
||||
.byte >VIEWPORT_BITMAP_OFFSET+SCREEN+tileY*320+tileX*16-1-640
|
||||
.next
|
||||
.next
|
||||
|
||||
mapBitmapTable2_LO
|
||||
.for tileY=0, tileY<=9*2, tileY=tileY+2
|
||||
.for tileX=0, tileX<=8, tileX=tileX+1
|
||||
.byte <VIEWPORT_BITMAP_OFFSET+SCREEN+tileY*320+tileX*16-1-320-16
|
||||
.next
|
||||
.next
|
||||
|
||||
mapBitmapTable2_HI
|
||||
.for tileY=0, tileY<=9*2, tileY=tileY+2
|
||||
.for tileX=0, tileX<=8, tileX=tileX+1
|
||||
.byte >VIEWPORT_BITMAP_OFFSET+SCREEN+tileY*320+tileX*16-1-320-16
|
||||
.next
|
||||
.next
|
||||
|
||||
screenVideoRamTable_LO
|
||||
.for tileY=0, tileY<=9*2, tileY=tileY+2
|
||||
.for tileX=0, tileX<=8, tileX=tileX+1
|
||||
.byte <VIEWPORT_SCREEN_OFFSET+SCREEN_VIDEO_RAM+tileY*40+tileX*2-80
|
||||
.next
|
||||
.next
|
||||
|
||||
screenVideoRamTable_HI
|
||||
.for tileY=0, tileY<=9*2, tileY=tileY+2
|
||||
.for tileX=0, tileX<=8, tileX=tileX+1
|
||||
.byte >VIEWPORT_SCREEN_OFFSET+SCREEN_VIDEO_RAM+tileY*40+tileX*2-80
|
||||
.next
|
||||
.next
|
||||
|
||||
colorRamTable_LO
|
||||
.for tileY=0, tileY<=9*2, tileY=tileY+2
|
||||
.for tileX=0, tileX<=8, tileX=tileX+1
|
||||
.byte <VIEWPORT_SCREEN_OFFSET+SCREEN_COLOR_RAM+tileY*40+tileX*2-80
|
||||
.next
|
||||
.next
|
||||
|
||||
colorRamTable_HI
|
||||
.for tileY=0, tileY<=9*2, tileY=tileY+1+1
|
||||
.for tileX=0, tileX<=8, tileX=tileX+1
|
||||
.byte >VIEWPORT_SCREEN_OFFSET+SCREEN_COLOR_RAM+tileY*40+tileX*2-80
|
||||
.next
|
||||
.next
|
||||
|
||||
multiplyBy9
|
||||
.for mul=1, mul<=9, mul=mul+1
|
||||
.byte mul*9
|
||||
.next
|
@ -0,0 +1,9 @@
|
||||
playerPosTableX
|
||||
.for l=0, l<=8, l=l+1
|
||||
.byte 38+l*16
|
||||
.next
|
||||
|
||||
playerPosTableY
|
||||
.for l=0, l<=8, l=l+1
|
||||
.byte 74+l*16
|
||||
.next
|
37
Platform/C64/src/includes/tables/textTables.asm
Normal file
37
Platform/C64/src/includes/tables/textTables.asm
Normal file
@ -0,0 +1,37 @@
|
||||
fontsTable_LO
|
||||
.for l=0, l<=60, l=l+1
|
||||
.byte <FONTS+l*8-1
|
||||
.next
|
||||
|
||||
fontsTable_HI
|
||||
.for l=0, l<=60, l=l+1
|
||||
.byte >FONTS+l*8-1
|
||||
.next
|
||||
|
||||
textPortTable_LO
|
||||
.for step=0, step<=13, step=step+1
|
||||
.for l=0, l<=15, l=l+1
|
||||
.byte <TEXTPORT_BITMAP_OFFSET+SCREEN-1+step*320+l*8
|
||||
.next
|
||||
.next
|
||||
|
||||
textPortTable_HI
|
||||
.for step=0, step<=13, step=step+1
|
||||
.for l=0, l<=15, l=l+1
|
||||
.byte >TEXTPORT_BITMAP_OFFSET+SCREEN-1+step*320+l*8
|
||||
.next
|
||||
.next
|
||||
|
||||
textPortColorTable_LO
|
||||
.for step=0, step<=13, step=step+1
|
||||
.for l=0, l<=15, l=l+1
|
||||
.byte <TEXTPORT_SCREEN_OFFSET+SCREEN_COLOR_RAM+step*40+l
|
||||
.next
|
||||
.next
|
||||
|
||||
textPortColorTable_HI
|
||||
.for step=0, step<=13, step=step+1
|
||||
.for l=0, l<=15, l=l+1
|
||||
.byte >TEXTPORT_SCREEN_OFFSET+SCREEN_COLOR_RAM+step*40+l
|
||||
.next
|
||||
.next
|
Loading…
Reference in New Issue
Block a user