2
0
Fork 0

Added project

This commit is contained in:
Willem 2018-11-22 22:14:43 +01:00
parent bd944fa6cd
commit 0c304be6f7
26 changed files with 4271 additions and 0 deletions

56
Makefile Normal file
View file

@ -0,0 +1,56 @@
#
# Single top level makefile
#
rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))
MODULES := $(call rwildcard, src, */0module.mk)
MODULES_LIB := $(call rwildcard, src, */0module.lib.mk)
-include build/make/local.inc.mk
include build/make/env.inc.mk
include $(MODULES_LIB)
include $(MODULES)
.PHONY: all
all:
@echo TODO: All is build.
.PHONY: test
test:
@echo TODO: Testing
.PHONY: clean
clean:
@echo === Cleaning
@test $(PATH_BIN) && $(RM) -r $(PATH_BIN);
define mod_mkdir
@echo === Create module build folder.
$(MKDIR) $(1)
endef
define mod_compile_asm
@echo === Compile module asm.
$(SDASM) $(SDASM_FLAGS) -I$(LIBASM_SRC)/include $(1) $(2)
endef
define mod_link_asm_lib
@echo === Link module asm lib.
$(SDAR) $(SDAR_FLAGS) $(1) $(2)
endef
define mod_link_asm_dos
@echo === Link module asm dos.
$(SDCC) $(SDCC_FLAG_CPU) --no-std-crt0 --code-loc 0x0100 -o $(1) $(2)
endef
#-l$(LIBASM_LINK)
define mod_hex2com
@echo === Convert to binary
cd $(dir $(1)) && $(H2B) -e com $(notdir $(1));
@sha1sum $(2);
@echo === Done $(notdir $(2))
endef

36
build/make/env.inc.mk Normal file
View file

@ -0,0 +1,36 @@
# Fill in all paths
PATH_SRC ?= src
PATH_BIN ?= bin
PATH_HEX2BIN ?= /usr/bin
PATH_SDCC ?= /usr/bin
PATH_CURRENT ?= $(dir $(lastword $(MAKEFILE_LIST)))
# Build tools
H2B ?= $(PATH_HEX2BIN)/hex2bin
SDCC ?= $(PATH_SDCC)/sdcc
SDASM ?= $(PATH_SDCC)/sdasz80
SDAR ?= $(PATH_SDCC)/sdar
SDCC_FLAG_CPU ?= -mz80
SDCC_FLAG_LD ?= --nostdinc
SDASM_FLAGS ?= -g -l -c -o
SDAR_FLAGS ?= -rc
# OS cmds
ifeq ($(OS),Windows_NT)
RM = del /F /Q
RMDIR = -RMDIR /S /Q
MKDIR = -mkdir
ERRIGNORE = 2>NUL || true
SEP=\\
else
RM = rm -rf
RMDIR = rm -rf
MKDIR = mkdir -p
ERRIGNORE = 2>/dev/null
SEP=/
endif
# Remove space after separator
PSEP = $(strip $(SEP))

View file

@ -0,0 +1,9 @@
# Local env included makefile
# This file should be ignored in version control
# note: the ?= is so you can override those again in cmdline.
#
# Change to local installations.
#PATH_SDCC ?= /usr/bin
#PATH_HEX2BIN ?= /usr/bin

14
readme.md Normal file
View file

@ -0,0 +1,14 @@
### TARA
Very raw port of orginal '99 code to sdcc format.
## Running
make clean dist-run
note: requires working openmsx with 8250+ide roms.
## Compile dist
make bin/dist.tar.gz

28
src/dist-run/0module.mk Normal file
View file

@ -0,0 +1,28 @@
DIST_RUN_NAME := dist-run
DIST_RUN_BIN := $(PATH_BIN)/$(DIST_RUN_NAME)
DIST_RUN_SRC := $(PATH_SRC)/$(DIST_RUN_NAME)
DIST_RUN_INC := autoexec.bat COMMAND.COM MSXDOS.SYS
DIST_RUN_INC_BIN := $(patsubst %,$(DIST_RUN_BIN)/%,$(DIST_RUN_INC))
DIST_RUN_INC_SRC := $(patsubst %,$(DIST_RUN_SRC)/%,$(DIST_RUN_INC))
DIST_RUN_DEP_TAR := $(PATH_BIN)/dist.tar.gz
DIST_RUN_DEP := $(DIST_RUN_BIN)/tara.com
$(DIST_RUN_BIN):
$(call mod_mkdir,$(DIST_RUN_BIN))
$(DIST_RUN_BIN)/autoexec.bat: $(DIST_RUN_SRC)/autoexec.bat | $(DIST_RUN_BIN)
unix2dos -n $< $@;
$(DIST_RUN_BIN)/COMMAND.COM: $(DIST_RUN_SRC)/COMMAND.COM | $(DIST_RUN_BIN)
cp $< $@;
$(DIST_RUN_BIN)/MSXDOS.SYS: $(DIST_RUN_SRC)/MSXDOS.SYS | $(DIST_RUN_BIN)
cp $< $@;
$(DIST_RUN_DEP): $(DIST_RUN_DEP_TAR) | $(DIST_RUN_BIN)
cp $(PATH_BIN)/dist/* $(DIST_RUN_BIN);
$(DIST_RUN_NAME): $(DIST_RUN_INC_BIN) $(DIST_RUN_DEP)
openmsx -machine Philips_NMS_8250 -ext video9000 -ext ram4mb -ext ide -diska $(DIST_RUN_BIN);

BIN
src/dist-run/COMMAND.COM Executable file

Binary file not shown.

BIN
src/dist-run/MSXDOS.SYS Executable file

Binary file not shown.

View file

@ -0,0 +1,6 @@
@echo "TARA: Start"
tara
@echo "TARA: Stop"

33
src/dist/0module.mk vendored Normal file
View file

@ -0,0 +1,33 @@
DIST_NAME := dist
DIST_SRC := $(PATH_SRC)/$(DIST_NAME)
DIST_BIN := $(PATH_BIN)/$(DIST_NAME)
DIST_OUT := $(PATH_BIN)/$(DIST_NAME).tar.gz
DIST_INC := ALL.SR8 ASCII.SR8 readme.txt VELD.SR8 VELDBACK.4BP
DIST_INC_BIN := $(patsubst %,$(DIST_BIN)/%,$(DIST_INC))
DIST_INC_SRC := $(patsubst %,$(DIST_SRC)/%,$(DIST_INC))
DIST_TARA_BIN := $(DIST_BIN)/tara.com
DIST_TARA_SRC := $(PATH_BIN)/tara/tara.com
$(DIST_BIN):
$(call mod_mkdir,$(DIST_BIN))
$(DIST_BIN)/ALL.SR8: $(DIST_SRC)/ALL.SR8 | $(DIST_BIN)
cp $< $@;
$(DIST_BIN)/ASCII.SR8: $(DIST_SRC)/ASCII.SR8 | $(DIST_BIN)
cp $< $@;
$(DIST_BIN)/VELD.SR8: $(DIST_SRC)/VELD.SR8 | $(DIST_BIN)
cp $< $@;
$(DIST_BIN)/VELDBACK.4BP: $(DIST_SRC)/VELDBACK.4BP | $(DIST_BIN)
cp $< $@;
$(DIST_BIN)/readme.txt: $(DIST_SRC)/readme.txt | $(DIST_BIN)
cp $< $@;
#$(DIST_INC_BIN): $(DIST_INC_SRC) | $(DIST_BIN)
# cp $< $@;
$(DIST_TARA_BIN): $(DIST_TARA_SRC) | $(DIST_BIN)
cp $< $@;
$(DIST_OUT): $(DIST_INC_BIN) $(DIST_TARA_BIN)
cd $(DIST_BIN) && tar -czvf ../../$(DIST_OUT) *;

BIN
src/dist/ALL.SR8 vendored Normal file

Binary file not shown.

BIN
src/dist/ASCII.SR8 vendored Normal file

Binary file not shown.

BIN
src/dist/TARA6.bmp vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

BIN
src/dist/VELD.SR8 vendored Normal file

Binary file not shown.

BIN
src/dist/VELDBACK.4BP vendored Normal file

Binary file not shown.

4
src/dist/readme.txt vendored Normal file
View file

@ -0,0 +1,4 @@
== Tara: ...
MSX RTS gfx9000 game

20
src/tara/0module.mk Normal file
View file

@ -0,0 +1,20 @@
TARA_NAME := tara
TARA_SRC := $(PATH_SRC)/$(TARA_NAME)
TARA_BIN := $(PATH_BIN)/$(TARA_NAME)
TARA_HEX := $(TARA_BIN)/$(TARA_NAME).hex
TARA_COM := $(TARA_BIN)/$(TARA_NAME).com
TARA_RELS := $(TARA_BIN)/$(TARA_NAME).rel
TARA_CODE := $(TARA_SRC)/$(TARA_NAME).asm
$(TARA_BIN):
$(call mod_mkdir,$(TARA_BIN))
$(TARA_BIN)/%.rel: $(TARA_SRC)/%.asm | $(TARA_BIN)
$(call mod_compile_asm,$@,$<)
$(TARA_HEX): $(TARA_RELS)
$(call mod_link_asm_dos,$(TARA_HEX),$(TARA_RELS))
$(TARA_COM): $(TARA_HEX)
$(call mod_hex2com,$(TARA_HEX),$(TARA_COM))

117
src/tara/ai.asm Normal file
View file

@ -0,0 +1,117 @@
AI:
CALL SELECT_T
CALL ADD_TANK_TS
ALGEMEEN:
EI
HALT
HALT
RET
SELECT_T:
LD A,(KEYS_TAB+7)
BIT 6,A ; SELECT TOETS !!!!
RET NZ
LD HL,#MOVE_SP
CALL TYPE_SP0
LD A,#1
LD (CUR_TYPE_SP0),A
LD HL,#CPYTT
LD DE,#SECECTED_ITEM
SELECT_LP:
LD A,(HL)
OR A
RET Z
; WELK VOLK JE BENT
LD B,A
AND #0b11000000
JR NZ,SELECT_LP_CONT
LD A,B
LD (DE),A
EXX
CALL A_TO_IX
EXX
SET 0,9(IX)
SELECT_LP_CONT:
INC HL
INC DE
JR SELECT_LP
ADD_TANK_TS:
LD A,(KEYS_TAB+8)
BIT 2,A ; INS TOETS !!!!
RET NZ
LD B,#17
LD C,#16
LD A,#3
AND #0b00000111
LD E,A ; TYPE
LD D,#0 ; BLAEU
JP ADD_TANK
ADD_TANK:
PUSH BC
PUSH DE
CALL CALC_ADR
INC HL
LD A,(HL)
POP DE
POP BC
OR A
RET NZ ; KUNNEN WE ER STAAN ???
EXX
LD B,#64
LD C,#0
LD DE,#16
LD IX,#TANK1 ; IS AFHANKELIJK VAN REG "D"
ADD_TANK_LP:
ADD IX,DE
INC C
DEC B
RET Z ; PLEKJE IN TANK_TAB
LD A,7(IX)
OR A
JR NZ,ADD_TANK_LP
LD A,C
EX AF,AF
EXX
SLA E ; PER 2 BYTES
SLA E ; 4
SLA E ; 8
SLA E
SLA E
LD 10(IX),E
LD 0(IX),B
LD 1(IX),C
LD 2(IX),B ; X,Y NOR/DES
LD 3(IX),C
CALL CALC_ADR
INC HL
EX AF,AF
LD (HL),A ; TNK NR IN VELD
LD 7(IX),A ; TNK NR IN TAB
LD A,#255
LD 11(IX),A ; POWER
RET

754
src/tara/build.asm Normal file
View file

@ -0,0 +1,754 @@
ADR:
.dw 0x4000
BUILD:
CALL CAPS_ON
CALL DO_SWAP
CALL BUILD_VELD
CALL TANKS
CALL BULLETS
;CALL MSEL
CALL SETPAGE
CALL CAPS_OFF
LD a,(#BUILD_CNT)
inc a
LD (#BUILD_CNT),a
LD a,(#SEC_OLD)
LD b,a
LD a,(#SEC_CNT)
cp b
JP Z,BUILD_END
LD (#SEC_OLD),a
;LD a,(#INT_TICK)
;cp #1
;JP NZ,BUILD_END
;xor a
;LD (#INT_TICK),a
LD a,(#SEC_CNT)
ADD #'0'
ld e,A
ld c,#_CONOUT
call 5
ld e,#'-'
ld c,#_CONOUT
call 5
LD a,(#BUILD_CNT)
SRL A
SRL A
SRL A
SRL A
ADD #'0'
ld e,A
ld c,#_CONOUT
call 5
LD a,(#BUILD_CNT)
and #0x0F
ADD #'0'
ld e,A
ld c,#_CONOUT
call 5
ld e,#'\n'
ld c,#_CONOUT
call 5
ld e,#'\r'
ld c,#_CONOUT
call 5
;xor a
;LD (#BUILD_CNT),a
BUILD_END:
RET
INT_CNT: .db 50
BUILD_CNT: .db 0
SEC_CNT: .db 0
SEC_OLD: .db 0
MSEL:
LD HL,(MSEL_START_COR)
LD A,L
OR H
RET Z
LD B,#0
LD C,H
SLA H ;X
RL B
LD A,H
LD (M_DX),A
LD A,(PAGE)
OR B
LD (M_DX+1),A
LD A,L
LD (M_DY),A
LD DE,(MOUSEY)
LD A,C
LD BC,#0
SUB D
RL B
LD (M_NX),A
LD A,B
ADD A
ADD A
LD (M_ARG),A
LD HL,#MSEL_LINE
JP DO_CMD
BULLETS:
RET
LD HL,#BULLETS_TAB+4
BULLETS_LP:
LD A,(HL)
INC HL
LD (B_DX),A
LD A,(HL)
INC HL
LD (B_DY),A
LD A,(HL)
INC HL
LD (B_NY),A
LD (B_NX),A
EXX
LD HL,#BULLETS_CP
CALL DO_CMD
EXX
RET
BULLETS_TAB:
.db 7,7,20,20,16,18,0,0,2 ; SX,SY,DX,DY,TX,TY,OFFX,OFFY,TYPE (IN 16 :)
.ds 128*7
TANKS:
LD HL,#CPYTT
LD A,#1
LD (T_SY+1),A ; 256
LD A,#1
LD (T_SX+1),A ; 256
LD A,(PAGE)
LD I,A ;INTERRUPT VECTOR
TANKS_LP:
LD A,(HL)
OR A
RET Z ; EINDE ALLE TANKS GEHAD
LD B,A
LD D,A
AND #0b10000000
LD E,A
LD A,D
AND #0b01000000
SLA A
LD D,A
LD A,B
INC HL
CALL A_TO_IX
LD A,10(IX)
AND #7
ADD A
ADD A
ADD A
ADD A
ADD D
LD (T_SX),A ; richtimg tank
LD A,10(IX)
AND #0xE0
SRL A
ADD E
LD (T_SY),A ; type tank
LD A,#16
LD (T_NX),A
LD (T_NY),A
LD B,4(IX) ; OFFSET'S VAN AUTO'S
LD C,5(IX)
LD A,(VIEW_X)
ADD A
LD D,A
LD A,0(IX)
SUB D
EX DE,HL ; CPYTT IN DE
CP #-1
JP Z,TANKS_LE_OUT ; RAND LINKS ERUIT
OR A
JP Z,TANKS_LE_IN
CP #23
JP Z,TANKS_RI_IN
CP #24
JP Z,TANKS_RI_OUT
CP #16
LD L,A
JR NZ,TANKS_ERR ; EVE SNEL ALS CALL Z,TANKS_ERR (3M)
LD A,B
AND #0x0F
JR Z,TANKS_ERR
BIT 7,4(IX) ; OFFSET = NEG
JR Z,TANKS_ERR
RES 4,L
TANKS_ERR:
LD H,#0
ADD HL,HL ; MOET EVE 16 BIT :)
ADD HL,HL
ADD HL,HL
ADD HL,HL
LD A,L
ADD B ; OFFSET
LD L,A
TANKS_X_CONT:
LD A,I ; PAGE
OR H
LD H,A
LD (T_DX),HL
EX DE,HL
;=====
LD A,(VIEW_Y)
LD D,A
LD A,1(IX)
SUB D
CP #-1
JP Z,TANKS_UP_OUT
OR A
JP Z,TANKS_UP_IN
CP #12
JP Z,TANKS_DO_IN
CP #13
JP Z,TANKS_DO_OUT
ADD A
ADD A
ADD A
ADD A
ADD C ; OFFSET Y
TANKS_Y_CONT:
LD (T_DY),A
EXX
LD HL,#TNK_COPY
CALL DO_CMD
BIT 0,9(IX)
JR Z,TANKS_POWER_READY ; SELECTED
LD HL,(T_DX)
LD (P_DX),HL
LD A,(T_DY)
LD (P_DY),A
LD A,(T_NY)
SRL A
SRL A
OR A
JR Z,TANKS_POWER_READY ; MOET ANDERS !!!!
LD (P_NY),A
LD A,(T_NX)
CP #16
JR NZ,TANKS_POWER_READY ; MOET ANDERS !!!!
LD A,11(IX)
SRL A
SRL A
SRL A
SRL A
OR A
CALL Z,TANKS_POWER_INC
LD (P_NX),A
LD HL,#TNK_POWER
CALL DO_CMD
TANKS_POWER_READY:
EXX
CALL COLOR_BLACK
JP TANKS_LP
TANKS_POWER_INC:
INC A
RET
;=========================
;=========================
TANKS_LE_OUT:
EX DE,HL
BIT 7,A ; OFFSET Y
JP NZ,TANKS_LP ; NEXT TANK
LD A,B
OR A
JP Z,TANKS_LP
EX DE,HL
LD (T_NX),A ; HOEVEEL COPY'EN WIJ
CPL
AND #0x0F
LD B,A
LD A,(T_SX)
ADD B
LD (T_SX),A
LD HL,#0
JP TANKS_X_CONT
TANKS_LE_IN:
LD H,#0
LD L,B
BIT 7,B
JP Z,TANKS_X_CONT ; TNK 2 LEFT
LD A,B
CP #-15
EX DE,HL
JP Z,TANKS_LP
EX DE,HL
AND #0x0F
LD (T_NX),A
CPL
AND #0x0F
LD B,A
LD A,(T_SX)
ADD B
LD (T_SX),A
LD HL,#0
JP TANKS_X_CONT
TANKS_RI_OUT:
EX DE,HL
BIT 7,B ; OFFSET Y
JP Z,TANKS_LP ; NEXT TANK
LD A,B
CP #-1
JP Z,TANKS_LP
EX DE,HL
LD HL,#384
LD A,L
ADD B
LD L,A
LD A,B
CPL
AND #0x0F
LD (T_NX),A ; HOEVEEL COPY'EN WIJ
JP TANKS_X_CONT
TANKS_RI_IN:
LD HL,#368
LD A,L
ADD B
LD L,A
BIT 7,B
JP NZ,TANKS_X_CONT
LD A,B
CP #15
EX DE,HL
JP Z,TANKS_LP
EX DE,HL
CPL
AND #0x0F
LD (T_NX),A
JP TANKS_X_CONT
;----------------------------
TANKS_UP_OUT:
BIT 7,C ; OFFSET Y
JP NZ,TANKS_LP ; NEXT TANK
LD A,C
OR A
JP Z,TANKS_LP
LD (T_NY),A ; HOEVEEL COPY'EN WIJ
CPL
AND #0x0F
LD C,A
LD A,(T_SY)
ADD C
LD (T_SY),A
XOR A
JP TANKS_Y_CONT
TANKS_UP_IN:
XOR A
ADD C
BIT 7,C
JP Z,TANKS_Y_CONT ; TNK 2 LEFT
LD A,C
CP #-15
JP Z,TANKS_LP
AND #0x0F
LD (T_NY),A
CPL
AND #0x0F
LD C,A
LD A,(T_SY)
ADD C
LD (T_SY),A
XOR A
JP TANKS_Y_CONT
TANKS_DO_OUT:
BIT 7,C ; OFFSET Y
JP Z,TANKS_LP ; NEXT TANK
LD A,C
CP #-1
JP Z,TANKS_LP
LD A,C
CPL
AND #0x0F
LD (T_NY),A ; HOEVEEL COPY'EN WIJ
LD A,#208
ADD C
JP TANKS_Y_CONT
TANKS_DO_IN:
LD A,#192
ADD C
BIT 7,C
JP NZ,TANKS_Y_CONT
LD A,C
CP #15
JP Z,TANKS_LP
CPL
AND #0x0F
LD (T_NY),A
LD A,#192
ADD C
JP TANKS_Y_CONT
;---------------------
BUILD_VELD:
LD HL,#0
LD (DY),HL
LD (DX),HL
LD HL,(ADR)
DEC H
DEC H
DEC HL
DEC HL
DEC HL
DEC HL
LD DE,#CPYTT
LD B,#26
LD C,#15
LD A,#-16 ; ????
LD (DY),A
LD A,#1
LD (SY+1),A
LD A,(PAGE)
LD (DX+1),A
BUILD_XY:
LD A,(HL) ; BLACK LAYER
OR A
JP NZ,MAKE_BLACK
LD A,B
CP #26
JP Z,MAKE_TT
CP #1
JP Z,MAKE_TT
LD A,C
CP #15
JP Z,MAKE_TT
CP #1
JP Z,MAKE_TT
INC HL
LD A,(HL) ; VELD
ADD A
ADD A
ADD A
ADD A
LD (SX),A
LD A,(HL)
AND #0b11110000
LD (SY),A ; SY
EXX
B_VDP_WAIT:
IN A,(0x65)
RRCA
JR C,B_VDP_WAIT ; Command ready
DI
LD HL,#DO_COPY
LD A,#32
OUT (0x64),A ; reg nr.
LD B,#21
LD C,#0x63
OTIR
EI
LD HL,(DX)
LD DE,#16
ADD HL,DE
LD (DX),HL
EXX
INC HL
LD A,(HL)
OR A
JR Z,CONT_BUILD
LD (DE),A
INC DE
CONT_BUILD:
INC HL
INC HL
DEC B
JR NZ,BUILD_XY
XOR A
LD (DX),A ; EVE RESETEN
LD A,(DX+1)
AND #2
LD (DX+1),A
LD A,(DY)
ADD #16
LD (DY),A
LD A,C
LD BC,#512-26*4
ADD HL,BC
LD C,A
LD B,#26
DEC C
JR NZ,BUILD_XY
XOR A
LD (DE),A ; LAASTE ENTY
RET
MAKE_TT:
INC HL
INC HL
LD A,(HL)
OR A
JR Z,CONT_BUILD
LD (DE),A
INC DE
JR CONT_BUILD
MAKE_BLACK:
INC HL
INC HL
LD A,B
CP #26
JP Z,CONT_BUILD
CP #1
JP Z,CONT_BUILD
LD A,C
CP #15
JP Z,CONT_BUILD
CP #1
JP Z,CONT_BUILD
LD A,#144
LD (SX),A
XOR A
LD (SY),A
EXX
MAKE_BLACK_WAIT:
IN A,(0x65)
RRCA
JR C,MAKE_BLACK_WAIT ; Command ready
DI
LD HL,#DO_COPY
LD A,#32
OUT (0x64),A ; reg nr.
LD B,#21
LD C,#0x63
OTIR
EI
LD HL,(DX)
LD DE,#16
ADD HL,DE
LD (DX),HL
EXX
JR CONT_BUILD
DO_SWAP:
LD A,(PAGE)
OR A
LD A,#0
LD (PAGE),A
RET NZ ; HIJ WAS 0 EN IS 0
LD A,#2 ; bit 5=x8
LD (PAGE),A
RET
PAGE:
.db 0 ; Y (R.21 BIT6)
SETPAGE:
IN A,(0x65)
AND #64
JR NZ,SETPAGE
SETPAGE_WAIT:
IN A,(0x65)
AND #64
JR Z,SETPAGE_WAIT
LD A,#20
OUT (0x64),A
LD A,(PAGE)
ADD A
ADD A
ADD A
ADD A
ADD A
OUT (0x63),A
RET
BULLETS_CP:
.db 32,21
B_SX: .dw 512+64 ; SX
B_SY: .dw 256+24 ; SY
B_DX: .dw 0 ; DX
B_DY: .dw 0 ; DY
B_NX: .dw 2 ; NX
B_NY: .dw 2 ; NY
.db 0,12 ;0b00011100 ; 0,OPRATIE
.dw 0xFFFF ; COLOR MASK
.db 0,0 ; COLOR
.db 0,0 ;
.db 64 ; OPCODE
TNK_COPY:
.db 32,21
T_SX: .dw 0 ; SX
T_SY: .dw 0 ; SY
T_DX: .dw 0 ; DX
T_DY: .dw 0 ; DY
T_NX: .dw 16 ; NX
T_NY: .dw 16 ; NY
.db 0,0b00011100 ; 0,OPRATIE
.dw 0xFFFF ; COLOR MASK
.db 0,0 ; COLOR
.db 0,0 ;
.db 64 ; OPCODE
DO_COPY:
SX: .dw 0 ; SX
SY: .dw 0 ; SY
DX: .dw 0 ; DX
DY: .dw 0 ; DY
NX: .dw 16 ; NX
NY: .dw 16 ; NY
.db 0,12 ; 0,OPRATIE
.dw 0xFFFF ; COLOR MASK
.db 0,0 ; COLOR
.db 0,0 ;
.db 64 ; OPCODE
TNK_POWER:
.db 32,21
P_SX: .dw 512 ; SX
P_SY: .dw 256+24 ; SY
P_DX: .dw 0 ; DX
P_DY: .dw 0 ; DY
P_NX: .dw 16 ; NX
P_NY: .dw 4 ; NY
.db 0,12 ;0b00011100 ; 0,OPRATIE
.dw 0xFFFF ; COLOR MASK
.db 0,0 ; COLOR
.db 0,0 ;
.db 64 ; OPCODE
MSEL_LINE:
.db 36,17 ; REG 36 , 17 BYTES
M_DX: .dw 145 ; DX
M_DY: .dw 145 ; DY
M_NX: .dw 45 ; NX
M_NY: .dw 45 ; NY
M_ARG: .db 0,12 ; 0,OPRATIE
.dw 0xFFFF ; COLOR MASK
.db 0,0 ; COLOR
.db 0,0 ;
.db 0b10110000 ; OPCODE
CPYTT:
.ds 200
; 1 = TNK NR

233
src/tara/disk.asm Normal file
View file

@ -0,0 +1,233 @@
;---------------------
; D_FIELD : leest het veld in op 0x4000
;-------------------
D_FIELD:
LD HL,#D_FIELD_FIL
CALL GETNAM
CALL OPEN
CALL SETFCB
LD DE,#0x4000
CALL SETDMA
LD HL,#0x8000
CALL READ
JP CLOSE
D_FIELD_SAVE:
LD HL,#D_FIELD_FIL
CALL GETNAM
CALL CREATE
CALL SETFCB
LD DE,#0x4000
CALL SETDMA
LD HL,#0x8000
CALL WRITE
JP CLOSE
SETDMA:
LD C,#D_SETDMA ; DE=ADR
JP DOS
OPEN:
LD DE,#FCB
LD C,#D_OPEN
JP DOS
READ:
LD DE,#FCB
LD C,#D_READ ; HL=NR BYTES
JP DOS
CLOSE:
LD DE,#FCB
LD C,#D_CLOSE
JP DOS
SETFCB:
LD HL,#0x01
LD (FCB+14),HL ; Record length = 1 byte
DEC L
LD (FCB+33),HL
LD (FCB+35),HL ; Current record number = 0
RET
WRITE:
LD DE,#FCB ; HL,NR BYTES
LD C,#D_WRITE
JP DOS
CREATE:
LD DE,#FCB
LD C,#D_CREATE
JP DOS
;---------------------------------------------
; L_GFX : laad gfx in op (BC,DE)-(BC+212,DE+255)
; IN : HL = pionter naar naam
;---------------------------------------------
L_GFX:
PUSH HL
LD HL,#GFX_CMD+2
LD (HL),E
INC HL
LD (HL),D
INC HL
LD (HL),C
INC HL
LD (HL),B
POP HL
CALL GETNAM ; In: HL = file name address (pointe
LD DE,#FCB
LD C,#D_OPEN
CALL BDOS ; Open file
LD HL,#0x01
LD (FCB+14),HL ; Record length = 1 byte
DEC L
LD (FCB+33),HL
LD (FCB+35),HL ; Current record number = 0
LD HL,(FCB+16)
LD (D_BESTLN),HL
LD HL,(FCB+18)
LD (D_BESTLN+2),HL ; Save file-length
LD HL,#GFX_CMD
CALL DO_CMD
EI
D_NEXT_READ:
CALL D_GETLEN ; Block-length 0x4000 or smaller if l
EX DE,HL ; Block-length in HL
PUSH HL
LD DE,#0x4000
LD C,#D_SETDMA
CALL BDOS ; Set DMA-address
POP HL
PUSH HL ; BDOS verandert HL
LD DE,#FCB
LD C,#D_READ
CALL BDOS ; Read current block
POP HL
EX DE,HL ; Block-length in DE
LD HL,#0x4000 ; RAM start address
D_NEXT_ADR:
IN A,(0x65)
RRCA
JR NC,D_READ_RDY ; Command ready
AND #0x40
JR Z,D_NEXT_ADR ; Transfer not ready
LD A,(HL) ; Get byte from main RAM
OUT (0x62),A ; into VRAM
INC HL
DEC DE
LD A,(D_FF)
CP #0
JP Z,D_HEADER
INC HL
DEC DE ; 7 bytes van de header overslaan
INC HL
DEC DE
INC HL
DEC DE
INC HL
DEC DE
INC HL
DEC DE
INC HL
DEC DE
INC HL
DEC DE
LD A,#0
LD (D_FF),A
D_HEADER:
LD A,D
OR E
JR NZ,D_NEXT_ADR ; RAM page not empty yet
LD HL,(D_BESTLN+2)
LD A,H
OR L
JR NZ,D_NEXT_READ ; File not read completely
LD HL,(D_BESTLN)
LD A,H
OR L
JP NZ,D_NEXT_READ ; File not read completely
D_READ_RDY:
LD DE,#FCB
LD C,#D_CLOSE
CALL BDOS ; Close file
LD A,#0x34
LD (D_FF),A
OUT (0x64),A
XOR A
OUT (0x63),A ; Stop command
RET
; Get length of current block to be read
D_GETLEN:
LD DE,#0x4000 ; In: --
LD HL,(D_BESTLN+2) ; Out: DE = block-length
LD A,H ; Cng: AF, DE, HL
OR L ; Mrk: (BESTLN) should contain length
JR NZ,D_LEN_OK ; not read part of file (32 bits
LD HL,(D_BESTLN) ; (BESTLN) will be updated
LD A,H ; Operation: CP HL,DE
CP D ; In: HL = 16 bits value
JP NZ,D_LEN_OK ; DE = 16 bits value
LD A,L ; Out: F = same as with normal CP co
CP E ; Cng: AF
EX DE,HL ; Block-length is smaller than RAMBLK
D_LEN_OK:
LD HL,(D_BESTLN) ; when reaching the end of the file (
OR A
SBC HL,DE ; Decease file-length with block-leng
LD (D_BESTLN),HL
RET NC
LD HL,(D_BESTLN+2)
DEC HL
LD (D_BESTLN+2),HL
RET
; Get file name from file name pointer into FCB
GETNAM:
LD DE,#FCB+1 ; In: HL = file name pointer
LD BC,#0x0B ; Out: A = drive name (0 = def., 1 =
LDIR ; Cng: HL,DE BC,AF
LD A,#0 ; Mrk: FCB contains current file and
LD (FCB),A ; (DRVNAM) must be valid
RET
;---------------------------------------------
; variabelen en tabelen
;---------------------------------------------
FCB:
.ds 48
CURRENT_DRIVE: .db 1
D_BESTLN: .dw 0,0 ; file-length buffer
D_FF: .db 255 ; Fist Fuck ( HEADER OVERSLAN)
GFX_CMD: .db 36,17 ; REG 36 , 17 BYTES
.dw 0 ; DX
.dw 256 ; DY
.dw 256 ; NX
.dw 212 ; NY
.db 0,12 ; 0,OPRATIE
.dw 0xFFFF ; COLOR MASK
.db 0,0 ; COLOR
.db 0,0 ;
.db 16 ; OPCODE

260
src/tara/init.asm Normal file
View file

@ -0,0 +1,260 @@
INIT_DOME:
XOR A ; 2=MIXMODE
OUT (0x6F),A
OUT (0x67),A ; POWER OFF + INT CLK
LD A,#6 ; SETREG
OUT (0x64),A
LD A,#0b10011010 ;ITMAP,XTAL,212DOTS,8BIT
OUT (0x63),A
LD A,#0b00001000 ;0,B,262,?,PAL,INTER,INTERLACE,MODE
OUT (0x63),A
LD A,#0b10000010 ; VRAM,SPRITE,YS,0,0,DREQ,512KB
OUT (0x63),A
LD A,#13
OUT (0x64),A
LD A,#0b01000000 ; 256 COLOR-MODE
OUT (0x63),A
INIT_DOME_W0:
IN A,(0x65)
AND #64
JR NZ,INIT_DOME_W0
INIT_DOME_W1:
IN A,(0x65)
AND #64
JR Z,INIT_DOME_W1
LD A,#17
OUT (0x64),A
XOR A ; LIJN 0 ( MOET OP V-INT)
LD B,#8
INIT_SCR_NUL_LP:
OUT (0x63),A ; ALLES OP 0
DJNZ INIT_SCR_NUL_LP
CALL INIT_PALLET
CALL MSX_DRV
CALL INIT_GRAF
CALL D_FIELD
LD D,#10+192 ; X VIEW PORT
LD E,#10+8 ; Y
CALL CHK_LEMOUSE_RAD
LD HL,#CURSOR_SP
CALL TYPE_SP0
LD HL,#RADAR_SP
CALL TYPE_SP1
LD A,(VIEW_Y)
ADD A,#8
LD C,A
LD A,(VIEW_X)
ADD A,#192
LD B,A
CALL PUTSPRITE1
LD BC,#0x6464
CALL PUTSPRITE0
CALL INIT_RADAR
CALL INIT_MOUSE
LD HL,#INT_DOS
CALL GET_INT
LD HL,#INT_DOME
CALL PUT_INT
LD HL,#0x4000
LD BC,#4096*2
VELD_LOOP1:
LD A,#255
LD (HL),A
INC HL
INC HL
XOR A
LD (HL),A
LD A,B
OR C
JR Z,INIT_TANKS1
INC HL
INC HL
DEC BC
JR VELD_LOOP1
INIT_TANKS1:
EI
LD D,#1
LD IX,#TANK1+16
LD B,#254
INIT_TANK_LOOP:
PUSH BC
LD A,0(IX) ;X
OR A
JR Z,INIT_TANK_LP_CONT
LD B,A
LD C,1(IX) ;Y
PUSH DE
CALL CALC_ADR
POP DE
INC HL
LD (HL),D ;TNK NUM
INIT_TANK_LP_CONT:
INC D
LD BC,#16
ADD IX,BC
POP BC
DJNZ INIT_TANK_LOOP
CALL MAKE_RADAR
RET
;=============
INIT_GRAF:
LD HL,#CLS ; clear screen
CALL DO_CMD
EI
LD HL,#D_VELD ; UNITS
LD BC,#256 ; X
LD DE,#0 ; Y
CALL L_GFX
LD HL,#D_ALL ; UNITS
LD BC,#256 ; X
LD DE,#256 ; Y
CALL L_GFX
LD HL,#D_ASCII
LD BC,#256
LD DE,#512
CALL L_GFX
RET
;--------------------------------
INIT_PALLET:
LD A,#14
OUT (0x64),A
XOR A
OUT (0x63),A ; COLOR #0 ( R 14 )
OUT (0x61),A
OUT (0x61),A
OUT (0x61),A
OUT (0x63),A ; BACK COLOR ( R15 )
LD A,#14
OUT (0x64),A
LD A,#1*4
OUT (0x63),A ; COLOR #1 ( R 14 )
LD A,#0x1F
OUT (0x61),A
OUT (0x61),A
OUT (0x61),A
LD A,#14
OUT (0x64),A
LD A,#2*4
OUT (0x63),A ; COLOR #2 ( R 14 )
LD A,#0x1F
OUT (0x61),A
XOR A
OUT (0x61),A
OUT (0x61),A
LD A,#14
OUT (0x64),A
LD A,#3*4
OUT (0x63),A ; COLOR #3 ( R 14 )
XOR A
OUT (0x61),A
LD A,#0x1F
OUT (0x61),A
XOR A
OUT (0x61),A
LD A,#14
OUT (0x64),A
LD A,#4*4
OUT (0x63),A ; COLOR #4 ( R 14 )
XOR A
OUT (0x61),A
OUT (0x61),A
LD A,#0x1F
OUT (0x61),A
RET
;-------------------------------------------------------------------------------
; INIT
INIT_MOUSE:
LD A,#15
OUT (0xA0),A
IN A,(0xA2)
AND #0x8F
OR #0x30
LD (MOUSE_PORT),A
XOR A
LD (MOUSE_USE),A
LD (MOUSE_OFF),A
LD A,(MSX_TYPE)
CP #3
JR Z,INIT_MOUSE_TR
LD A,#31
LD (MOUSE_WAIT1),A
LD A,#10
LD (MOUSE_WAIT2),A
RET
INIT_MOUSE_TR:
LD A,#31*5
LD (MOUSE_WAIT1),A
LD A,#10*5
LD (MOUSE_WAIT2),A
RET
;------------------
MSX_DRV:
LD HL,#0x002D
LD A,(0xFCC1)
CALL 0x0C
LD (MSX_TYPE),A
XOR A
LD C,#0x19
CALL BDOS
INC A
LD (CURRENT_DRIVE),A
RET
D_VELD: .str "VELD SR8" ; VELD DATA 0-255 => GEEN
D_ALL: .str "ALL SR8"
D_ASCII: .str "ASCII SR8"
D_UNIT: .str "UNIT DAT"
D_FIELD_FIL: .str "VELDBACK4BP" ; NAAM VAN VELD
CLS: .db 36,17 ; REG 36 , 17 BYTES
.dw 0 ; DX
.dw 0 ; DY
.dw 1024 ; NX
.dw 512 ; NY
.db 0,12 ; 0,OPRATIE
.dw 0xFFFF ; COLOR MASK
.db 0,0 ; COLOR
.db 0,0 ;
.db 32 ; OPCODE

270
src/tara/int.asm Normal file
View file

@ -0,0 +1,270 @@
;---------------------------------------------
; in interrupt routine
;---------------------------------------------
I_INTERRUPT:
DI
PUSH AF
IN A,(0x64)
PUSH AF
IN A,(0x99) ; CHK OF INT VAN VDP IS
AND A
JP P,I_NO_INT_V9938
; 50/60 INT TROEP
PUSH BC
PUSH DE
PUSH HL
CALL MOUSE
CALL I_READ_BUTTONS
CALL I_READ_KEYS
LD a,(#INT_CNT)
dec a
JP NZ,I_CNT
LD a,(#SEC_CNT)
inc a
LD (#SEC_CNT),a
LD a,#61
I_CNT:
LD (#INT_CNT),a
POP HL
POP DE
POP BC
I_NO_INT_V9938:
POP AF
OUT (0x64),A
POP AF
EI
RETI
I_READ_KEYS:
IN A,(0xAA)
AND #0xF0
LD C,A
LD B,#11
LD HL,#KEYS_TAB+10
I_READ_KEYS_LP:
LD A,C
DEC B
OR B
INC B
OUT (0xAA),A
LD A,(DE)
IN A,(0xA9)
LD (HL),A
DEC HL
DJNZ I_READ_KEYS_LP
RET
KEYS_TAB: ; BIT : 7 6 5 4 3 2 1 0
.db 0 ; 7 6 5 4 3 2 1 0 0
.db 0 ; ; } { \ = - 9 8 1
.db 0 ; B A ACC / . , ' ' 2
.db 0 ; J I H G F E D C 3
.db 0 ; R Q P O N M L K 4
.db 0 ; Z Y X W V U T S 5
.db 0 ; F3 F2 F1 CODE CAPS GRFH CTRL SHIFT 6 NZ
.db 0 ; RET SEL BS STOP TAB ESC F5 F4 7 Z
.db 0 ; RI DO UP LE DEL INS HOME SPACE 8 Z
.db 0 ; 4 3 2 1 0 / + * 9
.db 0 ; . , - 9 8 7 6 5 10
I_READ_BUTTONS:
XOR A
CALL I_FIR_P1
LD (FIRE_BUTTONS),A
RET
I_FIR_P1:
LD B,A ; A=0 PORT 1 / A=1 PORT 2
LD A,#15
OUT (0xA0),A
NOP
IN A,(0xA2)
DJNZ I_FIR_S1
AND #0xDF
OR #0x4C
JR I_FIR_S2
I_FIR_S1: AND #0xAF
OR #3
I_FIR_S2: OUT (0xA1),A
LD A,#14
OUT (0xA0),A
NOP
IN A,(0xA2)
RET
MOUSE:
; Gebruik spratr om x en y op te slaan !
LD A,(MOUSE_PORT) ; Get mouse port in C
LD C,A
MOUSE1:
LD A,(MOUSE_WAIT1)
LD B,A ; Get Y move
CALL READ_MOUSE
RLCA
RLCA
RLCA
RLCA
LD H,A
CALL READ_MOUSE
OR H
LD H,A
CALL READ_MOUSE ; Get X move
RLCA
RLCA
RLCA
RLCA
LD L,A
CALL READ_MOUSE
OR L
LD C,H ; B = X-move / C = Y-move
LD B,A
LD A,B ; Move -1,-1 ?
INC A
LD H,A
LD A,C
INC A
OR H
JR NZ,MOUSE3
LD A,(MOUSE_USE) ; Check mouse use
OR A
JR NZ,MOUSE2
LD A,(MOUSE_PORT) ; Check other port
XOR #0b01000000
LD (MOUSE_PORT),A
JR KEYBOARD
MOUSE2:
LD A,(MOUSE_OFF) ; na 20 keer -1,-1 is uit
INC A
LD (MOUSE_OFF),A
CP #20
JR C,MOUSE4
XOR A ; Deactivate mouse
LD (MOUSE_USE),A
JR KEYBOARD
MOUSE3: ; Activate mouse / Keep mouse activat
XOR A ; counter op 0
LD (MOUSE_OFF),A
DEC A ; wordt weer gebruikt
LD (MOUSE_USE),A
MOUSE4:
LD A,B ; If mouse is moved then skip keyboar
OR C
JR NZ,CHK_PIJL_BORD ; niet 0,0 dan check
KEYBOARD:
; nog even geen keyboard
RET
CHK_PIJL_BORD: ; In: B=y-coordinaat
LD HL,#MOUSEY
LD A,(HL) ; Y
SUB B
BIT 7,B
JR NZ,CHK_PIJL_BORD_Y1
JR NC,CHK_PIJL_BORD_Y3
XOR A
JR CHK_PIJL_BORD_Y3
CHK_PIJL_BORD_Y1:
JR NC,CHK_PIJL_BORD_Y2
CP #204
JR C,CHK_PIJL_BORD_Y3
CHK_PIJL_BORD_Y2:
LD A,#203
CHK_PIJL_BORD_Y3:
LD (HL),A ; Y
INC HL
LD A,(HL) ; X
SUB C
BIT 7,C
JR NZ,CHK_PIJL_BORD_X1
JR NC,CHK_PIJL_BORD_X3
XOR A
JR CHK_PIJL_BORD_X3
CHK_PIJL_BORD_X1:
JR NC,CHK_PIJL_BORD_X2
CP #249
JR C,CHK_PIJL_BORD_X3
CHK_PIJL_BORD_X2:
LD A,#252
CHK_PIJL_BORD_X3:
LD (HL),A ; X
LD B,A
MOUSE_SPRITE:
IN A,(0x65)
RRCA
JR C,MOUSE_SPRITE ; Command ready
XOR A
OUT (0x64),A
OUT (0x63),A
LD A,#0xFE
OUT (0x63),A
LD A,#0x07
OUT (0x63),A
DEC HL
LD A,(HL)
OUT (0x60),A ; Y
XOR A
OUT (0x60),A
OUT (0x60),A ;BITJE 0=Y8
OUT (0x60),A
LD A,B
SLA A
OUT (0x60),A ; X
LD A,#0
OUT (0x60),A
RL A
OR #0x40
OUT (0x60),A ; X
RET
READ_MOUSE:
LD A,#15
OUT (0xA0),A
LD A,C
OUT (0xA1),A
XOR #0b00110000
LD C,A
LD A,#14
OUT (0xA0),A
READ_MOUSE_L:
DJNZ READ_MOUSE_L
LD A,(MOUSE_WAIT2)
LD B,A
IN A,(0xA2)
AND #0x0F
RET

727
src/tara/mouse.asm Normal file
View file

@ -0,0 +1,727 @@
CHK_MAIN_LEFT:
.db 0,0,24*8,13*16
.dw CHK_LEMOUSE_SCR
.db 192,7,255,64+7
.dw CHK_LEMOUSE_RAD
.db 24*8,7*16,255,212
.dw CHK_LEMOUSE_MENU
CHK_MAIN_RIGHT:
.db 0,0,24*8,13*16
.dw CHK_RIMOUSE_SCR
.db 192,7,255,64+7
.dw CHK_RIMOUSE_RAD
.db 24*8,7*16,255,212
.dw CHK_RIMOUSE_MENU
CHK_MOUSE_LEFT:
LD DE,(MOUSEY)
LD HL,#CHK_MAIN_LEFT
LD B,#3
JP CHK_BUTTON
CHK_MOUSE_RIGHT:
LD DE,(MOUSEY)
LD HL,#CHK_MAIN_RIGHT
LD B,#3
JP CHK_BUTTON
;=;;=;;========================================================
CHK_LEMOUSE_SCR:
LD HL,(ADR)
INC HL ;2VELD LAYER
INC HL ;2TNK LAYER
LD A,E ; E=Y
SRL A
SRL A
SRL A
LD B,A
AND #0xFE
ADD H
LD H,A
LD A,D
SRL A
LD C,A
AND #0x7C
LD E,A
LD D,#0
ADD HL,DE
LD A,(HL)
OR A
JR NZ,CHK_LEMOUSE_TNK ; TOT HIER IS HET GOED !!!
;LD A,(SECECTED_ITEM)
;OR A
;JP Z,CHK_MMSEL
SRL B
LD A,(VIEW_Y)
ADD A,B
LD E,A
SRL C
SRL C
LD A,(VIEW_X)
SLA A
ADD A,C
LD D,A
LD B,#64
LD IY,#MSEL_COR_TAB
LD HL,#SECECTED_ITEM
CHK_LEMOUSE_MOVE_LP:
DEC B
LD A,B
OR A
RET Z
LD A,(HL)
INC HL
OR A
JR Z,CHK_LEMOUSE_MOVE_LP
EXX
CALL A_TO_IX
EXX
LD A,D
ADD 0(IY)
LD 2(IX),A
LD A,E
ADD 1(IY)
LD 3(IX),A ; MOVE TANK
INC IY
INC IY
JR CHK_LEMOUSE_MOVE_LP
;==========
CHK_LEMOUSE_TNK:
LD C,A
LD A,(KEYS_TAB+6); CHK OP SHIFT
LD B,#64
LD HL,#SECECTED_ITEM-1
BIT 0,A
JR NZ,CHK_LEMOUSE_TNK_SEL
LD A,C
AND #0b11000000
RET NZ ; GEEN EIGEN COLOR
CHK_LEMOUSE_TNK_LP:
INC HL
DEC B ; MET SHIFT
LD A,B
OR A
RET Z ; GEEN PLEK IN DE TAB
LD A,(HL)
CP C
JR Z,CHK_LEMOUSE_TNK_DIMUL ; DIT BEN IK ZELF
OR A
JR NZ,CHK_LEMOUSE_TNK_LP
LD (HL),C
JR CHK_LEMOUSE_TNK_MUL ; FOUND MYSELF A PLACE
; MET SHIFT OFTEWIJL MUTILBLE
CHK_LEMOUSE_TNK_SEL:
LD A,C ; NIEUWE TNK
AND #0b11000000
JP NZ,CHK_LEMOUSE_TNK_ATT
CHK_LEMOUSE_TNK_SEL_LP:
DEC B
LD A,B
OR A
JR Z,CHK_LEMOUSE_TNK_SEL_END ; LEEG
LD A,(HL)
LD (HL),#0
INC HL
OR A
JR Z,CHK_LEMOUSE_TNK_SEL_LP
EXX
CALL A_TO_IX
EXX
RES 0,9(IX) ; DESELTED ALL TANKS
JR CHK_LEMOUSE_TNK_SEL
CHK_LEMOUSE_TNK_SEL_END:
LD A,C
LD (SECECTED_ITEM),A ; NIEUWE TANK !!
CHK_LEMOUSE_TNK_MUL:
LD A,C
CALL A_TO_IX
SET 0,9(IX)
LD HL,#MOVE_SP
CALL TYPE_SP0
LD A,#1
LD (CUR_TYPE_SP0),A
CALL COLOR_WHITE
EI
HALT
HALT
HALT
CALL COLOR_BLACK
RET
;---
CHK_LEMOUSE_TNK_ATT:
DEC B
LD A,B
OR A
RET Z
LD A,(HL)
INC HL
OR A
JR Z,CHK_LEMOUSE_TNK_ATT
EXX
CALL A_TO_IX
EXX
LD 8(IX),C ; QUAKE NR ( DE LUL )
SET 7,9(IX) ; ATT ALL TANKS
JR CHK_LEMOUSE_TNK_SEL
CHK_LEMOUSE_TNK_DIMUL: ; TANKS DESELSECTEN MET SHIFT
EXX
CALL A_TO_IX
EXX
BIT 0,9(IX)
RET Z
LD (HL),#0
RES 0,9(IX)
RET
MSEL_START_COR:
.db 0,0
CHK_MMSEL:
LD DE,(MOUSEY)
LD (MSEL_START_COR),DE
RET
NOP ;
SECECTED_ITEM:
.ds 64 ; MSEL LIJN
CHK_LEMOUSE_RAD:
LD HL,#0x4000
LD A,D ; X
SUB #192
CP #51
JR C,CHK_LEMOUSE_RAD_X
LD A,#51 ;52
CHK_LEMOUSE_RAD_X:
LD D,A
LD (VIEW_X),A
LD B,#0
SLA A
SLA A
SLA A
RL B
LD C,A
ADD HL,BC
LD A,D
ADD A,#192
LD B,A
LD A,E
SUB #7
CP #64-14
JR C,CHK_LEMOUSE_RAD_Y
LD A,#64-14
CHK_LEMOUSE_RAD_Y:
LD (VIEW_Y),A
LD D,A
SLA D
LD E,#0
ADD HL,DE
LD (ADR),HL
ADD A,#8
LD C,A
JP PUTSPRITE1
CHK_LEMOUSE_MENU:
LD A,(FIRE_BUTTONS)
BIT 5,A
RET NZ
JP EXIT_DOME
CHK_RIMOUSE_SCR:
XOR A
LD (CUR_TYPE_SP0),A
LD (MSEL_START_COR),A
LD (MSEL_START_COR+1),A
LD HL,#CURSOR_SP
CALL TYPE_SP0
LD B,#64
LD HL,#SECECTED_ITEM
CHK_RIMOUSE_SCR_LP:
DEC B
LD A,B
OR A
RET Z
LD A,(HL)
LD (HL),#0
INC HL
OR A
JR Z,CHK_RIMOUSE_SCR_LP
EXX
CALL A_TO_IX
EXX
RES 0,9(IX)
JR CHK_RIMOUSE_SCR_LP
CHK_RIMOUSE_RAD:
JP A0
CHK_RIMOUSE_MENU:
RET
;===============================================================================
CHK_XY:
LD A,#255
EX AF,AF
LD A,#255 ; MOET SNELLER ( XAND A )??
SCRL:
LD DE,(MOUSEY)
LD A,E
CP #202
JP NC,SCRL_D
CP #2
JP C,SCRL_U
LD A,D
CP #246
JR NC,SCRL_R
CP #2
JP C,SCRL_L
LD A,(KEYS_TAB+8)
BIT 7,A
JR Z,SCRL_R
BIT 6,A
JP Z,SCRL_D
BIT 5,A
JP Z,SCRL_U
BIT 4,A
JR Z,SCRL_L
SCRL_RET:
EX AF,AF
OR A
RET NZ
LD A,(CUR_TYPE_SP0)
LD HL,#CURSOR_SP
OR A
JP Z,TYPE_SP0
LD HL,#MOVE_SP
CP #1
JP Z,TYPE_SP0
CALL COLOR_WHITE
HALT
HALT
HALT
HALT
HALT
HALT
HALT
HALT
RET
SCRL_R:
LD A,(VIEW_X)
CP #52
JR Z,SCRL_RET
INC A
LD (VIEW_X),A
ADD A,#192
LD B,A
LD A,(VIEW_Y)
ADD A,#8
LD C,A
CALL PUTSPRITE1
LD HL,#RIGHT_SP
CALL TYPE_SP0
LD HL,#0
LD (MSEL_START_COR),HL
LD HL,(ADR)
LD B,#0
LD C,#8
ADD HL,BC
LD (ADR),HL
CALL BUILD
XOR A
EX AF,AF
JP SCRL
SCRL_L:
LD A,(VIEW_X)
CP #1
JP Z,SCRL_RET
DEC A
LD (VIEW_X),A
ADD A,#192
LD B,A
LD A,(VIEW_Y)
ADD A,#8
LD C,A
CALL PUTSPRITE1
LD HL,#LEFT_SP
CALL TYPE_SP0
LD HL,#0
LD (MSEL_START_COR),HL
LD HL,(ADR)
LD B,#0
LD C,#8
XOR A
SBC HL,BC
LD (ADR),HL
CALL BUILD
XOR A
EX AF,AF
JP SCRL
SCRL_D:
LD A,(VIEW_Y)
CP #63-13 ;???
JP Z,SCRL_RET
INC A
LD (VIEW_Y),A
ADD A,#8
LD C,A
LD A,(VIEW_X)
ADD A,#192
LD B,A
CALL PUTSPRITE1
LD HL,#DOWN_SP
CALL TYPE_SP0
LD HL,#0
LD (MSEL_START_COR),HL
LD HL,(ADR)
INC H
INC H
LD (ADR),HL
CALL BUILD
XOR A
EX AF,AF
JP SCRL
SCRL_U:
LD A,(VIEW_Y)
CP #1 ;???
JP Z,SCRL_RET
DEC A
LD (VIEW_Y),A
ADD A,#8
LD C,A
LD A,(VIEW_X)
ADD A,#192
LD B,A
CALL PUTSPRITE1
LD HL,#UP_SP
CALL TYPE_SP0
LD HL,#0
LD (MSEL_START_COR),HL
LD HL,(ADR)
DEC H
DEC H
LD (ADR),HL
CALL BUILD
XOR A
EX AF,AF
JP SCRL
FIRE_BUTTONS: .db 0
EXIT_STACK: .dw 0
MSX_TYPE: .db 0
CUR_TYPE_SP0: .db 0
INT_DOME: .dw I_INTERRUPT
INT_DOS: .dw 0 ; DEZE WORDT INGEVULD
MOUSE_OFF: .db 0
MOUSE_USE: .db 0
MOUSE_PORT: .db 0
MOUSE_WAIT1: .db 0
MOUSE_WAIT2: .db 0
MOUSEY: .db 40 ; Raad eens !
MOUSEX: .db 40 ; X coor. van cursor/muis
VIEW_X: .db 0
VIEW_Y: .db 0
CURSOR_SP:
.db 0b11111111,0,0,0 ; MAX 32 * 32 PUNTJES
.db 0b10000001,0,0,0
.db 0b10000010,0,0,0
.db 0b10000100,0,0,0
.db 0b10001000,0,0,0
.db 0b10010000,0,0,0
.db 0b10100000,0,0,0
.db 0b11000000,0,0,0
LEFT_SP:
.db 0b00010000,0,0,0
.db 0b00110000,0,0,0
.db 0b01110000,0,0,0
.db 0b11111111,0,0,0
.db 0b11111111,0,0,0
.db 0b01110000,0,0,0
.db 0b00110000,0,0,0
.db 0b00010000,0,0,0
RIGHT_SP:
.db 0b00001000,0,0,0
.db 0b00001100,0,0,0
.db 0b00001110,0,0,0
.db 0b11111111,0,0,0
.db 0b11111111,0,0,0
.db 0b00001110,0,0,0
.db 0b00001100,0,0,0
.db 0b00001000,0,0,0
UP_SP:
.db 0b00011000,0,0,0
.db 0b00111100,0,0,0
.db 0b01111110,0,0,0
.db 0b11111111,0,0,0
.db 0b00011000,0,0,0
.db 0b00011000,0,0,0
.db 0b00011000,0,0,0
.db 0b00011000,0,0,0
DOWN_SP:
.db 0b00011000,0,0,0
.db 0b00011000,0,0,0
.db 0b00011000,0,0,0
.db 0b00011000,0,0,0
.db 0b11111111,0,0,0
.db 0b01111110,0,0,0
.db 0b00111100,0,0,0
.db 0b00011000,0,0,0
MOVE_SP:
.db 0b00111100,0,0,0
.db 0b01000010,0,0,0
.db 0b10000001,0,0,0
.db 0b10011001,0,0,0
.db 0b10011001,0,0,0
.db 0b10000001,0,0,0
.db 0b01000010,0,0,0
.db 0b00111100,0,0,0
MSEL_COR_TAB:
.db 0,0,1,0,0,1,1,1,2,0,2,1,0,2,1,2
.db 2,2,3,0,3,1,3,2,0,3,1,3,2,3,3,3
.db 4,0,4,1,4,2,4,3,0,4,1,4,2,4,3,4
.db 4,4,5,0,5,1,5,2,5,3,5,4,0,5,1,5
.db 2,5,3,5,4,5,5,5,6,0,6,1,6,2,6,3
.db 6,4,6,5,0,6,1,6,2,6,3,6,4,6,5,6
.db 6,6,7,0,7,1,7,2,7,3,7,4,7,5,7,6
.db 0,7,1,7,2,7,3,7,4,7,5,7,6,7,7,7
.db 8,0,8,1,8,2,8,3,8,4,8,5,8,6,8,7
.db 0,8,1,8,2,8,3,8,4,8,5,8,6,8,7,8,8,8
RADAR_SP:
.db 0b11111111,0b11111111,255,0
.db 0b10000000,0b00000000,1,0
.db 0b10000000,0b00000000,1,0
.db 0b10000000,0b00000000,1,0
.db 0b10000000,0b00000000,1,0
.db 0b10000000,0b00000000,1,0
.db 0b10000000,0b00000000,1,0
.db 0b10000000,0b00000000,1,0
.db 0b10000000,0b00000000,1,0
.db 0b10000000,0b00000000,1,0
.db 0b10000000,0b00000000,1,0
.db 0b10000000,0b00000000,1,0 ; MAX 32 * 32 PUNTJES
.db 0b11111111,0b11111111,255,0
SP0_CMD: .db 36,17 ; REG 36 , 17 BYTES
.dw 768 ; DX
.dw 1023 ; DY
.dw 32 ; NX
.dw 1 ; NY
.db 0,12 ; 0,OPRATIE
.dw 0xFFFF ; COLOR MASK
.db 0,0 ; COLOR
.db 0,0 ;
.db 16 ; OPCODE
SP1_CMD: .db 36,17 ; REG 36 , 17 BYTES
.dw 896 ; DX
.dw 1023 ; DY
.dw 52 ; NX
.dw 1 ; NY
.db 0,12 ; 0,OPRATIE
.dw 0xFFFF ; COLOR MASK
.db 0,0 ; COLOR
.db 0,0 ;
.db 16 ; OPCODE
; DIT IS CODE OM JE SCREERM MEE TE BEKIJKEN
A0:
IN A,(0x65)
AND #64
JR NZ,A0
A1:
IN A,(0x65)
AND #64
JR Z,A1
LD A,#18
OUT (0x64),A
LD A,#1
OUT (0x63),A
XOR A
OUT (0x63),A
LD A,(SELECT-1)
LD B,A
AND #0xF0
LD C,A
LD A,B
SLA A
SLA A
SLA A
AND #0x78
LD B,A
INC C
CALL PUTSPRITE1
EI
HALT
HALT
HALT
HALT
CALL SELECT
A2:
IN A,(0x65)
AND #64
JR NZ,A2
A3:
IN A,(0x65)
AND #64
JR Z,A3
LD A,#18
OUT (0x64),A
XOR A
OUT (0x63),A
LD A,(PAGE)
OUT (0x63),A
LD A,(VIEW_Y)
LD C,A
LD A,(VIEW_X)
ADD A,#192
LD B,A
CALL PUTSPRITE1
EI
HALT
HALT
HALT
HALT
HALT
HALT
LD A,#255
LD (FIRE_BUTTONS),A
RET
.db 0
SELECT:
EI
HALT
LD A,(FIRE_BUTTONS)
BIT 5,A
RET Z
BIT 4,A
JR NZ,SELECT
LD DE,(MOUSEY) ; E=Y
LD A,D
SRL A
SRL A
SRL A
AND #0b00001111
LD B,A
LD A,E
AND #0xF0
OR B
LD (SELECT-1),A
LD A,D
AND #0x78 ; DON'Y USE HISTET BIT X>256
LD B,A
LD A,E
AND #0xF0
LD C,A
INC C
CALL PUTSPRITE1
JR SELECT

339
src/tara/subs.asm Normal file
View file

@ -0,0 +1,339 @@
;===============================================================================
; SUB'S
;===============================================================================
; SUB'S
;===============================================================================
; EN SUB'S
;===============================================================================
; B=X
; C=Y
CALC_ADR:
XOR A
LD HL,#0x4000+1
SLA B
RLA
SLA B ; *4
RLA
LD E,B
LD D,A ; c'S IN D
ADD HL,DE
SLA C ; *2
LD D,C ; *256
LD E,#0
ADD HL,DE
RET
A_TO_IX:
LD IX,#TANK1
RRCA
RRCA
RRCA
RRCA
LD C,A
AND #0x0F
LD B,A
LD A,C
AND #0xF0
LD C,A
ADD IX,BC
RET
A_TO_IY:
LD IY,#TANK1
RRCA
RRCA
RRCA
RRCA
LD C,A
AND #0x0F
LD B,A
LD A,C
AND #0xF0
LD C,A
ADD IY,BC
RET
TNK_TO_IY:
LD IY,#TANK_TAB
SRL A
SRL A
AND #0b00111000
LD C,A
LD B,#0
ADD IY,BC
RET
;=== B:HOEVEEL MENU'S ==HL:WAAR BEGINNEN WE==DE:X,Y
CHK_BUTTON:
LD A,D ; X
CP (HL)
INC HL
JR C,CHK_BUTTON_2
LD A,E ; Y
CP (HL)
INC HL
JR C,CHK_BUTTON_3
LD A,D ; X
CP (HL)
INC HL
JR NC,CHK_BUTTON_4
LD A,E ; Y
CP (HL)
INC HL
JR NC,CHK_BUTTON_5
LD A,(HL)
INC HL
LD H,(HL)
LD L,A
JP (HL) ; Gevonden dus JP (HL)
CHK_BUTTON_2:
INC HL
CHK_BUTTON_3:
INC HL
CHK_BUTTON_4:
INC HL
CHK_BUTTON_5:
INC HL
INC HL
DJNZ CHK_BUTTON
RET
;---------------------------------------------
;
;---------------------------------------------
TYPE_SP0:
CALL CAPS_ON
PUSH HL
LD HL,#SP0_CMD
CALL DO_CMD
POP HL
TYPE_SP0_2:
IN A,(0x65)
RRCA
JR NC,TYPE_SP0_3 ; Command ready
AND #0x40
JR Z,TYPE_SP0_2 ; Transfer not ready
LD A,(HL) ; Get byte from main RAM
OUT (0x62),A ; into VRAM
INC HL
JR TYPE_SP0_2
TYPE_SP0_3:
EI
CALL CAPS_OFF
RET
;---------------------------------------------
; sprite vormpje
;---------------------------------------------
TYPE_SP1:
PUSH HL
LD HL,#SP1_CMD
CALL DO_CMD
POP HL
TYPE_SP1_2:
IN A,(0x65)
RRCA
JR NC,TYPE_SP1_3 ; Command ready
AND #0x40
JR Z,TYPE_SP1_2 ; Transfer not ready
LD A,(HL) ; Get byte from main RAM
OUT (0x62),A ; into VRAM
INC HL
JR TYPE_SP1_2
TYPE_SP1_3:
EI
RET
;---------------------------------------------
; PUTSPRITE0 : BC= X,Y
;---------------------------------------------
PUTSPRITE0:
IN A,(0x65)
RRCA
JP C,PUTSPRITE0 ; Command ready
DI
XOR A
OUT (0x64),A
OUT (0x63),A
LD A,#0xFE
OUT (0x63),A
LD A,#0x07
OUT (0x63),A
LD A,C
DEC A ; SCHOONHEIDS FOUTJE GFX9000
OUT (0x60),A ; Y
XOR A
OUT (0x60),A
OUT (0x60),A ;BITJE 0=Y8
OUT (0x60),A
LD A,B
SLA A
OUT (0x60),A ; X
XOR A
OUT (0x60),A
RL A
OR #0x40
OUT (0x60),A ; X
EI
RET
;---------------------------------------------
; H_PUTSPRITE1 : BC= X,Y
;---------------------------------------------
PUTSPRITE1:
DI
XOR A
OUT (0x64),A
LD A,#0x08
OUT (0x63),A
LD A,#0xFE
OUT (0x63),A
LD A,#0x07
OUT (0x63),A
LD A,C
DEC A ; FOUTJE GFX9000
OUT (0x60),A ; Y
XOR A
OUT (0x60),A
OUT (0x60),A ;BITJE 0=Y8
OUT (0x60),A
LD A,B
SLA A
OUT (0x60),A ; X
LD A,#0
OUT (0x60),A
RL A
OR #0x40
OUT (0x60),A ; X
EI
RET
;---------------------------------------------
; DO_CMD : commandows sturen naar de GFX
; IN: HL= pionter naar tabel die naar GFX gaat
;---------------------------------------------
DO_CMD:
;CALL COLOR_BLAU
DO_CMD1:
IN A,(0x65)
RRCA
JR C,DO_CMD ; wacht op tot cmd is afgelopen
;CALL COLOR_BLACK
DI
LD A,(HL)
OUT (0x64),A ; reg nr.
INC HL
LD B,(HL) ; hoeveel bytes
INC HL
LD C,#0x63
OTIR
EI
RET
COLOR_BLACK:
LD A,#15 ; de border color
OUT (0x64),A
XOR A ; 0*1
OUT (0x63),A ; COLOR #0 ( R 14 )
RET
COLOR_WHITE:
LD A,#15
OUT (0x64),A
LD A,#1*4
OUT (0x63),A ; COLOR #1 ( R 14 )
RET
COLOR_RED:
LD A,#15
OUT (0x64),A
LD A,#2*4
OUT (0x63),A ; COLOR #2 ( R 14 )
RET
COLOR_GREEN:
LD A,#15
OUT (0x64),A
LD A,#3*4
OUT (0x63),A ; COLOR #3 ( R 14 )
RET
COLOR_BLAU:
LD A,#15
OUT (0x64),A
LD A,#4*4
OUT (0x63),A ; COLOR #4 ( R 14 )
RET
CAPS_ON:
IN A,(0xAA)
AND #0xBF
OUT (0xAA),A
RET
CAPS_OFF:
IN A,(0xAA)
OR #0x40
OUT (0xAA),A
RET
;-------------
; BIOS ROUTINS
PUT_INT:
DI
LD DE,#0x38+1
LD A,(HL)
LD (DE),A
INC DE
INC HL
LD A,(HL)
LD (DE),A
RET
GET_INT:
DI
LD DE,#0x38+1
LD A,(DE)
LD (HL),A
INC DE
INC HL
LD A,(DE)
LD (HL),A
RET

130
src/tara/tanktab.asm Normal file
View file

@ -0,0 +1,130 @@
TANK1:
.ds 16 ; TANK 0
.db 30,21
.db 30,22
.db 0,0
.db 0
.db 1
.db 0
.db 0b00000000
; 0
; 0
; 0
; 0 ;
; 0 ; FOLLOW=>ATT NR
; 0 ; MOVE =>DES X,Y
; 0 ; GUARD / HARV HARVEST
; 0 ; ATT =>ATT NR
.db 0b00000000
; 000 ; riching
; 00 ; ??
; 000 ; TYPE TANK
.db 123 ; TANK POWER
.db 0 ; TIMER
.db 0 ; AFWK MOVE
.db 0 ; AI
.db 0 ; AI
;---------------------
.db 31,21 ; X,Y IN 16/16 0 1
.db 31,22 ; X,Y DES 2 3
.db 0,0 ; XYOFFSET/XYWAY 4 5
.db 0 ; OLD RADAR COLOR #6
.db 2 ; TANK NUMBER 7
.db 0 ; ATT NR 8
.db 0b00000000 ; 9
; 0 ; SELECTED
; 0 ;
; 0 ;
; 0 ;
; 0 ; FOLLOW=>ATT NR/RANGE=TIMER
; 0 ; MOVE =>DES X,Y ( RIJ IN OFFSET)
; 0 ; GUARD / HARV HARVEST
; 0 ; ATT =>ATT NR /HAVR IS ONDER ATT
.db 0b00100001 ; 10
; 000 ; RICHTING VAN TANK
; 00 ; ???
; 000 ; TYPE TANK
.db 2 ; TANK POWER 11
.db 0 ; TIMER 12
.db 0 ; AFWK MOVE 13
.db 0 ; AI 14
.db 0 ; AI 15
.db 12,11,12,12
.db 0,0,0,3,0
.db 0b00000000
.db 0b01100000
.db 255,0,0,0,0
.db 13,12,13,13
.db 0,0,0,4,0
.db 0b00000000
.db 0b01000000
.db 198,0,0,0,0
.db 12,12,12,13
.db 0,0,0,5,0
.db 0b00000000
.db 0b11100000
.db 199,0,0,0,0
.db 32,11,32,12
.db 0,0,0,6,0
.db 0b00000000
.db 0b00000000
.db 99,0,0,0,0
.ds 16*(64-6)
;====
.db 33,11,33,12
.db 0,0,0,64,0
.db 0b00000000
.db 0b00000000
.db 99,0,0,0,0
.db 23,11,23,12
.db 0,0,0,65,0
.db 0b00000000
.db 0b00000000
.db 99,0,0,0,0
.ds 16*62
;===
.db 33,12,33,13
.db 0,0,0,128,0
.db 0b00000000
.db 0b00000000
.db 99,0,0,0,0
.db 15,14,15,15
.db 0,0,0,129,0
.db 0b00000000
.db 0b00000000
.db 99,0,0,0,0
.ds 16*62
;===
.db 32,12,32,13
.db 0,0,0,192,0
.db 0b00000000
.db 0b00000000
.db 99,0,0,0,0
.db 13,18,13,19
.db 0,0,0,193,0
.db 0b00000000
.db 0b00000000
.db 99,0,0,0,0
.ds 16*62
; Yes het einde

349
src/tara/tara.asm Normal file
View file

@ -0,0 +1,349 @@
ENASLT .equ 0x24
DOS .equ 0x5
BDOS .equ 0x5
D_OPEN .equ 0x0F
D_SETDMA .equ 0x1A
D_READ .equ 0x27
D_CLOSE .equ 0x10
D_WRITE .equ 0x26
D_CREATE .equ 0x16
_CONOUT .equ 0x02
.area _CODE
;---------------------------------------------
; De echte hoofd routine van DOME
;---------------------------------------------
ST:
LD (EXIT_STACK),SP
;CALL DEMO
;RET
CALL INIT_DOME
EI
HALT
MAIN:
LD A,(FIRE_BUTTONS)
BIT 4,A
CALL Z,CHK_MOUSE_LEFT
LD A,(FIRE_BUTTONS)
BIT 5,A
CALL Z,CHK_MOUSE_RIGHT
LD A,(KEYS_TAB+8)
BIT 0,A
JP Z,EXIT_DOME2
CALL UPDATE_EVENT
JR MAIN
UPDATE_EVENT:
LD A,(EVENT)
INC A
CP #6
JR NZ,UPD2
XOR A
UPD2:
LD (EVENT),A
LD HL,#EVENTHANDLER
SLA A
LD C,A
LD B,#0
ADD HL,BC
LD E,(HL)
INC HL
LD D,(HL)
EX DE,HL
JP (HL)
EVENT:
.db 0
EVENTHANDLER:
.dw BUILD ; GFX
.dw AI
.dw CHK_XY ; GFX
.dw INIT_RADAR ; GFX
.dw UPDATE ; GFX
.dw ALGEMEEN
;---------------------------------------------
; H_EXIT_DOME : terug naar basic op elk moment
;---------------------------------------------
EXIT_DOME:
CALL D_FIELD_SAVE
EXIT_DOME2:
EI
HALT
LD A,#0x10 ; show msx for video9000
OUT (0x6F),A
LD HL,#INT_DOS
CALL PUT_INT
LD SP,(EXIT_STACK) ; stack terug
EI
HALT
HALT
ld e,#':'
ld c,#_CONOUT
call 5
ld e,#')'
ld c,#_CONOUT
call 5
ld e,#'\n'
ld c,#_CONOUT
call 5
ld e,#'\r'
ld c,#_CONOUT
call 5
RET ; ECHT TERUG NAAR DOS
.include "build.asm"
.include "update.asm"
.include "mouse.asm"
.include "ai.asm"
.include "disk.asm"
.include "int.asm"
.include "init.asm"
.include "subs.asm"
.include "tanktab.asm"
DEMO:
XOR A ; 2=MIXMODE
OUT (0x6F),A
OUT (0x67),A ; POWER OFF + INT CLK
LD A,#6 ; SETREG
OUT (0x64),A
LD A,#0b10011010 ;ITMAP,XTAL,212DOTS,8BIT
OUT (0x63),A
LD A,#0b00001000 ;0,B,262,?,PAL,INTER,INTERLACE,MODE
OUT (0x63),A
LD A,#0b10000010 ; VRAM,SPRITE,YS,0,0,DREQ,512KB
OUT (0x63),A
LD A,#13
OUT (0x64),A
LD A,#0b01000000 ; 256 COLOR-MODE
OUT (0x63),A
DEMO1:
IN A,(0x65)
AND #64
JR NZ,DEMO1
DEMO2:
IN A,(0x65)
AND #64
JR Z,DEMO2
LD A,#17
OUT (0x64),A
XOR A ; LIJN 0 ( MOET OP V-INT)
LD B,#8
DEMO3:
OUT (0x63),A ; ALLES OP 0
DJNZ DEMO3
LD HL,#NAM_DEMO
CALL GETNAM
CALL OPEN
LD DE,#0x8000
CALL SETDMA
LD HL,#56
CALL READ ; HEADER
LD HL,#GFX_CMD2
CALL DO_CMD
LD B,#7
DEMO4:
PUSH BC
LD DE,#0x8000
CALL SETDMA
LD HL,#0x3FFF
CALL READ
LD BC,#0x3FFF
LD HL,#0x8000
DEMO5:
LD B,#1
IN A,(0x65)
RRCA
JR NC,DEMO6 ; Command ready
AND #0x40
JR Z,DEMO5 ; Transfer not ready
LD A,(HL) ; Get byte from main RAM
OUT (0x62),A ; into VRAM
INC HL
DEC BC
LD A,B
OR C
JR NZ,DEMO5
DEMO6:
POP BC
DJNZ DEMO4
LD A,#0x34
OUT (0x64),A
XOR A
OUT (0x63),A
CALL CLOSE
EI
HALT
HALT
HALT
HALT
RET
GFX_CMD2:
.db 36,17 ; REG 36 , 17 BYTES
.dw 0 ; DX
.dw 0 ; DY
.dw 512 ; NX
.dw 212 ; NY
.db 0,12 ; 0,OPRATIE
.dw 0xFFFF ; COLOR MASK
.db 0,0 ; COLOR
.db 0,0 ;
.db 16 ; OPCODE
NAM_DEMO:
.str "TARA BMP"
;---------------------------------------------
; H_INIT_RADAR : init radar schermpje
;---------------------------------------------
.db 255
INIT_RADAR:
LD A,(INIT_RADAR-1)
INC A
LD (INIT_RADAR-1),A
OR A
;JR Z,MAKE_RADAR
RET
MAKE_RADAR:
LD HL,#INIT_RAD_CMD
CALL DO_CMD
LD HL,#0x4001 ; GEEN INC HL ???
MAKE_RADAR_LP:
IN A,(0x65)
RRCA
JR NC,MAKE_RADAR_RD ; Command ready
AND #0x40
JR Z,MAKE_RADAR_LP ; Transfer not ready
LD A,(HL) ; Get byte from main RAM
AND #0xF0
CALL MAKE_RADAR_CL
OUT (0x62),A ; into VRAM
INC HL
INC HL
INC HL
INC HL
JR MAKE_RADAR_LP
MAKE_RADAR_RD:
LD HL,#COPY_RADAR
CALL DO_CMD
EI
RET
MAKE_RADAR_CL:
EX DE,HL
LD HL,#MAKE_RADAR_TAB
LD C,A
LD B,#0
ADD HL,BC
LD A,(HL)
EX DE,HL
RET
MAKE_RADAR_TAB:
.db 145
.db 4
.db 9
.db 16
.db 25
.db 36
.db 49
.db 64
.db 81
.db 100
.db 121
.db 144
.db 169
.db 196
.db 225
.db 255
INIT_RAD_CMD:
.db 36,17 ; REG 36 , 17 BYTES
.dw 384 ; DX
.dw 8 ; DY
.dw 128 ; NX
.dw 64 ; NY
.db 0,12 ; 0,OPRATIE
.dw 0xFFFF ; COLOR MASK
.db 0,0 ; COLOR
.db 0,0 ;
.db 16 ; OPCODE
COPY_RADAR:
.db 32,21
.dw 384 ; SX
.dw 8 ; SY
.dw 384+512 ; DX
.dw 8 ; DY
.dw 128 ; NX
.dw 64 ; NY
.db 0,12 ; 0,OPRATIE
.dw 0xFFFF ; COLOR MASK
.db 0,0 ; COLOR
.db 0,0 ;
.db 64 ; OPCODE
TEST_DB:
END:
.area _DATA

886
src/tara/update.asm Normal file
View file

@ -0,0 +1,886 @@
;-=;=;=;=;=;=;=;=P;
.db 254
UPDATE:
LD IX,#TANK1+16
UPDATELOOP:
CALL UPDATE_TANKS
LD DE,#16
ADD IX,DE
LD HL,#UPDATE-1
DEC (HL)
JP NZ,UPDATELOOP
LD A,#254
LD (UPDATE-1),A
RET
UPDATE_TANKS:
LD A,7(IX) ; TNK NR
OR A
RET Z ; GEEN TANK
BIT 5,9(IX)
JP NZ,DO_OFFSET_MOVE
BIT 7,9(IX)
JP NZ,DO_ATT
JP CHECK_MOVE
RET
;------
DO_OFFSET_MOVE:
LD A,10(IX)
CALL TNK_TO_IY
LD C,3(IY)
LD A,4(IX)
OR A
JR Z,DO_Y
BIT 7,A
JR NZ,DO_NEGX
SUB C
SUB C
DO_NEGX:
ADD C
LD 4(IX),A
DO_Y:
LD A,5(IX)
OR A
JR Z,DO_STOP
BIT 7,A
JR NZ,DO_NEGY
SUB C
SUB C
DO_NEGY:
ADD C
LD 5(IX),A
RET
DO_STOP:
LD A,4(IX)
OR A
RET NZ
RES 5,9(IX)
RET
;=========================================================================
DO_ATT:
LD A,8(IX)
CALL A_TO_IY
;LD A,10(IX)
;AND #0b11100000
;SRL A
;SRL A
;LD C,A
;LD B,#0
;LD HL,#TANK_TAB
LD A,0(IY)
DEC A
LD 2(IX),A
LD A,1(IY)
DEC A
LD 3(IX),A
RES 7,9(IX)
RET
;=========================================================================
CHECK_MOVE:
LD BC,#0
LD A,0(IX)
SUB 2(IX)
SLA A
RL B
SRL A
LD D,A ; X NOG RIJDEN
LD A,1(IX)
SUB 3(IX)
SLA A
RL C ; OF RR
SRL A
LD E,A ; Y NOG TE RIJDEN
LD A,D
OR E
JR NZ,DO_MOVE
LD A,R
AND #0b10101111
RET NZ
LD A,R
AND #0b00000001
JR Z,DRAAI_UP
DRAAI_DO:
LD A,10(IX)
AND #7
DEC A
AND #7
LD B,A
LD A,10(IX) ; RONDJES DRAAI'EN
AND #0b11111000
OR B
LD 10(IX),A
RET
DRAAI_UP:
LD A,10(IX)
AND #7
INC A
LD B,A
LD A,10(IX) ; RONDJES DRAAI'EN
AND #0b11111000
OR B
LD 10(IX),A
RET
; DE = X,Y DAT DE TANK NOG MOET RIJDEN
; BC = CARRY POS/NEG
DO_MOVE:
EXX
LD B,0(IX)
LD C,1(IX)
CALL CALC_ADR
PUSH HL
LD A,(HL)
AND #0xF0
CALL MAKE_RADAR_CL
EX AF,AF
EXX
POP HL ; KON NIET SNELLER
LD A,D
OR A
JR Z,CHK_MOVE_Y
LD A,E
OR A
JR Z,CHK_MOVE_X
LD D,H ;TANK ADR
LD E,L
XOR A
OR B
JR NZ,CHK_MOVE_SCHUIN
OR C
JP NZ,CHK_MOVE_POS5
JP CHK_MOVE_POS7
CHK_MOVE_SCHUIN:
XOR A
OR C
JP NZ,CHK_MOVE_POS3
JP CHK_MOVE_POS1
CHK_MOVE_X:
LD D,H ;TNK ADR
LD E,L
XOR A
OR B
JP NZ,CHK_MOVE_POS2
JP CHK_MOVE_POS6
CHK_MOVE_Y:
LD D,H
LD E,L ;TNK ADR
XOR A
OR C
JP NZ,CHK_MOVE_POS4
JP CHK_MOVE_POS0
;=========================================================================
CHK_MOVE_POS0:
CALL CHK_POS0
CALL CHK_POS1
CALL CHK_POS7
LD A,R
BIT 4,A
CALL Z,CHK_MOVE_POSR
CALL CHK_POS2
CALL CHK_POS6
CALL CHK_AFWK
JP TANK_VAST ; TANK VAST
CHK_MOVE_POS1:
CALL CHK_POS1
CALL CHK_POS2
CALL CHK_POS0
LD A,R
BIT 3,A
CALL Z,CHK_MOVE_POSR
CALL CHK_POS3
CALL CHK_POS7
CALL CHK_AFWK
JP TANK_VAST ; TANK VAST
CHK_MOVE_POS2:
CALL CHK_POS2
CALL CHK_POS3
CALL CHK_POS1
LD A,R
BIT 4,A
CALL Z,CHK_MOVE_POSR
CALL CHK_POS4
CALL CHK_POS0
CALL CHK_AFWK
JP TANK_VAST ; TANK VAST
CHK_MOVE_POS3:
CALL CHK_POS3
CALL CHK_POS4
CALL CHK_POS2
LD A,R
BIT 3,A
CALL Z,CHK_MOVE_POSR
CALL CHK_POS5
CALL CHK_POS1
CALL CHK_AFWK
JP TANK_VAST ; TANK VAST
CHK_MOVE_POS4:
CALL CHK_POS4
CALL CHK_POS5
CALL CHK_POS3
LD A,R
BIT 4,A
CALL Z,CHK_MOVE_POSR
CALL CHK_POS6
CALL CHK_POS2
CALL CHK_AFWK
JP TANK_VAST ; TANK VAST
CHK_MOVE_POS5:
CALL CHK_POS5
CALL CHK_POS6
CALL CHK_POS4
LD A,R
BIT 3,A
CALL Z,CHK_MOVE_POSR
CALL CHK_POS7
CALL CHK_POS3
CALL CHK_AFWK
JP TANK_VAST ; TANK VAST
CHK_MOVE_POS6:
CALL CHK_POS6
CALL CHK_POS7
CALL CHK_POS5
LD A,R
BIT 4,A
CALL Z,CHK_MOVE_POSR
CALL CHK_POS0
CALL CHK_POS4
CALL CHK_AFWK
JP TANK_VAST ; TANK VAST
CHK_MOVE_POS7:
CALL CHK_POS7
CALL CHK_POS0
CALL CHK_POS6
LD A,R
BIT 3,A
CALL Z,CHK_MOVE_POSR
CALL CHK_POS1
CALL CHK_POS5
CALL CHK_AFWK
JP TANK_VAST ; TANK VAST
TANK_VAST:
CALL COLOR_BLAU
LD B,0(IX)
LD C,1(IX)
LD 2(IX),B
LD 3(IX),C
RET
CHK_MOVE_POSR:
EXX
POP AF
LD A,R
SLA A
AND #0b00001011
LD D,#0
LD E,A
LD HL,#MOVE_POSR_TAB
ADD HL,DE
LD E,(HL)
INC HL
LD D,(HL)
PUSH DE
EXX
RET
MOVE_POSR_TAB:
.dw CHK_MOVE_POS4
.dw CHK_MOVE_POS3
.dw CHK_MOVE_POS7
.dw CHK_MOVE_POS2
.dw CHK_MOVE_POS6
.dw CHK_MOVE_POS1
.dw CHK_MOVE_POS0
.dw CHK_MOVE_POS5
;=========================================================================
CHK_POS0:
LD H,D ; DE BLIJFT HETZELFDE
LD L,E ; EN VANUIT HL REKEN JE
DEC H
DEC H
LD A,(HL)
CP #80
RET NC ; CHK OP BUILDINGS ENZO
INC HL ; BACK 2 TNK
LD A,(HL) ; CHK OP TNK
OR A
JP Z,DO_MOVE_POS0
RET
CHK_POS1:
LD H,D
LD L,E
DEC H
DEC H
INC HL
INC HL
INC HL
INC HL
LD A,(HL)
CP #80
RET NC ; CHK OP BUILDINGS ENZO
INC HL
LD A,(HL)
OR A
JP Z,DO_MOVE_POS1
RET
CHK_POS2:
LD H,D
LD L,E
INC HL
INC HL
INC HL
INC HL
LD A,(HL)
CP #80
RET NC ; CHK OP BUILDINGS ENZO
INC HL
LD A,(HL)
OR A
JP Z,DO_MOVE_POS2
RET
CHK_POS3:
LD H,D
LD L,E
INC H
INC H
INC HL
INC HL
INC HL
INC HL
LD A,(HL)
CP #80
RET NC ; CHK OP BUILDINGS ENZO
INC HL
LD A,(HL)
OR A
JP Z,DO_MOVE_POS3
RET
CHK_POS4:
LD H,D
LD L,E
INC H
INC H
LD A,(HL)
CP #80
RET NC ; CHK OP BUILDINGS ENZO
INC HL
LD A,(HL)
OR A
JP Z,DO_MOVE_POS4
RET
CHK_POS5:
LD H,D
LD L,E
INC H
INC H
DEC HL
DEC HL
DEC HL
DEC HL
LD A,(HL)
CP #80
RET NC ; CHK OP BUILDINGS ENZO
INC HL
LD A,(HL)
OR A
JP Z,DO_MOVE_POS5
RET
CHK_POS6:
LD H,D
LD L,E
DEC HL
DEC HL
DEC HL
DEC HL
LD A,(HL)
CP #80
RET NC ; CHK OP BUILDINGS ENZO
INC HL
LD A,(HL)
OR A
JP Z,DO_MOVE_POS6
RET
CHK_POS7:
LD H,D
LD L,E
DEC H
DEC H
DEC HL
DEC HL
DEC HL
DEC HL
LD A,(HL)
CP #80
RET NC ; CHK OP BUILDINGS ENZO
INC HL
LD A,(HL)
OR A
JP Z,DO_MOVE_POS7
RET
CHK_AFWK:
RET
;=========================================================================
DO_MOVE_POS0:
INC DE ; TO TNK LAYER
CALL UPDATE_RADAR_ORG
SET 5,9(IX) ; MOVE OP PIXELS
LD A,(DE) ; NR TANK (IS IX+7 MAAR DIT IS SNELLER !!)
LD (HL),A ; ON NEW VLAK
XOR A
LD (DE),A ; RES TANK LAY
DEC 1(IX) ; Y=Y-1
LD 4(IX),A ; OFFSET X=0
LD 5(IX),#15 ; OFFSET Y=15
LD A,10(IX)
AND #0b11111000 ; RICHTING = 0
LD 10(IX),A
CALL UPDATE_RADAR
POP HL ; STACK
DEC DE ; 2 VELD LAY
LD A,(DE)
CP #4
RET NC ; CHK OP OPEN RUIMTE
LD A,#1
LD (DE),A ; PUT TRACKS
RET
DO_MOVE_POS1:
INC DE
CALL UPDATE_RADAR_ORG
SET 5,9(IX)
LD A,(DE)
LD (HL),A
XOR A
LD (DE),A
INC 0(IX)
DEC 1(IX)
LD 4(IX),#-15
LD 5(IX),#15
LD B,#1
LD A,10(IX)
AND #0b11111000
OR B
LD 10(IX),A
CALL UPDATE_RADAR
POP HL
DEC DE
LD A,(DE)
CP #4
RET NC
LD A,#2
LD (DE),A
RET
DO_MOVE_POS2:
INC DE
CALL UPDATE_RADAR_ORG
SET 5,9(IX)
LD A,(DE)
LD (HL),A
XOR A
LD (DE),A
INC 0(IX)
LD 4(IX),#-15
LD 5(IX),#0
LD B,#2
LD A,10(IX)
AND #0b11111000
OR B
LD 10(IX),A
CALL UPDATE_RADAR
POP HL
DEC DE
LD A,(DE)
CP #4
RET NC
LD A,#3
LD (DE),A
RET
DO_MOVE_POS3:
INC DE
CALL UPDATE_RADAR_ORG
SET 5,9(IX)
LD A,(DE)
LD (HL),A
XOR A
LD (DE),A
INC 0(IX)
INC 1(IX)
LD 4(IX),#-15
LD 5(IX),#-15
LD B,#3
LD A,10(IX)
AND #0b11111000
OR B
LD 10(IX),A
CALL UPDATE_RADAR
POP HL
DEC DE
LD A,(DE)
CP #4
RET NC
LD A,#4
LD (DE),A
RET
DO_MOVE_POS4:
INC DE
CALL UPDATE_RADAR_ORG
SET 5,9(IX)
LD A,(DE)
LD (HL),A
XOR A
LD (DE),A
INC 1(IX)
LD 4(IX),#0
LD 5(IX),#-15
LD B,#4
LD A,10(IX)
AND #0b11111000
OR B
LD 10(IX),A
CALL UPDATE_RADAR
POP HL
DEC DE
LD A,(DE)
OR A
RET NZ
INC A
LD (DE),A
RET
DO_MOVE_POS5:
INC DE
CALL UPDATE_RADAR_ORG
SET 5,9(IX)
LD A,(DE)
LD (HL),A
XOR A
LD (DE),A
DEC 0(IX)
INC 1(IX)
LD 4(IX),#15
LD 5(IX),#-15
LD B,#5
LD A,10(IX)
AND #0b11111000
OR B
LD 10(IX),A
CALL UPDATE_RADAR
POP HL
DEC DE
LD A,(DE)
OR A
RET NZ
LD A,#2
LD (DE),A
RET
DO_MOVE_POS6:
INC DE
CALL UPDATE_RADAR_ORG
SET 5,9(IX)
LD A,(DE)
LD (HL),A
XOR A
LD (DE),A
DEC 0(IX)
LD 4(IX),#15
LD 5(IX),#0
LD B,#6
LD A,10(IX)
AND #0b11111000
OR B
LD 10(IX),A
CALL UPDATE_RADAR
POP HL
DEC DE
LD A,(DE)
OR A
RET NZ
LD A,#3
LD (DE),A
RET
DO_MOVE_POS7:
INC DE
CALL UPDATE_RADAR_ORG
SET 5,9(IX)
LD A,(DE)
LD (HL),A
XOR A
LD (DE),A
DEC 0(IX)
DEC 1(IX)
LD 4(IX),#15
LD 5(IX),#15
LD B,#7
LD A,10(IX)
AND #0b11111000
OR B
LD 10(IX),A
CALL UPDATE_RADAR
POP HL
DEC DE
LD A,(DE)
OR A
RET NZ
LD A,#4
LD (DE),A
RET
UPDATE_RADAR_ORG:
LD A,(DE)
AND #0b11000000 ; CHK OP EIGEN KLEUR
RET NZ
EXX
XOR A
LD HL,#0x2180 ; EESTE ADR RADAR
LD D,1(IX) ; *256
LD E,0(IX)
SLA D ; *512
RLA
SLA D ; *1024
RLA
ADD HL,DE ; Y
RLA
SET 7,A ; NO INC
LD B,A
XOR A
DI
OUT (0x64),A
LD A,L
OUT (0x63),A
LD A,H
OUT (0x63),A
LD A,B
OUT (0x63),A
EX AF,AF
OUT (0x60),A
LD C,A
XOR A
OUT (0x64),A
LD A,L
OUT (0x63),A
LD A,H
ADD #2
OUT (0x63),A
LD A,B
OUT (0x63),A
LD A,C
OUT (0x60),A
EI
EXX
RET
UPDATE_RADAR:
LD A,(HL)
AND #0b11000000
RET NZ
EXX
XOR A
LD HL,#0x2180 ; EESTE ADR RADAR
LD D,1(IX) ; *256
LD E,0(IX)
SLA D ; *512
RLA
SLA D ; *1024
RLA
ADD HL,DE ; Y
RLA
SET 7,A ; NO INC
LD B,A
XOR A
DI
OUT (0x64),A
LD A,L
OUT (0x63),A
LD A,H
OUT (0x63),A
LD A,B
OUT (0x63),A
LD A,#255
OUT (0x60),A
XOR A
OUT (0x64),A
LD A,L
OUT (0x63),A
LD A,H
ADD #2
OUT (0x63),A
LD A,B
OUT (0x63),A
LD A,#255
OUT (0x60),A
EI
EXX
PUSH DE
DEC HL
DEC HL
LD A,#5
LD BC,#SEE_RADAR
UPDATE_RADAR_LP:
EX AF,AF
LD A,(BC)
LD E,A
INC BC
LD A,(BC)
LD D,A
INC BC
ADD HL,DE
XOR A
LD (HL),A
SBC HL,DE
EX AF,AF
DEC A
JR NZ,UPDATE_RADAR_LP
POP DE
RET
SEE_RADAR:
.dw 0,4,-4,512,-512
COLOR_TNK_TAB:
.db 8
.db 8+64
.db 8+128
.db 255
TANK_TAB:
.db 0 ; TIMER TRIKE
.db 0 ; SHIELD
.db 0 ; SHOT POWER
.db 5 ; SPEED
.db 0 ; BUILD TIME
.db 0 ; COST
.db 0 ; CAN BE BUILD AFTER BIT xx
.db 0 ; SEE GATE
.db 0 ; TIMER QUAD
.db 0 ; SHIELD
.db 0 ; SHOT POWER
.db 3 ; SPEED
.db 0 ; BUILD TIME
.db 0 ; COST
.db 0 ; CAN BE BUILD AFTER BIT xx
.db 0 ; SEE GATE
.db 0 ; TIMER TANK
.db 0 ; SHIELD
.db 0 ; SHOT POWER
.db 3 ; SPEED
.db 0 ; BUILD TIME
.db 0 ; COST
.db 0 ; CAN BE BUILD AFTER BIT xx
.db 0 ; SEE GATE
.db 0 ; TIMER SIEGE
.db 0 ; SHIELD
.db 0 ; SHOT POWER
.db 1 ; SPEED
.db 0 ; BUILD TIME
.db 0 ; COST
.db 0 ; CAN BE BUILD AFTER BIT xx
.db 0 ; SEE GATE
.db 0 ; TIMER XXXXX
.db 0 ; SHIELD
.db 0 ; SHOT POWER
.db 3 ; SPEED
.db 0 ; BUILD TIME
.db 0 ; COST
.db 0 ; CAN BE BUILD AFTER BIT xx
.db 0 ; SEE GATE
.db 0 ; TIMER XXXXX
.db 0 ; SHIELD
.db 0 ; SHOT POWER
.db 3 ; SPEED
.db 0 ; BUILD TIME
.db 0 ; COST
.db 0 ; CAN BE BUILD AFTER BIT xx
.db 0 ; SEE GATE
.db 0 ; TIMER XXXXXXX
.db 0 ; SHIELD
.db 0 ; SHOT POWER
.db 3 ; SPEED
.db 0 ; BUILD TIME
.db 0 ; COST
.db 0 ; CAN BE BUILD AFTER BIT xx
.db 0 ; SEE GATE
.db 0 ; TIMER HARV
.db 0 ; SHIELD
.db 0 ; SHOT POWER
.db 1 ; SPEED
.db 0 ; BUILD TIME
.db 0 ; COST
.db 0 ; CAN BE BUILD AFTER BIT xx
.db 0 ; SEE GATE