;-------------------------------------- ; DOME ; ; (c) 1997 / 98 / 99 Paragon Productions ; ;-------------------------------------- DOS .equ 0x5 ENASLT .equ 0x24 GET_INT .equ 0x0100 PUT_INT .equ 0x0103 COLOR_WHITE .equ 0x0106 COLOR_BLACK .equ 0x0109 SCREEN_ON .equ 0x010C SCREEN_OFF .equ 0x010F SET_SCREEN0 .equ 0x0112 SET_SCREEN5 .equ 0x0115 SPRITES_ON .equ 0x0118 SPRITES_OFF .equ 0x011B ;PUT_SPRITE .equ 0x011E SET_PAGE .equ 0x0121 GET_TIME .equ 0x0124 PUT_TXT .equ 0x0127 PUT_TXT2 .equ 0x012A INIT_BIOS .equ 0x012D EXIT_ON_ERR .equ 0x0130 LOAD .equ 0x0133 INIT_LIB .equ 0x0136 SAVE .equ 0x0139 PUT_PAGE_FD .equ 0x013C PUT_PAGE_FE .equ 0x013F INIT_REP .equ 0x0142 LOAD_MUS .equ 0x0145 LOAD_SAM .equ 0x0148 ;PLAY .equ 0x014B ;STOP .equ 0x014E FADE .equ 0x0151 NEXT .equ 0x0154 MUS_NR .equ 0x0157 POP_UP_START .equ 0x015A ;PUTBLK .equ 0x015D PUT_COLOR .equ 0x0160 DOME_MENU_CALL .equ 0x0163 RESTORE_MEM .equ 0x0166 INIT_BIOS_MEM .equ 0x0169 RUN_GAME .equ 0x016C ;INT_ROUTINE .equ 0x016F HOOK_ON .equ 0x0172 HOOK_OFF .equ 0x0175 INIT_INT .equ 0x0178 ; last modification date 5-04-99 JIFFY .equ 0xFC9E ; wordt nog gebruikt TANK_DATA .equ 32 ; 32 bytes BUILD_DATA .equ 13 VELD_ADRES .equ 0x4000 TANKTAB .equ 0x2000 TANK1 .equ 0x2000+32 ;adres tank tabel !!!!!!!!!!!!!!!!! TANKRED .equ 0x2000+128*TANK_DATA ;------------- DOME ---------------- kick off !! .area _CODE ; org 0x8000 ST: LD (EXIT_STACK),SP CALL INIT_DUNE2 XOR A LD (EVENT),A MAIN_LOOP: LD A,(FIRE_BUTTONS) BIT 4,A JR NZ,RESET_BUTTON0 CALL Z,CHECK_COOR MAIN_LOOP2: LD A,(FIRE_BUTTONS) BIT 5,A JR NZ,RESET_BUTTON1 CALL Z,CANCELACTION MAIN_LOOP3: ; CALL CHK_SPATIE ; CALL Z,TEST_ADD_TNK ; CALL NZ,SPICE_BOOM LD A,(STOP) OR A JP NZ,EXIT_DUNE2 CALL UPDATE_EVENT JR MAIN_LOOP 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) RESET_BUTTON0: LD HL,#BUT_PRESSED RES 0,(HL) JR MAIN_LOOP2 RESET_BUTTON1: LD HL,#BUT_PRESSED RES 1,(HL) JR MAIN_LOOP3 ;----------------------------------------- INIT_DUNE2: LD A,#0 LD (B_BALK_NR),A LD A,#8 LD (T_BALK_NR),A LD A,#0 LD (B_BALK_TYPE),A CALL INIT_BBAR CALL MMODULE_INIT LD HL,#CPYTT LD B,#79 XOR A LOOP0: LD (HL),A INC HL DJNZ LOOP0 LD (STOP),A LD HL,(ADR) LD BC,#9*256+17*4 ADD HL,BC LD (ADR),HL LD A,#18 LD (OFFSET),A LD A,#10 LD (OFFSET+1),A LD IX,#SPRATR+4 ; radar sprite LD 0(IX),#128+10 LD 1(IX),#193+18 ; even roode cc yard erbij CALL MAKE_RED_BASE CALL FREE_BLW_BASE ; creer gezichtsveld 1e keer ;-------------------- CALL PUT_SPRITE ; radarsprite CALL INIT_RADAR ; maak radar CALL PUT_MONEY ; plaatsmoney CALL CLEAR_ITEM ; maak itemscherm schoon CALL INIT_MOUSE ; start mouse lookup LD HL,#INT_GAME CALL PUT_INT ; PUT ADR DOME-INT HALT ; geef buttons een kans RET ;------------------------------------- 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 HL,#0x002D LD A,#0 ;(0xFCC1) ; SLOT ADR BIOS = 0 CALL 0x0C ; interslot call 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 ;----------------------------------------- EXIT_DUNE2: JP EXIT_ON_ERR RET ;------------------------------------------------- ; check op scrollen randjes ;------------------------------------------------ CHKXY: LD IX,#SPRATR+4 CALL PUT_SPRITE LD D,#4 SCRL: LD A,(MOUSEX) CP #245 JP NC,SCRL_R CP #4 JP C,SCRL_L LD A,(MOUSEY) CP #200 JP NC,SCRL_D CP #4 JP C,SCRL_U LD A,(CURSOR_TYPE) LD (MOUSE_SHAPE),A RET SCRL_R: LD A,#16 LD (MOUSE_SHAPE),A LD HL,#MAXSET LD A,(OFFSET) CP (HL) RET Z INC A LD (OFFSET),A INC 1(IX) LD HL,(ADR) LD B,#0 LD C,D ADD HL,BC LD (ADR),HL CALL BUILD JP CHKXY SCRL_L: LD A,#24 LD (MOUSE_SHAPE),A LD A,(OFFSET) CP #1 RET Z DEC A LD (OFFSET),A DEC 1(IX) LD HL,(ADR) LD B,#0 LD C,D SBC HL,BC LD (ADR),HL CALL BUILD JP CHKXY SCRL_D: LD A,#20 LD (MOUSE_SHAPE),A LD HL,#MAXSET+1 LD A,(OFFSET+1) CP (HL) RET Z INC A LD (OFFSET+1),A INC 0(IX) XOR A LD HL,(ADR) INC H LD (ADR),HL CALL BUILD JP CHKXY SCRL_U: LD A,#12 LD (MOUSE_SHAPE),A LD A,(OFFSET+1) CP #1 RET Z DEC A LD (OFFSET+1),A DEC 0(IX) XOR A LD HL,(ADR) DEC H LD (ADR),HL CALL BUILD JP CHKXY ;---------------- Tabel update !!!---------- CX: .db 0 CY: .db 0 UPDATE: LD IX,#TANK1 UPDATELOOP: LD A,13(IX) OR A CALL NZ,TEST_WAT_NU LD DE,#TANK_DATA ADD IX,DE LD HL,#TOTTANK DEC (HL) JP NZ,UPDATELOOP LD A,#254 LD (TOTTANK),A RET TOTTANK: .db 254 TEST_WAT_NU: BIT 4,11(IX) JP NZ,DO_MOVE CALL IMPACT_GFX BIT 6,11(IX) JP NZ,DO_ATTACK JP CHECK_MOVE RET DO_MOVE: LD A,6(IX) OR A JR Z,UPDATEXY DEC 6(IX) ; verlaag de step byte LD A,4(IX) ; x offset SUB 7(IX) ; x speed eraf LD 4(IX),A LD A,5(IX) SUB 8(IX) ; y speed eraf LD 5(IX),A RET UPDATEXY: LD 4(IX),#0 LD 5(IX),#0 LD 6(IX),#0 LD 7(IX),#0 LD 8(IX),#0 BIT 5,23(IX) ; DIT BIT JE IS GUARD CALL NZ,TNK_CHK ; KIJK EEN RONDJE OM ZICH HEEN CHECK_MOVE: BIT 5,11(IX) CALL NZ,ATT_MOVE ; geen jump ?? WEL DUS !! LD A,15(IX) AND #0b11110000 JP NZ,AFWK_MOVE LD A,0(IX) SUB 2(IX) LD B,A LD A,#0 RL A LD (CX),A LD A,1(IX) SUB 3(IX) LD C,A LD A,#0 RL A LD (CY),A LD A,B OR C JP Z,TURN_ROUND XOR A LD A,0x00(IX) SUB 0x02(IX) JP Z,J82F1 LD A,0x01(IX) SUB 0x03(IX) JP Z,J82E6 LD A,(CX) OR A JR Z,SCHUIN LD A,(CY) OR A JP Z,POSITIE_2 JP POSITIE_4 SCHUIN: LD A,(CY) OR A JP Z,POSITIE_8 JP POSITIE_6 J82E6: LD A,(CX) OR A JP Z,POSITIE_7 JP POSITIE_3 J82F1: LD A,(CY) OR A JP Z,POSITIE_1 JP POSITIE_5 POSITIE_1: LD B,0(IX) LD C,1(IX) CALL CALC_ADR LD D,H LD E,L CALL CHKUP LD A,#1 JP NZ,POS1_KAN CALL CHKUPLT LD A,#1+(8*16) JP NZ,POS8_KAN CALL CHKUPRI LD A,#1+(2*16) JP NZ,POS2_KAN CALL CHKLT LD A,#1+(7*16) JP NZ,POS7_KAN CALL CHKRI LD A,#1+(3*16) JP NZ,POS3_KAN JP TANK_VAST POSITIE_2: LD B,0(IX) LD C,1(IX) CALL CALC_ADR LD D,H LD E,L CALL CHKUPRI LD A,#2 JP NZ,POS2_KAN CALL CHKUP LD A,#2+(1*16) JP NZ,POS1_KAN CALL CHKRI LD A,#2+(3*16) JP NZ,POS3_KAN CALL CHKUPLT LD A,#2+(8*16) JP NZ,POS8_KAN CALL CHKDORI LD A,#2+(4*16) JP NZ,POS4_KAN JP TANK_VAST POSITIE_3: LD B,0(IX) LD C,1(IX) CALL CALC_ADR LD D,H LD E,L CALL CHKRI LD A,#3 JP NZ,POS3_KAN CALL CHKUPRI LD A,#3+(2*16) JP NZ,POS2_KAN CALL CHKDORI LD A,#3+(4*16) JP NZ,POS4_KAN CALL CHKUP LD A,#3+(1*16) JP NZ,POS1_KAN CALL CHKDN LD A,#3+(5*16) JP NZ,POS5_KAN JP TANK_VAST POSITIE_4: LD B,0(IX) LD C,1(IX) CALL CALC_ADR LD D,H LD E,L CALL CHKDORI LD A,#4 JP NZ,POS4_KAN CALL CHKDN LD A,#4+(5*16) JP NZ,POS5_KAN CALL CHKRI LD A,#4+(3*16) JP NZ,POS3_KAN CALL CHKUPRI LD A,#4+(2*16) JP NZ,POS2_KAN CALL CHKDOLT LD A,#4+(6*16) JP NZ,POS6_KAN JP TANK_VAST POSITIE_5: LD B,0(IX) LD C,1(IX) CALL CALC_ADR LD D,H LD E,L CALL CHKDN LD A,#5 JP NZ,POS5_KAN CALL CHKDOLT LD A,#5+(6*16) JP NZ,POS6_KAN CALL CHKDORI LD A,#5+(4*16) JP NZ,POS4_KAN CALL CHKLT LD A,#5+(7*16) JP NZ,POS7_KAN CALL CHKRI LD A,#5+(3*16) JP NZ,POS3_KAN JP TANK_VAST POSITIE_6: LD B,0(IX) LD C,1(IX) CALL CALC_ADR LD D,H LD E,L CALL CHKDOLT LD A,#6 JP NZ,POS6_KAN CALL CHKLT LD A,#6+(7*16) JP NZ,POS7_KAN CALL CHKDN LD A,#6+(5*16) JP NZ,POS5_KAN CALL CHKUPLT LD A,#6+(8*16) JP NZ,POS8_KAN CALL CHKDORI LD A,#6+(4*16) JP NZ,POS4_KAN JP TANK_VAST POSITIE_7: LD B,0(IX) LD C,1(IX) CALL CALC_ADR LD D,H LD E,L CALL CHKLT LD A,#7 JP NZ,POS7_KAN CALL CHKDOLT LD A,#7+(6*16) JP NZ,POS6_KAN CALL CHKUPLT LD A,#7+(8*16) JP NZ,POS8_KAN CALL CHKUP LD A,#7+(1*16) JP NZ,POS1_KAN CALL CHKDN LD A,#7+(5*16) JP NZ,POS5_KAN JP TANK_VAST POSITIE_8: LD B,0(IX) LD C,1(IX) CALL CALC_ADR LD D,H LD E,L CALL CHKUPLT LD A,#8 JP NZ,POS8_KAN CALL CHKUP LD A,#8+(1*16) JP NZ,POS1_KAN CALL CHKLT LD A,#8+(7*16) JP NZ,POS7_KAN CALL CHKUPRI LD A,#8+(2*16) JP NZ,POS2_KAN CALL CHKDOLT LD A,#8+(6*16) JP NZ,POS6_KAN JP TANK_VAST POS1_KAN: LD 15(IX),A POS10KAN: SET 4,0x0B(IX) CALL RES_TANK_LAY DEC H LD (HL),A DEC HL DEC HL LD A,(HL) OR A JR Z,POS10KAN1 LD (HL),B POS10KAN1: LD 0x09(IX),#0 LD A,0x0A(IX) LD 0x07(IX),#0 ; NEG LD 0x08(IX),A ; NEG LD 4(IX),#0 LD 5(IX),#16 DEC 1(IX) ; Y=Y-1 JP SPEED_STEP POS2_KAN: LD 15(IX),A POS20KAN: SET 4,0x0B(IX) CALL RES_TANK_LAY DEC H ; - 256 INC HL INC HL INC HL INC HL ; + 4 LD (HL),A DEC HL DEC HL LD A,(HL) OR A JR Z,POS20KAN1 LD (HL),B POS20KAN1: LD 0x09(IX),#1 LD A,0x0A(IX) NEG LD 0x07(IX),A NEG ; NEG LD 0x08(IX),A ; NEG LD 4(IX),#-16 LD 5(IX),#16 INC 0(IX) ; X=X-1 DEC 1(IX) ; Y = Y -1 JP SPEED_STEP POS3_KAN: LD 15(IX),A POS30KAN: SET 4,0x0B(IX) CALL RES_TANK_LAY INC HL INC HL INC HL INC HL LD (HL),A DEC HL DEC HL LD A,(HL) OR A JR Z,POS30KAN1 LD (HL),B POS30KAN1: LD 0x09(IX),#2 LD A,0x0A(IX) NEG LD 0x07(IX),A NEG LD 0x08(IX),#0 LD 4(IX),#-16 LD 5(IX),#0 INC 0(IX) ; X=X+1 JP SPEED_STEP POS4_KAN: LD 15(IX),A POS40KAN: SET 4,0x0B(IX) CALL RES_TANK_LAY INC HL INC HL INC HL INC HL INC H LD (HL),A DEC HL DEC HL LD A,(HL) OR A JR Z,POS40KAN1 LD (HL),B POS40KAN1: LD 0x09(IX),#3 LD A,0x0A(IX) NEG LD 0x07(IX),A LD 0x08(IX),A NEG LD 4(IX),#-16 LD 5(IX),#-16 INC 0(IX) ; X=X-1 INC 1(IX) ; Y = Y -1 JP SPEED_STEP POS5_KAN: LD 15(IX),A POS50KAN: SET 4,0x0B(IX) CALL RES_TANK_LAY INC H LD (HL),A DEC HL DEC HL LD A,(HL) OR A JR Z,POS50KAN1 LD (HL),B POS50KAN1: LD 0x09(IX),#4 LD A,0x0A(IX) NEG LD 0x08(IX),A NEG LD 0x07(IX),#0 LD 4(IX),#0 LD 5(IX),#-16 INC 1(IX) ; Y = Y + 1 JP SPEED_STEP POS6_KAN: LD 15(IX),A POS60KAN: SET 4,0x0B(IX) CALL RES_TANK_LAY INC H DEC HL DEC HL DEC HL DEC HL LD (HL),A DEC HL DEC HL LD A,(HL) OR A JR Z,POS60KAN1 LD (HL),B POS60KAN1: LD 0x09(IX),#5 LD A,0x0A(IX) ; NEG LD 0x07(IX),A ; NEG NEG LD 0x08(IX),A NEG LD 4(IX),#16 LD 5(IX),#-16 DEC 0(IX) ; X=X-1 INC 1(IX) ; Y = Y -1 JP SPEED_STEP POS7_KAN: LD 15(IX),A POS70KAN: SET 4,0x0B(IX) CALL RES_TANK_LAY DEC HL DEC HL DEC HL DEC HL LD (HL),A DEC HL DEC HL LD A,(HL) OR A JR Z,POS70KAN1 LD (HL),B POS70KAN1: LD 0x09(IX),#6 LD A,0x0A(IX) LD 0x07(IX),A LD 0x08(IX),#0 LD 4(IX),#16 LD 5(IX),#0 DEC 0(IX) ; X=X-1 JP SPEED_STEP POS8_KAN: LD 15(IX),A POS80KAN: SET 4,0x0B(IX) CALL RES_TANK_LAY DEC HL DEC HL DEC HL DEC HL DEC H LD (HL),A DEC HL DEC HL LD A,(HL) OR A JR Z,POS80KAN1 LD (HL),B POS80KAN1: LD 0x09(IX),#7 LD A,0x0A(IX) ; NEG LD 0x07(IX),A LD 0x08(IX),A ; NEG LD 4(IX),#+16 LD 5(IX),#16 DEC 0(IX) ; X=X-1 DEC 1(IX) ; Y = Y -1 JP SPEED_STEP TANK_VAST: LD A,0(IX) ; kan geen kant op !! LD 2(IX),A LD A,1(IX) LD 3(IX),A LD 15(IX),#0 LD 7(IX),#0 LD 8(IX),#0 RET AFWK_MOVE: LD A,15(IX) AND #0b00001111 LD HL,#CHK_TABEL DEC A SLA A SLA A LD C,A LD B,#0 ADD HL,BC PUSH HL LD DE,#DYNACALL+1 LD A,(HL) LD (DE),A INC HL INC DE LD A,(HL) LD (DE),A LD B,0(IX) LD C,1(IX) CALL CALC_ADR CALL DYNACALL POP HL JR Z,J84FB LD 15(IX),#0 INC HL INC HL LD DE,#DYNAJUMP+1 LD A,(HL) LD (DE),A INC DE INC HL LD A,(HL) LD (DE),A JP DYNAJUMP RET J84FB: LD HL,#CHK_TABEL LD A,15(IX) AND #0b11110000 SRL A SRL A SUB #4 LD C,A LD B,#0 ADC HL,BC PUSH HL LD DE,#DYNACALL+1 LD A,(HL) LD (DE),A INC HL INC DE LD A,(HL) LD (DE),A LD B,0(IX) LD C,1(IX) CALL CALC_ADR CALL DYNACALL POP HL JR Z,REVERSE_MOVE INC HL INC HL LD DE,#DYNAJUMP+1 LD A,(HL) LD (DE),A INC DE INC HL LD A,(HL) LD (DE),A JP DYNAJUMP RET REVERSE_MOVE: LD 15(IX),#0 RET DYNACALL: CALL 0x0 RET DYNAJUMP: JP 0x0 CHK_TABEL: .dw CHKUP+2 .dw POS10KAN .dw CHKUPRI+2 .dw POS20KAN .dw CHKRI+2 .dw POS30KAN .dw CHKDORI+2 .dw POS40KAN .dw CHKDN+2 .dw POS50KAN .dw CHKDOLT+2 .dw POS60KAN .dw CHKLT+2 .dw POS70KAN .dw CHKUPLT+2 .dw POS80KAN ATT_MOVE: ; ;attack en doel zoeken BIT 3,11(IX) JP NZ,ATT_MOVE_B ; op 1 is gebouw aanvallen LD A,11(IX) ; type tank AND #0b00000111 SLA A LD HL,#RADARS LD C,A LD B,#0 ADD HL,BC LD E,(HL) INC HL LD D,(HL) EX DE,HL LD A,14(IX) PUSH IX CALL A_TO_IX LD B,0(IX) ; doel enemy LD C,1(IX) ; doel enemy POP IX LD D,0(IX) LD E,1(IX) CHECK_AROUND: LD A,(HL) CP #100 JR Z,END_CHK_RND XOR A LD A,B ADC A,(HL) CP D INC HL JR NZ,J85A0 XOR A LD A,C ADC A,(HL) CP E JR Z,FND_TARGET J85A0: INC HL JP CHECK_AROUND FND_TARGET: LD A,B ; set geattacked coor in ix+20 & 21 LD 20(IX),A LD A,C LD 21(IX),A LD E,(HL) DEC HL LD D,(HL) CALL CALC_RICHT LD A,0(IX) ; set x en y op einde LD 2(IX),A LD A,1(IX) LD 3(IX),A RES 4,11(IX) ; reset move bit RES 5,11(IX) ; reset att move bit SET 6,11(IX) ; set att bit POP AF ; return adres van stack af einde ; ; update subroutine RET END_CHK_RND: ; eindcoordinaat LD 2(IX),B LD 3(IX),C RET ;------------------------------- ; ATTACK GEBOUW ;------------------------------- ATT_MOVE_B: LD A,11(IX) ; type tank AND #0b00000111 SLA A LD HL,#RADARS LD C,A LD B,#0 ADD HL,BC LD E,(HL) INC HL LD D,(HL) EX DE,HL LD B,2(IX) ; doel gebouw LD C,3(IX) ; doel gebouw (loopt echt niet weg !) LD D,0(IX) ; gebouw kan hooguit al kapot zijn! LD E,1(IX) ; huidige coordinaten CHECKAROUND2: LD A,(HL) CP #100 RET Z ;nog niet in zicht dus rij maardoor XOR A LD A,B ADC A,(HL) CP D INC HL JR NZ,CONT_001 XOR A LD A,C ADC A,(HL) CP E JR Z,FND_TAR_BLD CONT_001: INC HL JP CHECKAROUND2 FND_TAR_BLD: CALL COLOR_WHITE LD E,(HL) DEC HL LD D,(HL) CALL CALC_RICHT LD A,0(IX) LD 2(IX),A LD A,1(IX) LD 3(IX),A LD 4(IX),#0 LD 5(IX),#0 RES 5,11(IX) SET 6,11(IX) ; set do_attack bitje RET ;---------------------------------- ; berekend de richting waarheen de tank moet staan ! ;-------------------------------- CALC_RICHT: LD C,#4 LD A,D OR A JR Z,TARGET_XNUL RL A JR C,TARGET_XNEG LD A,E OR A JR Z,TARGET_YNUL RL A JR C,TARGET_YNEG INC C TARGET_YNUL: INC C TARGET_YNEG: INC C JP SET_RICHTING TARGET_XNEG: LD A,E OR A JR Z,TARGET_YNUL2 RL A JR C,TARGET_YNEG2 DEC C TARGET_YNUL2: DEC C TARGET_YNEG2: DEC C JP SET_RICHTING TARGET_XNUL: RL E LD C,#0 JR NC,SET_RICHTING LD C,#4 JP SET_RICHTING SET_RICHTING: LD 9(IX),C ; radar found bitje ook weer op 0 RET ;--------------------------------------- TURN_ROUND: RES 4,11(IX) ; move uit ! LD A,13(IX) CP #127 JR NC,CONT_TURNR BIT 7,9(IX) JR NZ,CONT_TURNR SET 7,9(IX) LD A,11(IX) ; type tank AND #0b00000111 SLA A LD HL,#RADARS LD C,A LD B,#0 ADD HL,BC LD E,(HL) INC HL LD D,(HL) TURN_LOOP: LD A,(DE) CP #100 JR Z,CONT_TURNR ADD 1(IX) LD C,A INC DE LD A,(DE) ADD 0(IX) LD B,A LD (FOG_COOR),BC CALL CALC_ADR DEC HL INC DE LD A,(HL) OR A JR Z,TURN_LOOP PUSH DE LD (HL),#0 ; reveal fog of war INC HL CALL POINT LD D,A ; inhoud adres LD BC,(FOG_COOR) LD A,C LD C,B LD B,A SRL B RR C CALL D_TO_POINT POP DE JR TURN_LOOP FOG_COOR: .dw 0 CONT_TURNR: LD A,11(IX) AND #0b00000111 ; GEEN DRAAI HARV/COUNTER ATT JP Z,AI_HARVB ; DE AI VAN DE BLAUWE HARV BIT 5,23(IX) CALL NZ,TNK_CHK ; GUARD FUNCTIE VOOR ROOD ALLEEN LD A,(TURN_WAIT) DEC A LD (TURN_WAIT),A RET NZ LD A,R AND #0b00001111 LD (TURN_WAIT),A LD A,9(IX) LD B,A LD A,R ;refresh is random ?? AND #0b00000011 ; yes!!! is coool OR A RET Z CP #2 JP Z,T_ROUND_DEC INC B JP Z,UPDATE_TURN T_ROUND_DEC: DEC B UPDATE_TURN: LD A,9(IX) AND #0b10000000 OR B ; fout correctie ! AND #0b10000111 ; radar update bitje meenemen LD 9(IX),A RET TURN_WAIT: .db 10 ;--------------------------------------------- DO_ATTACK: ; attack iets ?? CALL SHOOT_GFX DEC 18(IX) RET NZ BIT 3,11(IX) JP NZ,DO_ATT_BLD LD L,13(IX) ; eigen nummer LD A,19(IX) ; wait time before shot LD 18(IX),A LD A,14(IX) ; nummer van slachtoffer LD (QUAKE),A ; LD H,16(IX) ; power LD E,20(IX) LD D,21(IX) PUSH IX CALL A_TO_IX LD A,4(IX) ; offset is niet 0 !!! OR 5(IX) JR NZ,STOP_ATTACK LD A,0(IX) CP E JR NZ,STOP_ATTACK LD A,1(IX) CP D JR NZ,STOP_ATTACK ; attack kan ! LD A,H SUB 17(IX) ; -shield LD B,A LD A,12(IX) ; power van QUAKE SUB B LD 12(IX),A JR NC,CONT_ATTACK CALL REMOVE_TANK POP IX RET CONT_ATTACK: SET 4,22(IX) ; voor inslag ani 0e frame ; BIT 5,23(IX) ; schiet nooit terug ;JR NZ,CONTATTACK2 ; jajajaja dit werkt lekker LD 14(IX),L ; nummer degene die schiet LD A,11(IX) ; harvest filteren AND #0b00000111 JR Z,CONTATTACK3 RES 3,11(IX) ; reset attack build !!! RES 4,11(IX) ; move uit SET 5,11(IX) ; attack move aan CALL TNK_CHK_HELP CONTATTACK2: POP IX SET 1,22(IX) ; voor schiet ani RET CONTATTACK3: LD 14(IX),L POP IX SET 1,22(IX) RET STOP_ATTACK: LD A,13(IX) POP IX LD 14(IX),A RES 6,11(IX) SET 5,11(IX) RET DO_ATT_BLD: LD A,14(IX) CALL A_TO_BLD LD A,0(IY) ;geen gebouw OR A JR Z,STOP_ATT_B SET 1,22(IX) ; schiet ani LD A,19(IX) ; wait time before shot LD 18(IX),A LD A,16(IX) ;power TAnk SUB 7(IY) ; -shield VAN GEBOUW LD B,A LD A,6(IY) ; power van GEBOUW SUB B LD 6(IY),A JR Z,KILL_B RET NC ; alles is goed schiet nog maar eens KILL_B: PUSH IX CALL REMOVE_BUILD POP IX STOP_ATT_B: RES 6,11(IX) ; kappe met schietn RES 5,11(IX) RET ;------------------------------------ SPEED_STEP: LD B,A LD C,#0 LD A,#16 J8608: SUB B JR Z,J860F INC C JP J8608 J860F: LD 6(IX),C RET ;-------------------------------------- SHOOT_GFX: LD A,22(IX) AND #0b00000110 OR A RET Z LD IY,#IMPACT0 SLA A SLA A SLA A LD B,A LD A,#144 ADD B LD 0(IY),A CALL COPY_SHOOT LD A,22(IX) LD C,A AND #0b11111001 LD B,A LD A,C AND #0b00000110 SRL A INC A AND #0b00000011 SLA A OR B LD 22(IX),A RET IMPACT_GFX: LD A,22(IX) AND #0b00110000 OR A RET Z LD IY,#IMPACT0 LD B,A LD A,#192 ADD B LD 0(IY),A CALL COPY_SHOOT LD A,22(IX) LD C,A AND #0b11001111 LD B,A LD A,C AND #0b00110000 SRL A SRL A SRL A SRL A INC A AND #0b00000011 SLA A SLA A SLA A SLA A OR B LD 22(IX),A RET COPY_SHOOT: LD BC,(OFFSET) ; tank in veld ?? LD A,0(IX) SUB C RET C CP #10 RET NC LD A,1(IX) SUB B RET C CP #10 RET NC EXX LD HL,(OFFSET) LD A,0(IX) SUB L INC A ADD A ADD A ADD A ADD A LD 4(IY),A ; CP 16 ; RET C ; CP 161 ; RET NC LD A,1(IX) SUB H INC A ADD A ADD A ADD A ADD A LD 6(IY),A ; CP 16 ; RET C ; CP 161 ; RET NC LD A,(SWAP) ; ??? waarom LD 7(IY),A CALL PUTBLK EXX RET ;------------------------------------- CHKUP: LD H,D LD L,E DEC H JP CHK_ALL CHKDN: LD H,D LD L,E INC H JP CHK_ALL CHKRI: LD H,D LD L,E LD BC,#4 ADD HL,BC JP CHK_ALL CHKLT: LD H,D LD L,E LD BC,#-4 ADC HL,BC JP CHK_ALL CHKUPRI: LD H,D LD L,E DEC H LD BC,#4 ADD HL,BC JP CHK_ALL CHKDORI: LD H,D LD L,E INC H LD BC,#4 ADD HL,BC JP CHK_ALL CHKDOLT: LD H,D LD L,E INC H LD BC,#-4 ADC HL,BC JP CHK_ALL CHKUPLT: LD H,D LD L,E DEC H LD BC,#-4 ADC HL,BC CHK_ALL: LD A,(HL) CP #80 JP NC,RETURN_VAST CHK_TANK_OBJ: INC HL ; 2 byte van velddata LD A,(HL) ; tank nummer OR A JP Z,RETURN_LOS RETURN_VAST: XOR A OR A RET RETURN_LOS: LD A,#1 OR A RET ;------------------------------------------------ ; update het radar scherm en je money ;------------------------------------------------ RADAR_UPDATE: LD A,(RADAR) INC A AND #0b00000011 LD (RADAR),A CP #2 ; eens in de 4 keer JR Z,MAKE_RAD_MON JP NZ,SHOW_POWER RET MAKE_RAD_MON: ; ; alle tanks even doorlopen LD B,#254 LD IX,#TANK1 LD C,#TANK_DATA MAKE_RAD_LP1: LD A,13(IX) OR A JR Z,MAKE_RAD_END PUSH BC LD D,0(IX) LD E,1(IX) LD B,24(IX) LD C,25(IX) LD A,D CP B JR NZ,MAKE_RAD_LP2 LD A,E CP C JR Z,MAKE_RAD_END2 MAKE_RAD_LP2: CALL CALC_ADR DEC HL LD A,(HL) OR A JR NZ,MAKE_RAD_END3 INC HL PUSH DE ; ligt aan CALC_ADR CALL POINT ; ; vlak in A LD D,A CALL PLACE_UNIT POP BC ; nieuwe coor in BC LD 24(IX),B LD 25(IX),C CALL CALC_ADR DEC HL LD A,(HL) OR A JR NZ,MAKE_RAD_END2 INC HL CALL POINT2 LD D,A CALL PLACE_UNIT MAKE_RAD_END2: POP BC MAKE_RAD_END: LD A,B LD B,#0 ADD IX,BC LD B,A DJNZ MAKE_RAD_LP1 RET MAKE_RAD_END3: LD 24(IX),D LD 25(IX),E JR MAKE_RAD_END2 PLACE_UNIT: LD C,24(IX) LD B,25(IX) SRL B RR C D_TO_POINT: LD HL,#96 ADD HL,BC ; hahyahah hihihiih lache he LD B,H LD C,L DI LD A,#1 CALL SETVDP2 LD A,D OUT (0x98),A ; oude positie weg EI LD H,B LD L,C DI LD A,#3 CALL SETVDP2 LD A,D OUT (0x98),A EI RET POINT: LD A,L AND #0b00000111 CP #0b00000001 JR NZ,POINT_R EX DE,HL LD A,(DE) LD HL,#RAD_COL_TAB_L SRL A SRL A SRL A SRL A ; / 16 LD C,A LD B,#0 ADD HL,BC ; adres LD A,(HL) EX AF,AF INC DE INC DE INC DE LD A,(DE) OR A JR NZ,POINT_L_Z INC DE LD A,(DE) LD HL,#RAD_COL_TAB_R SRL A SRL A SRL A SRL A LD C,A LD B,#0 ADD HL,BC LD D,(HL) EX AF,AF OR D RET POINT_L_Z: LD D,#0 EX AF,AF OR D RET POINT_R: EX DE,HL LD A,(DE) LD HL,#RAD_COL_TAB_R SRL A SRL A SRL A SRL A ; / 16 LD C,A LD B,#0 ADD HL,BC ; adres LD A,(HL) EX AF,AF DEC DE DEC DE DEC DE DEC DE DEC DE LD A,(DE) OR A JR NZ,POINT_R_Z INC DE LD A,(DE) LD HL,#RAD_COL_TAB_L SRL A SRL A SRL A SRL A LD C,A LD B,#0 ADD HL,BC LD D,(HL) EX AF,AF OR D RET POINT_R_Z: LD D,#0 EX AF,AF OR D RET POINT2: LD A,L AND #0b00000111 CP #0b00000001 JR NZ,POINT2_R EX DE,HL LD A,13(IX) CP #128 JR C,POINT2_1 LD A,#0b10100000 JR POINT2_2 POINT2_1: LD A,#0b11010000 POINT2_2: EX AF,AF INC DE INC DE INC DE LD A,(DE) OR A JR NZ,POINT2_L_Z INC DE INC DE LD A,(DE) OR A JR Z,POINT2_23 CP #128 JR C,POINT2_22 LD D,#0b00001010 JR POINT2_24 POINT2_22: LD D,#0b00001101 JR POINT2_24 POINT2_23: DEC DE LD A,(DE) LD HL,#RAD_COL_TAB_R SRL A SRL A SRL A SRL A LD C,A LD B,#0 ADD HL,BC LD D,(HL) POINT2_24: EX AF,AF OR D RET POINT2_L_Z: LD D,#0 EX AF,AF OR D RET POINT2_R: EX DE,HL LD A,13(IX) CP #128 JR C,POINT2_3 LD A,#0b00001010 JR POINT2_4 POINT2_3: LD A,#0b00001101 POINT2_4: EX AF,AF DEC DE DEC DE DEC DE DEC DE DEC DE LD A,(DE) OR A JR NZ,POINT2_R_Z INC DE INC DE LD A,(DE) OR A JR Z,POINT2_43 CP #128 JR C,POINT2_42 LD D,#0b10100000 JR POINT2_44 POINT2_42: LD D,#0b11010000 JR POINT2_44 POINT2_43: DEC DE LD A,(DE) LD HL,#RAD_COL_TAB_L SRL A SRL A SRL A SRL A LD C,A LD B,#0 ADD HL,BC LD D,(HL) POINT2_44: EX AF,AF OR D RET POINT2_R_Z: LD D,#0 EX AF,AF OR D RET RAD_COL_TAB_R: .db 0b00000001 .db 0b00000010 .db 0b00000011 .db 0b00000100 .db 0b00000100 .db 0b00000101 .db 0b00001101 .db 0b00001101 .db 0b00001010 .db 0b00001010 RAD_COL_TAB_L: .db 0b00010000 .db 0b00100000 .db 0b00110000 .db 0b01000000 .db 0b01000000 .db 0b01010000 .db 0b11010000 .db 0b11010000 .db 0b10100000 .db 0b10100000 ;------------------------------------ INIT_RADAR: LD DE,#VELD_ADRES LD HL,#96 LD (VDPADR),HL LD A,#1 CALL SETVDP LD B,#64 ; hoogte v.d. radar ? J89B7: PUSH BC LD B,#32 ; lengte J89BB: LD A,(DE) OR A LD A,#0 JR NZ,INIT_RADAR2 PUSH BC PUSH DE INC DE EX DE,HL CALL POINT POP DE POP BC INIT_RADAR2: OUT (0x98),A INC DE INC DE INC DE INC DE INC DE INC DE INC DE INC DE DJNZ J89BB LD HL,(VDPADR) LD BC,#128 ADD HL,BC LD (VDPADR),HL LD A,#1 CALL SETVDP POP BC DJNZ J89B7 LD HL,#0 XOR A CALL SETVDP LD IY,#RADCOP CALL SPRITES_OFF CALL PUTBLK CALL SPRITES_ON RET SETVDP: DI OUT (0x99),A LD A,#14 SET 7,A OUT (0x99),A SET 6,H RES 7,H LD A,L OUT (0x99),A LD A,H OUT (0x99),A EI RET SETVDP2: OUT (0x99),A LD A,#14 SET 7,A OUT (0x99),A SET 6,H RES 7,H LD A,L OUT (0x99),A LD A,H OUT (0x99),A RET ;------------ BUILD ------------------- ; main build event ;-------------------------------------- BUILD: ; XOR A ; LD (0xFC9E),A LD A,(SWAP) XOR #1 LD (SWAP),A CALL VELD CALL TANKS CALL BUILD_SEL LD A,(ISTEXT) OR A CALL NZ,PUT_TEXT LD A,(SWAP) ADD A ; dit schijnt sneller te zijn ! ADD A ; DAN SLA, SLA ,SLA EN SLA SLA ADD A ADD A ADD A ADD #31 DI ; nu altijd in int. dus ... OUT (0x99),A LD A,#2+128 OUT (0x99),A EI RET BUILD_SEL: LD A,(ITEMSELECTED) CP #128 RET C LD IX,(P_BUILD) BUILD_SEL1: LD DE,(OFFSET) LD A,2(IX) SUB E SLA A SLA A SLA A SLA A ADD #16 LD H,A LD A,3(IX) SUB D SLA A SLA A SLA A SLA A ADD #16 LD L,A LD A,2(IX) LD B,A LD A,(OFFSET) LD C,A DEC A CP B JP NC,BUILD_SEL3 ADD A,#10 CP B RET C LD A,3(IX) LD B,A LD A,(OFFSET+1) LD C,A DEC A CP B JP NC,BUILD_SEL2 ADD A,#10 CP B RET C LD IY,#COP_BSEL_1 LD 4(IY),H LD 6(IY),L EXX CALL PUTBLK EXX BUILD_SEL2: LD A,3(IX) ADD 5(IX) DEC A LD B,A LD A,(OFFSET+1) LD C,A DEC A CP B RET NC ADD A,#10 CP B JP C,BUILD_SEL3 LD IY,#COP_BSEL_2 LD A,5(IX) DEC A SLA A SLA A SLA A SLA A ADD L LD 4(IY),H LD 6(IY),A EXX CALL PUTBLK EXX BUILD_SEL3: LD A,2(IX) ADD 4(IX) DEC A LD B,A LD A,(OFFSET) LD C,A DEC A CP B RET NC ADD A,#10 CP B RET C LD A,3(IX) LD B,A LD A,(OFFSET+1) LD C,A DEC A CP B JP NC,BUILD_SEL4 ADD A,#10 CP B RET C LD IY,#COP_BSEL_3 LD A,4(IX) DEC A SLA A SLA A SLA A SLA A ADD H LD 4(IY),A LD 6(IY),L EXX CALL PUTBLK EXX BUILD_SEL4: LD A,3(IX) ADD 5(IX) DEC A LD B,A LD A,(OFFSET+1) LD C,A DEC A CP B RET NC ADD A,#10 CP B RET C LD IY,#COP_BSEL_4 LD A,5(IX) DEC A SLA A SLA A SLA A SLA A ADD L LD 6(IY),A LD A,4(IX) DEC A SLA A SLA A SLA A SLA A ADD H LD 4(IY),A EXX JP PUTBLK RET TANKS: LD IY,#TNKCOP LD 2(IY),#160 LD 10(IY),#16 LD 8(IY),#16 LD 0(IY),#0 LD A,(SWAP) LD 7(IY),A XOR A LD (SELECTED),A LD HL,#CPYTT FIELD_LOOP: ; ; eerst alles binnen kader LD A,(HL) OR A JR Z,REMOVE_SPR ; klaar !!! PUSH HL CALL HL_TO_IX ; elke unit 1 keer FIELD: JP PTANK IN_SCREEN: POP HL LD (HL),#3 ; binnen scherm voor ontplof tabel BIT 7,11(IX) JR Z,J8C14 LD IX,#SPRATR+8 LD A,4(IY) LD 1(IX),A LD A,6(IY) LD 0(IX),A EXX CALL PUT_SPRITE EXX LD A,#1 LD (SELECTED),A JP J8C14 CONT2: POP HL J8C14: INC HL INC HL JP FIELD_LOOP REMOVE_SPR: LD A,(SELECTED) OR A JR NZ,RAND1 LD IX,#SPRATR+8 LD 0(IX),#212 CALL PUT_SPRITE RAND1: LD HL,#CPYTT RAND1_LOOP: LD A,(HL) OR A JR Z,RAND2 CP #2 JR NC,RAND1_4 LD BC,(OFFSET) ; c=x & b=y CALL HL_TO_IX LD A,C SUB 0(IX) JR Z,RAND1_6 DEC A JR NZ,RAND1_4 LD A,4(IX) ; mogelijkheid 3 check BIT 7,A JR NZ,RAND1_4 RAND1_6: DEC C DEC B LD A,0(IX) SUB C ADD A ADD A ADD A ADD A ; x * 16 LD C,A ; 0 v 16 LD A,1(IX) SUB B ADD A ADD A ADD A ADD A ADD 5(IX) LD B,A ; y* 16 + offset LD A,4(IX) OR A JR Z,RAND1_4 ; positie 1 op 0 punt CP #-16 JR Z,RAND1_4 LD A,C ADD 4(IX) LD C,A LD A,B CP #16 JR C,RAND1_4 CP #161 JR NC,RAND1_4 PUSH HL CALL PTANK_RI POP HL LD (HL),#2 RAND1_4: INC HL INC HL JP RAND1_LOOP RAND2: LD HL,#CPYTT RAND2_LOOP: LD A,(HL) OR A JR Z,RAND3 CP #2 JR NC,RAND2_4 LD BC,(OFFSET) ; c=x & b=y CALL HL_TO_IX LD A,B ; cp y offset SUB 1(IX) JR Z,RAND2_6 ; ligt ie binnen de randjes ! DEC A JR NZ,RAND2_4 LD A,5(IX) ; mogelijkheid 3 check BIT 7,A JR NZ,RAND2_4 RAND2_6: DEC C DEC B LD A,0(IX) SUB C ADD A ADD A ADD A ADD A ; x * 16 + OFFSET ADD 4(IX) LD C,A LD A,1(IX) SUB B ADD A ADD A ADD A ADD A LD B,A ; y* 16 LD A,5(IX) OR A JR Z,RAND2_4 ; positie 1 op 0 punt CP #-16 JR Z,RAND2_4 LD A,B ADD 5(IX) LD B,A LD A,C CP #16 JR C,RAND2_4 CP #161 JR NC,RAND2_4 PUSH HL CALL PTANK_DN POP HL LD (HL),#2 RAND2_4: INC HL INC HL JP RAND2_LOOP RAND3: LD HL,#CPYTT RAND3_LOOP: LD A,(HL) OR A JR Z,RAND4 CP #2 JR NC,RAND3_4 LD BC,(OFFSET) ; c=x & b=y LD A,C ADD #10 LD C,A CALL HL_TO_IX LD A,C SUB 0(IX) JR Z,RAND3_6 DEC A JR Z,RAND3_5 JP RAND3_4 RAND3_6: LD A,4(IX) ; mogelijkheid 4 check BIT 7,A JR Z,RAND3_4 RAND3_5: DEC C DEC B LD A,0(IX) SUB C ADD A ADD A ADD A ADD A ; x * 16 ADD #160 ; einde rand erbij LD C,A ; 160 v 176 eruit LD A,1(IX) SUB B ADD A ADD A ADD A ADD A ADD 5(IX) LD B,A ; y* 16 + offset LD A,4(IX) OR A JR Z,RAND3_4 ; positie 1 op 0 punt CP #16 JR Z,RAND3_4 LD A,C ADD 4(IX) LD C,A LD A,B CP #16 JR C,RAND3_4 CP #161 JR NC,RAND3_4 PUSH HL CALL PTANK_LT POP HL LD (HL),#2 RAND3_4: INC HL INC HL JP RAND3_LOOP RAND4: LD HL,#CPYTT RAND4_LOOP: LD A,(HL) OR A RET Z CP #2 JR NC,RAND4_4 LD BC,(OFFSET) ; c=x & b=y LD A,B ADD #10 LD B,A CALL HL_TO_IX LD A,B SUB 1(IX) JR Z,RAND4_6 DEC A JR Z,RAND4_5 JP RAND4_4 RAND4_6: LD A,5(IX) ; mogelijkheid 4 check BIT 7,A JR Z,RAND4_4 RAND4_5: DEC C DEC B LD A,0(IX) SUB C ADD A ADD A ADD A ADD A ; x * 16 +offset ADD 4(IX) LD C,A LD A,1(IX) SUB B ADD A ADD A ADD A ADD A ADD #160 LD B,A ; y* 16 + offset LD A,5(IX) OR A JR Z,RAND4_4 ; positie 1 op 0 punt CP #16 JR Z,RAND4_4 LD A,B ADD 5(IX) LD B,A LD A,C CP #16 JR C,RAND4_4 CP #161 JR NC,RAND4_4 PUSH HL CALL PTANK_UP POP HL LD (HL),#2 RAND4_4: INC HL INC HL JP RAND4_LOOP ;------------------------------------- ; .include the AI.ASM ! .include "ai_new.asm" ;----------------------------------- ; ALLERLEI ZOOI ;----------------------------------- ALGEMEEN: CALL RED_DEAD ; CALL PUT_MONEY CALL PUT_FPS CALL CHECK_BUILD CALL UPDATE_STEPS CALL MSELECTED CALL REP_UPGR CALL COMMANDO ONTPLOFFEN: LD A,(PLOF_COUNT) OR A RET Z ; helemaal nix LD B,A LD IX,#PLOF_TABEL-3 LABEL0003: INC IX INC IX INC IX LD A,2(IX) OR A JR Z,LABEL0003 EXX CALL NZ,DOE_ONTPLOF EXX DJNZ LABEL0003 RET ; geen ontploffingen ! DOE_ONTPLOF: CP #11 JR Z,ENDPLOF LD IY,#PLOF_COP ADD A ADD A ADD A ADD A LD 0(IY),A CALL PLOF_IN_RAND LD A,B OR A JP Z,DOE_ONTPLOF2 LD HL,(OFFSET) LD A,0(IX) SUB L INC A ADD A ADD A ADD A ADD A LD 4(IY),A LD A,1(IX) SUB H INC A ADD A ADD A ADD A ADD A LD 6(IY),A LD A,(SWAP) LD 7(IY),A CALL PUTBLK DOE_ONTPLOF2: INC 2(IX) RET ENDPLOF: XOR A LD 0(IX),A LD 1(IX),A LD 2(IX),A LD A,(PLOF_COUNT) DEC A LD (PLOF_COUNT),A RET PLOF_IN_RAND: LD B,#0 LD HL,(OFFSET) LD A,L ADD A,#10 LD E,A LD A,H ADD A,#10 LD D,A LD A,0(IX) CP L RET C CP E RET NC LD A,1(IX) CP H RET C CP D RET NC LD B,#1 RET REP_UPGR: LD IX,#BUILDING1 LD C,#BUILD_DATA LD B,#50 ; max REPAIR_LOOP: BIT 0,8(IX) CALL NZ,DO_REPAIR BIT 1,8(IX) CALL NZ,DO_UPGRADE LD A,B LD B,#0 ADD IX,BC LD B,A DJNZ REPAIR_LOOP RET DO_REPAIR: INC 6(IX) LD A,6(IX) CP #255 RET NZ RES 0,8(IX) CALL RES_MENU RET DO_UPGRADE: INC 11(IX) LD A,11(IX) OR A RET NZ RES 1,8(IX) CALL RES_MENU INC 9(IX) ; upgrade lev 1 up LD A,1(IX) CP #7 ; yard is +1 upgrade JR Z,UPGR_BBAR CP #4 JR Z,UPGR_TBAR RET RES_MENU: XOR A LD (ACTIVE_MENU),A PUSH IX POP DE LD HL,(P_BUILD) SBC HL,DE RET NZ PUSH BC LD (P_BUILD),IX CALL P_BLD_IMG ; reset build img CALL COMMAND_B LD IX,(P_BUILD) POP BC ; terug in loop RET UPGR_BBAR: LD A,(UPG_LEV_BLD) CP #3 RET Z ; max upg lev bereikt EXX PUSH IX INC A LD (UPG_LEV_BLD),A ADD #4 ; ???? ADD A ; *2 ADD A ; *4 LD C,A LD B,#0 LD HL,#BBB_VALUE ADD HL,BC LD (HL),#1 ; maak beschikbaar CALL INIT_BBAR POP IX EXX XOR A LD (IS_BLD_UPGRADING),A RET ; terug in loop UPGR_TBAR: LD A,(UPG_LEV_UNT) CP #4 RET Z EXX INC A LD (UPG_LEV_UNT),A ADD A ADD A LD C,A LD B,#0 LD HL,#TBB_VALUE ADD HL,BC LD (HL),#1 PUSH IX CALL INIT_BBAR POP IX EXX XOR A LD (IS_UNT_UPGRADING),A RET MSELECTED: LD A,(HAS_SELECT) OR A RET Z XOR A LD (TOTAL_SELECT),A LD HL,(OFFSET) LD A,(SEL_X0) SRL A SRL A SRL A SRL A ADD L LD B,A ; X0 LD A,(SEL_X1) SRL A SRL A SRL A SRL A ADD L LD C,A ; X1 LD A,(SEL_Y0) SRL A SRL A SRL A SRL A ADD H LD D,A ; Y0 LD A,(SEL_Y2) SRL A SRL A SRL A SRL A ADD H LD E,A ; Y2 LD HL,#CPYTT LOOP_MSEL: LD A,(HL) OR A RET Z CP #3 JR NZ,LOOP_MSEL2 INC HL LD A,(HL) PUSH HL CALL IN_MSEL POP HL INC HL JR LOOP_MSEL LOOP_MSEL2: INC HL INC HL JR LOOP_MSEL IN_MSEL: PUSH BC CALL A_TO_IX POP BC BIT 7,13(IX) ;type tank RET NZ RES 0,22(IX) LD A,0(IX) LD H,A CP B RET C CP C RET NC LD A,1(IX) LD L,A CP D RET C CP E RET NC LD A,(TOTAL_SELECT) CP #25 RET Z ; niet meer erbij ! INC A LD (TOTAL_SELECT),A LD A,#1 LD (MSELECT_ON),A SET 0,22(IX) RET RED_DEAD: LD A,(BLD_CNT_RED) LD A,(CHK_RED_DEAD) INC A AND #0b00111111 LD (CHK_RED_DEAD),A RET NZ CHK_RED: LD HL,#TANKRED LD BC,#13 ADD HL,BC LD DE,#TANK_DATA LD B,#128 LP_CHK_RED: BIT 7,(HL) RET NZ ADD HL,DE DJNZ LP_CHK_RED LD A,#1 LD (STOP),A RET CHK_RED_DEAD: .db 0 COMMANDO: LD A,(MBUSY) OR A RET NZ LD A,(ITEMSELECTED) OR A RET Z CP #127 JR NC,COMM_BLD DEC A JP Z,COMM_TNK_RED DEC A JR Z,COMM_HRV_RED RET COMM_BLD: CP #192 RET NC ; geen rood gebouw LD HL,(P_BUILD) LD BC,#8 ADD HL,BC LD A,(ACTIVE_MENU) BIT 0,(HL) JR Z,COMM_BLD2 LD IY,#MENU_RED_REP LD B,#8 CP B JR NZ,COMM_BLD3 RET COMM_BLD2: BIT 1,(HL) RET Z LD IY,#MENU_RED_UPG LD B,#9 CP B RET Z COMM_BLD3: LD A,B LD (ACTIVE_MENU),A PUSH IY CALL COMMAND_B POP IY JP PUTBLK COMM_HRV_RED: LD HL,(TNKADR) LD BC,#11 ADD HL,BC LD A,(ACTIVE_MENU) BIT 4,(HL) JR Z,COMM_HRV_RED2 EX AF,AF LD BC,#15 ADD HL,BC LD A,(HL) OR A JR Z,COMM_HRV_RED1 EX AF,AF LD IY,#MENU_RED_RET LD B,#11 CP B RET Z JR COMM_HRV_RED3 COMM_HRV_RED1: EX AF,AF LD IY,#MENU_RED_MOV LD B,#4 CP B RET Z JR COMM_HRV_RED3 COMM_HRV_RED2: LD BC,#11 ADD HL,BC ; ix+22 BIT 7,(HL) JR Z,COMM_HRV_RED22 LD IY,#MENU_RED_HRV LD B,#10 ; 10 is harvsten menu CP B RET Z JR COMM_HRV_RED3 COMM_HRV_RED22: LD IY,#MENU_RED_STP LD B,#1 CP B RET Z COMM_HRV_RED3: LD A,B LD (ACTIVE_MENU),A PUSH IY CALL COMMAND_HARV POP IY JP PUTBLK COMM_TNK_RED: LD HL,(TNKADR) LD BC,#11 ADD HL,BC LD A,(ACTIVE_MENU) BIT 4,(HL) JR Z,COMM_TNK_RED2 LD IY,#MENU_RED_MOV LD B,#4 CP B JR NZ,COMM_TNK_RED4 RET COMM_TNK_RED2: BIT 6,(HL) JR Z,COMM_TNK_RED3 LD IY,#MENU_RED_ATT LD B,#6 CP B JR NZ,COMM_TNK_RED4 RET COMM_TNK_RED3: LD IY,#MENU_RED_STP LD B,#1 CP B RET Z COMM_TNK_RED4: LD A,B LD (ACTIVE_MENU),A PUSH IY CALL COMMAND_TANK POP IY JP PUTBLK ACTIVE_MENU: .db 0 ;---------------------------------------------- ; Check op bouwen gebouwen steps ?? ;-------------------------------------------- CHECK_BUILD: LD HL,#BBB_VALUE LD B,#18 ; max 18 was 13 L_CHK_BUILD1: PUSH BC LD A,(HL) CP #2 CALL Z,CHECK_BUILD2 CP #3 CALL Z,READY_BUILD2 POP BC INC HL INC HL INC HL INC HL DJNZ L_CHK_BUILD1 RET CHECK_BUILD2: LD A,B CP #6 ; lager/gelijk aan 5 is AI RET C ; ; B-5 doen ? LD A,B ; correctie voor lus 13 SUB #5 LD B,A LD A,#14 ; max 13 SUB B LD B,A LD A,(B_BALK_TYPE) OR A LD A,(B_BALK_NR) JR Z,CHECK_BUILD22 LD A,(T_BALK_NR) ; is het visible ??? CHECK_BUILD22: CP B RET NC ADD A,#4 CP B RET C LD IY,#BB_STEPS_BAR SUB #4 LD C,A LD A,B SUB C ADD A ADD A ADD A ADD A ADD A ADD #2 LD 4(IY),A PUSH HL INC HL INC HL LD A,(HL) SRL A SRL A SRL A INC A LD 10(IY),A CALL PUTBLK LD A,7(IY) XOR #1 LD 7(IY),A CALL PUTBLK POP HL RET READY_BUILD2: LD A,B CP #6 JP C,AI_CREATE_CAR LD A,B ; hack correctie is weg te werken ! SUB #5 LD B,A EX AF,AF LD A,B CP #6 LD A,(B_BALK_NR) JR NC,READY_BUILD22 LD A,(T_BALK_NR) READY_BUILD22: LD E,A LD (HL),#4 ; kan ook 3 zijn LD A,#13 ; building + tanks SUB B LD B,A LD D,A INC B EX AF,AF CP #6 JR C,CREATE_CAR ; create car ook als niet vis LD A,(B_BALK_TYPE) OR A RET NZ ; if tbar visible then NOT LD A,E ; is het visible ??? CP B RET NC ADD A,#4 CP B RET C LD C,E LD A,B SUB C DEC A ADD A ADD A ADD A ADD A ADD A ADD #32 LD E,A LD A,D ADD A ADD A ADD A ADD A ADD A LD D,A PUSH HL LD IY,#BB_BLW_COP CALL PUTBLK CALL BB_PUT_BUILD LD IY,#BB_READY_COP CALL PUTBLK CALL P_BB_PART POP HL RET ;----------------------------------------- CREATE_CAR: LD C,E LD A,B SUB C DEC A ADD A ADD A ADD A ADD A ADD A ADD #32 LD E,A EX AF,AF LD A,D LD (TYPE_OF_CAR),A PUSH HL ; push bb_bar adres LD HL,#BUILDING1 INC HL LD C,#BUILD_DATA LD B,#25 ; 25 gebouwen van jou LOOP_CRT_CAR: PUSH HL PUSH BC LD A,(HL) CP #4 ; gevonden ? dan createcar CALL Z,CREATE_CAR2 POP BC POP HL LD A,B LD B,#0 ADD HL,BC LD B,A DJNZ LOOP_CRT_CAR JR CANT_CREATE_TNK RET ; mag eigenlijk niet hier komen ; komt hier als geen enkele factory kan plaatsen CREATE_CAR2: ; ; if gevonden POP stack en cont ; ; else RET INC HL LD B,(HL) ; ? DEC B INC HL LD C,(HL) ; hoekje factory CALL CALC_ADR LD DE,#FACTORY_DEPLOY CREATE_CAR2_LP: LD A,(DE) CP #100 RET Z ; volgende factory PUSH HL LD A,(DE) LD C,A INC DE LD A,(DE) LD B,A INC DE ADD HL,BC LD A,(HL) CP #80 JR NC,CREATE_CAR2_LP2 ; kan niet op rots of huis INC HL LD A,(HL) OR A JR NZ,CREATE_CAR2_LP2 ; kan niet op tank JR CREATE_CAR3 CREATE_CAR2_LP2: POP HL JR CREATE_CAR2_LP RET ; probeer volgende factory CREATE_CAR3: POP AF ; adres POP AF ; stack POP AF ; BC from 1st loop POP AF ; building data LD BC,#VELD_ADRES SBC HL,BC SRL L SRL L LD A,L LD L,H LD H,A LD A,(TYPE_OF_CAR) LD D,A LD A,#12 SUB D LD C,A LD B,#1 ;blauw CALL ADD_TANK ; ; add tank kan ook fout gaan OR A JR Z,CANT_CREATE_TNK POP HL ; adres bb_bar LD (HL),#1 ; clear tank bar INC HL ; dit pas NA dat LD A,(HL) ; de tank gebouwd is INC HL DEC A LD (HL),A LD A,(B_BALK_TYPE) OR A RET Z LD A,(TYPE_OF_CAR) SUB #8 ADD A ADD A ADD A ADD A ADD A LD D,A EX AF,AF OR A RET Z LD E,A LD IY,#BB_BLW_COP CALL PUTBLK CALL BB_PUT_BUILD JP P_BB_PART RET CANT_CREATE_TNK: ; ; bbar een stapje terug doen zodat ie ; ; weer in de queue stapt POP HL LD (HL),#2 INC HL LD A,#255 SUB (HL) INC HL LD (HL),A RET ; en even een message TYPE_OF_CAR: .db 0 ;---------------------------------- ; check mouse na druk op knop ;---------------------------------- CHECK_COOR: LD HL,#BUT_PRESSED SET 0,(HL) LD DE,(MOUSEY) LD A,D CP #16 JR C,AREA3 CP #176 JR NC,AREA3 LD A,E CP #16 JR C,AREA3 CP #176 JR NC,AREA3 LD A,#1 ; VOOR MSEL LD (PLAYFIELD),A LD A,(MBUSY) ; doe commando OR A JP NZ,EXEC_COMMAND JP WHICH_OBJECT ; pak een tank AREA3: XOR A LD (PLAYFIELD),A LD A,D CP #193 JR C,AREA4 CP #255 JR NC,AREA4 LD A,E CP #128 JR C,AREA4 CP #192 JR NC,AREA4 JP MOVE_RAD_SCR AREA4: LD A,D CP #200 JR C,AREA5 CP #248 JR NC,AREA5 LD A,E CP #16 JR C,AREA5 CP #104 JR NC,AREA5 JP WHICH_ITEM AREA5: LD A,D CP #32 JR C,AREA51 CP #160 JR NC,AREA51 LD A,E CP #176 JR C,AREA51 JP SEL_FROM_BB AREA51: LD A,D CP #16 JR C,AREA6 CP #32 JR NC,AREA6 LD A,E CP #176 JR C,AREA6 CP #200 JR NC,AREA6 JP SCRL_BB_L AREA6: LD A,D CP #160 JR C,AREA6A CP #176 JR NC,AREA6A LD A,E CP #176 JR C,AREA6A CP #200 JR NC,AREA6A JP SCRL_BB_R AREA6A: LD A,D CP #226 JR C,AREA6B CP #246 JR NC,AREA6B LD A,E CP #192 JR C,AREA6B CP #200 JR NC,AREA6B JP SCRL_BB_UP AREA6B: LD A,D CP #194 JR C,AREA7 CP #224 JR NC,AREA7 LD A,E CP #192 JR C,AREA7 CP #200 JR NC,AREA7 JP SCRL_BB_DN AREA7: LD A,D ; option CP #80 JR C,AREA8 CP #128 JR NC,AREA8 LD A,E CP #0 JR C,AREA8 CP #12 JR NC,AREA8 JP OPTION_MENU AREA8: LD A,D CP #16 JR C,AREA9 CP #64 JR NC,AREA9 LD A,E CP #0 JR C,AREA9 CP #12 JR NC,AREA9 LD A,#1 LD (STOP),A RET AREA9: RET ;-------------------------------------------- WHICH_OBJECT: CALL XYTO16 LD B,D LD C,E CALL CALC_ADR DEC HL LD A,(HL) OR A RET NZ ; op onzichtbaar INC HL INC HL LD A,(HL) OR A JP Z,WHICH_OBJCT2 ; geen tank !!! CALL A_TO_IX LD B,13(IX) LD IY,(TNKADR) LD A,13(IY) CP B RET Z ; dezelfde tank ! RES 7,11(IY) LD (TNKADR),IX CALL P_TNK_IMG BIT 7,13(IX) ; soort bit JR NZ,ENEMY_SELTD LD A,#100 LD (ISTEXT),A LD A,R AND #0b00000011 CALL INIT_TEXT XOR A LD (ACTIVE_MENU),A LD A,11(IX) AND #0b00000111 JR Z,HARV_SELTD LD A,#1 LD (ITEMSELECTED),A ; CALL COMMAND_TANK ;gebeurt al in COMMANDO CALL SHOW_POWER SET 7,11(IX) RET HARV_SELTD: LD A,#2 LD (ITEMSELECTED),A ; CALL COMMAND_HARV CALL SHOW_POWER SET 7,11(IX) RET ENEMY_SELTD: LD A,#32 LD (ITEMSELECTED),A CALL COMMAND_ENM ; misschien cursor type reset CALL SHOW_POWER SET 7,11(IX) RET ; klaar dus uit de loop WHICH_OBJCT2: DEC HL LD A,(HL) CP #96 RET C CP #160 RET Z LD C,#7 ; yard CP #100 JR C,LOOP0_OBJCT2 LD C,#1 ; windtrap CP #104 JR C,LOOP0_OBJCT2 LD C,#2 ; ref CP #110 JR C,LOOP0_OBJCT2 LD C,#5 ; radar CP #114 JR C,LOOP0_OBJCT2 LD C,#3 ; silo CP #118 JR C,LOOP0_OBJCT2 LD C,#4 CP #124 JR C,LOOP0_OBJCT2 LD C,#7 CP #132 JR C,LOOP1_OBJCT2 LD C,#1 CP #136 JR C,LOOP1_OBJCT2 LD C,#4 CP #156 JR C,LOOP1_OBJCT2 RET LOOP0_OBJCT2: LD IX,#BUILDING1 LD B,#25 ; 25 blauwe LD H,#128 ; voor itemselected JP LOOP0_OBJ2 LOOP1_OBJCT2: LD IX,#BUILDING1+24*BUILD_DATA LD H,#192 ; itemsel LD B,#25 ; 25 x rood LOOP0_OBJ2: PUSH BC LD A,1(IX) CP C JR NZ,LOOP0_OBJ21 LD A,2(IX) DEC A CP D JR NC,LOOP0_OBJ21 ADD 4(IX) CP D JR C,LOOP0_OBJ21 LD A,3(IX) DEC A CP E JR NC,LOOP0_OBJ21 ADD 5(IX) CP E JR C,LOOP0_OBJ21 LD IY,(TNKADR) RES 7,11(IY) LD (P_BUILD),IX LD A,H ; itemselected = 128 + c ??? ADD C ; YARD is 128 LD (ITEMSELECTED),A CP #191 JR NC,ENEMY_BUILD CALL COMMAND_B JR LAB0023 ENEMY_BUILD: CALL COMMAND_ENM ; misschien cursor type reset LAB0023: CALL P_BLD_IMG CALL SHOW_POWER POP BC LD HL,#TANKTAB ; tnkadr resetten op 0 LD (TNKADR),HL XOR A LD (ACTIVE_MENU),A RET ; building gevonden !!! LOOP0_OBJ21: LD BC,#BUILD_DATA ADD IX,BC POP BC DJNZ LOOP0_OBJ2 RET ;----------------------------------------- ; PUT TANK IMAGE ;------------------------------------------- P_TNK_IMG: LD IY,#GRAY_ITEM CALL PUTBLK LD IY,#TANK_IMG LD A,11(IX) AND #0b00000111 LD B,A LD A,#4 SUB B ADD A ADD A ADD A ADD A ADD A LD 0(IY),A CALL PUTBLK LD IY,#PUT_ITEM LD 7(IY),#0 CALL PUTBLK LD 7(IY),#1 CALL PUTBLK RET ;----------------------------------------- ; PUT BUILDING IMAGE ;------------------------------------------- P_BLD_IMG: LD IY,#GRAY_ITEM CALL PUTBLK LD IY,#BUILD_IMG LD A,1(IX) ADD A ADD A ADD A ADD A ADD A LD 0(IY),A CALL PUTBLK LD IY,#PUT_ITEM LD 7(IY),#0 CALL PUTBLK LD 7(IY),#1 CALL PUTBLK RET ;------------------------------------------------- MOVE_RAD_SCR: ; LD IX,#SPRATR+4 LD HL,#VELD_ADRES+260 ;ADR+193 !!! LD A,D CP #246 JR C,MOV_RAD_SCR1 LD A,#245 MOV_RAD_SCR1: LD 1(IX),A SUB #193 LD C,A INC A LD (OFFSET),A SLA C SLA C LD B,#0 ADD HL,BC LD A,E CP #181 JR C,MOV_RAD_SCR2 LD A,#180 MOV_RAD_SCR2: LD 0(IX),A SUB #128 LD C,A INC A LD (OFFSET+1),A LD B,C LD C,#0 ADD HL,BC LD BC,(ADR) LD (ADR),HL XOR A SBC HL,BC RET Z CALL PUT_SPRITE JP BUILD ; om ontploffen niet buiten build om ;------------------------------------ WHICH_ITEM: LD A,(MBUSY) OR A JP NZ,CHK_CANCEL LD A,(ITEMSELECTED) OR A RET Z CP #191 ; enemy building RET NC CP #64 ; bb bar JR NC,BUILDING_COM CP #31 ; geen enemy of gebouw ?? RET NC CP #2 ; eigen harv JR Z,HARV_COMMAND TANK_COMMAND: LD A,E CP #96 JR NC,TANK_CANCEL ; moet eigenlijk stop zijn !! CP #88 JR NC,TANK_GUARD CP #80 JP NC,TANK_MOVE CP #72 JP NC,TANK_ATTACK RET HARV_COMMAND: LD A,E CP #96 JP NC,HARV_RETURN ; return ! CP #88 JR NC,TANK_GUARD ; stop ! CP #80 JP NC,TANK_MOVE ; gewoon een move CP #72 JR NC,TANK_ATTACK ; wordt opgevat als harvest RET BUILDING_COM: LD A,E CP #96 JP NC,BUILD_CANCEL CP #88 RET NC CP #80 JP NC,BUILD_UPGR CP #72 JP NC,BUILD_REP RET CHK_CANCEL: LD A,E CP #96 RET C CHK_CANCEL2: LD A,(ITEMSELECTED) OR A RET Z CP #64 JR NC,CANCEL_BB CP #31 ; enemy selected geen cancel RET NC CP #2 JR Z,CANCEL_HARV CANCEL_TANK: XOR A LD (MBUSY),A LD (CURSOR_TYPE),A CALL COMMAND_TANK RET CANCEL_HARV: XOR A LD (MBUSY),A LD (CURSOR_TYPE),A CALL COMMAND_HARV ; command harv!! RET CANCEL_BB: XOR A LD (MBUSY),A LD (CURSOR_TYPE),A LD (ITEMSELECTED),A CALL CLEAR_ITEM JP BB_CANCEL TANK_CANCEL: CALL CLEAR_ITEM LD IX,(TNKADR) RES 7,11(IX) LD HL,#TANKTAB LD (TNKADR),HL RET TANK_GUARD: LD IX,(TNKADR) LD A,0(IX) LD 2(IX),A LD A,1(IX) LD 3(IX),A RES 5,11(IX) RES 6,11(IX) RES 7,22(IX) ;eigenlijk alleen voor harvesters :) RET TANK_ATTACK: CALL CANCEL_ITEM LD A,#2 LD (MBUSY),A LD A,#28 LD (CURSOR_TYPE),A RET TANK_MOVE: CALL CANCEL_ITEM LD A,#1 LD (MBUSY),A LD A,#28 LD (CURSOR_TYPE),A RET EXEC_COMMAND: XOR A LD (ACTIVE_MENU),A LD A,(ITEMSELECTED) CP #1 JR Z,TNK_COMMAND CP #2 JR Z,HRV_COMMAND CP #128 ; gebouw geselecteerd ?? RET NC CP #64 ; alles tussen 64 - 128 JP NC,BB_COMMAND RET ; enemy HRV_COMMAND: LD A,(MBUSY) CP #1 JR Z,TNK_COM_MOVE CP #2 JP Z,HRV_COM_HRV RET TNK_COMMAND: LD A,(MBUSY) CP #1 JR Z,TNK_COM_MOVE CP #2 JR Z,TNK_COM_ATT RET TNK_COM_MOVE: CALL XYTO16 LD IX,(TNKADR) LD 2(IX),D LD 3(IX),E RES 5,11(IX) RES 6,11(IX) RES 7,22(IX) ;harvest bitje uit XOR A LD 26(IX),A ; harvest wachttijd uit LD A,(MSELECT_ON) OR A CALL NZ,MOVE_MSEL LD A,(ITEMSELECTED) CP #1 CALL Z,COMMAND_TANK CP #2 CALL Z,COMMAND_HARV XOR A LD (MBUSY),A LD (CURSOR_TYPE),A RET MOVE_MSEL: BIT 0,22(IX) RET Z LD A,#127 ; tanksum LD BC,#TANK_DATA LD IX,#TANK1 LD IY,#DEST_OFFSET LP_MOVE_MSEL: BIT 0,22(IX) CALL NZ,DO_SEL_MOVE ADD IX,BC DEC A RET Z JP LP_MOVE_MSEL DO_SEL_MOVE: EX AF,AF LD A,0(IY) ADD A,D LD 2(IX),A LD A,1(IY) ADD A,E LD 3(IX),A INC IY INC IY EX AF,AF RES 5,11(IX) RES 6,11(IX) RES 7,22(IX) ;harvest bitje uit RET TNK_COM_ATT: LD IX,(TNKADR) RES 6,11(IX) CALL XYTO16 LD B,D LD C,E CALL CALC_ADR LD A,(HL) CP #80 JR C,TNK_COM_ATT2 CP #144 JR NC,TNK_COM_ATT2 JP TNK_ATT_BLD TNK_COM_ATT2: INC HL LD A,(HL) ; geen rooie CP #128 RET C LD 14(IX),A ; nummer enemy tank RES 3,11(IX) ; je valt een tank aan SET 5,11(IX) LD 2(IX),D ; x en y van enemy LD 3(IX),E LD A,(MSELECT_ON) ; multiple select attack OR A CALL NZ,ATT_MSEL J8895: XOR A LD (MBUSY),A LD (CURSOR_TYPE),A CALL COMMAND_TANK RET ATT_MSEL: BIT 0,22(IX) RET Z LD B,#127 ; tnksum LD C,#TANK_DATA LD IX,#TANK1 LP_ATT_MSEL: BIT 0,22(IX) CALL NZ,DO_SEL_ATT LD A,B LD B,#0 ADD IX,BC LD B,A DJNZ LP_ATT_MSEL RET DO_SEL_ATT: ; zorg dat de harvesters niet in ATTSEL zitten !!! LD A,11(IX) AND #0b00000111 OR #0 RET Z RES 3,11(IX) SET 5,11(IX) LD 2(IX),D LD 3(IX),E LD A,(HL) LD 14(IX),A RET TNK_ATT_BLD: SET 3,11(IX) ;ATT BUILDING SET 5,11(IX) LD 2(IX),D LD 3(IX),E ; rij erheen LD IY,#BUILDING1 LD B,#50 ; 50 blauwe LOOP1_OBJ2: PUSH BC LD A,2(IY) DEC A CP D JR NC,LOOP1_OBJ21 ADD 4(IY) CP D JR C,LOOP1_OBJ21 LD A,3(IY) DEC A CP E JR NC,LOOP1_OBJ21 ADD 5(IY) CP E JR C,LOOP1_OBJ21 POP BC LD H,0(IY) ;nummer gebouw LD 14(IX),H LD A,(MSELECT_ON) ; multiple select attack OR A ; on building CALL NZ,ATT_MSEL2 JP J8895 ; menu goed LOOP1_OBJ21: LD BC,#BUILD_DATA ADD IY,BC POP BC DJNZ LOOP1_OBJ2 RET ; als het goed is komt ie hier nooit ! ATT_MSEL2: BIT 0,22(IX) RET Z LD IX,#TANK1 LD B,#127 ; tnksum LD C,#TANK_DATA LP_ATT_MSEL2: BIT 0,22(IX) CALL NZ,DO_SEL_ATT2 LD A,B LD B,#0 ADD IX,BC LD B,A DJNZ LP_ATT_MSEL2 RET DO_SEL_ATT2: ;zorg dat de harvesters niet in ATTSEL zitten !!! LD A,11(IX) AND #0b00000111 OR #0 RET Z SET 3,11(IX) SET 5,11(IX) LD 2(IX),D LD 3(IX),E LD 14(IX),H RET ;---------------------------------- HRV_COM_HRV: CALL XYTO16 PUSH DE LD B,D LD C,E CALL CALC_ADR POP DE LD A,(HL) CP #16 RET C CP #48 RET NC LD IX,(TNKADR) LD 2(IX),D LD 3(IX),E SET 7,22(IX) CALL COMMAND_HARV XOR A LD (MBUSY),A LD (CURSOR_TYPE),A RET HARV_RETURN: LD A,#50 ; timer wait bij refinery LD 26(IX),A LD IX,(TNKADR) HARV_RETURN2: LD HL,#BUILDING1 INC HL LD DE,#BUILD_DATA LD B,#25 ; max HARV_R_LOOP: LD A,(HL) CP #2 JR Z,HARV_RET2 HARV_R_LOOP2: ADD HL,DE DJNZ HARV_R_LOOP RET HARV_RET2: PUSH HL POP IY LD A,11(IY) ; eigenlijk ix+12 :) = bezet byte OR A JR NZ,HARV_R_LOOP2 LD 11(IY),#1 INC HL LD A,(HL) ADD #3 LD 2(IX),A INC HL LD A,(HL) ADD #2 LD 3(IX),A RET BUILD_REP: LD IX,(P_BUILD) LD A,6(IX) INC A RET Z BIT 1,8(IX) RET NZ SET 0,8(IX) RET BUILD_UPGR: LD IX,(P_BUILD) LD A,10(IX) SUB 9(IX) RET Z BIT 0,8(IX) ; repair is busy RET NZ LD A,1(IX) CP #7 JR Z,BUILD_UPGR2 LD A,(IS_UNT_UPGRADING) OR A RET NZ SET 1,8(IX) LD A,#1 LD (IS_UNT_UPGRADING),A RET BUILD_UPGR2: LD A,(IS_BLD_UPGRADING) OR A RET NZ SET 1,8(IX) LD A,#1 LD (IS_BLD_UPGRADING),A RET BUILD_CANCEL: LD HL,#BUT_PRESSED BIT 0,(HL) RET NZ LD IX,(P_BUILD) BIT 0,8(IX) JR NZ,BUILD_CANCEL3 BIT 1,8(IX) JR NZ,BUILD_CANCEL2 JP CLEAR_ITEM BUILD_CANCEL2: RES 1,8(IX) LD 11(IX),#0 ; upgrade lev op 0 LD A,1(IX) CP #7 JR Z,BUILD_CANCEL4 XOR A LD (IS_UNT_UPGRADING),A JR BUILD_CANCEL3 BUILD_CANCEL4: XOR A LD (IS_BLD_UPGRADING),A BUILD_CANCEL3: RES 0,8(IX) SET 0,(HL) XOR A LD (ACTIVE_MENU),A CALL COMMAND_B RET ;--------------------------------------- BB_COMMAND: LD A,(BB_BLOCKED) OR A RET NZ LD A,(ITEMSELECTED) CP #64 JR Z,P_BETON CP #65 JP Z,P_WINDTRAP CP #66 JP Z,P_REFINERY CP #67 JP Z,P_SILO CP #68 JP Z,P_FACTORY CP #69 JP Z,P_RADAR RET P_BETON: CALL XYTO16 LD B,D LD C,E CALL CALC_ADR LD (HL),#64 ; danbeton erop JP RESET_STATUS P_CONST_Y: ; to be done RET P_REFINERY: CALL XYTO16 PUSH DE LD H,#2 ; refinery is 3 CALL ADD_BUILDING POP DE OR A RET Z ; building vol LD B,D LD C,E CALL CALC_ADR CALL NO_BETON_CHK LD (HL),#104 ; refinery erop INC HL INC HL INC HL INC HL CALL NO_BETON_CHK LD (HL),#105 INC HL INC HL INC HL INC HL CALL NO_BETON_CHK LD (HL),#106 INC H CALL NO_BETON_CHK LD (HL),#109 DEC HL DEC HL DEC HL DEC HL CALL NO_BETON_CHK LD (HL),#108 DEC HL DEC HL DEC HL DEC HL CALL NO_BETON_CHK LD (HL),#107 LD L,E INC L LD H,D INC H INC H LD B,#1 LD C,#0 CALL ADD_TANK JP RESET_STATUS P_FACTORY: CALL XYTO16 PUSH DE LD H,#4 CALL ADD_BUILDING POP DE OR A RET Z ; max. bereikt LD A,(UPG_LEV_UNT) LD 9(IX),A LD B,D LD C,E CALL CALC_ADR CALL NO_BETON_CHK LD (HL),#118 ; refinery erop INC HL INC HL INC HL INC HL CALL NO_BETON_CHK LD (HL),#119 INC HL INC HL INC HL INC HL CALL NO_BETON_CHK LD (HL),#120 INC H CALL NO_BETON_CHK LD (HL),#123 DEC HL DEC HL DEC HL DEC HL CALL NO_BETON_CHK LD (HL),#122 DEC HL DEC HL DEC HL DEC HL CALL NO_BETON_CHK LD (HL),#121 ; ; Maak de eerste unit beschikbaar LD HL,#TBB_VALUE LD (HL),#1 JP RESET_STATUS P_RADAR: CALL XYTO16 PUSH DE LD H,#5 ; radar is 4 CALL ADD_BUILDING POP DE OR A RET Z ; building vol LD B,D LD C,E CALL CALC_ADR CALL NO_BETON_CHK LD (HL),#110 ; windtrap erop INC HL INC HL INC HL INC HL CALL NO_BETON_CHK LD (HL),#111 INC H CALL NO_BETON_CHK LD (HL),#113 DEC HL DEC HL DEC HL DEC HL CALL NO_BETON_CHK LD (HL),#112 JP RESET_STATUS P_SILO: CALL XYTO16 PUSH DE LD H,#3 ; silo is 5 CALL ADD_BUILDING POP DE OR A RET Z ; building vol LD B,D LD C,E CALL CALC_ADR CALL NO_BETON_CHK LD (HL),#114 ; windtrap erop INC HL INC HL INC HL INC HL CALL NO_BETON_CHK LD (HL),#115 INC H CALL NO_BETON_CHK LD (HL),#117 DEC HL DEC HL DEC HL DEC HL CALL NO_BETON_CHK LD (HL),#116 JP RESET_STATUS P_WINDTRAP: CALL XYTO16 PUSH DE LD H,#1 ; windtrap is 2 CALL ADD_BUILDING POP DE OR A RET Z ; building vol LD B,D LD C,E CALL CALC_ADR CALL NO_BETON_CHK LD (HL),#100 ; windtrap erop INC HL INC HL INC HL INC HL CALL NO_BETON_CHK LD (HL),#101 INC H CALL NO_BETON_CHK LD (HL),#103 DEC HL DEC HL DEC HL DEC HL CALL NO_BETON_CHK LD (HL),#102 JP RESET_STATUS ADD_BUILDING: LD A,(BUILDINGS) ; jammer niet meer CP #50 ; dan 10 stuks !! LD A,#0 RET Z ; voor de veiligheid LD IX,#BUILDING1 LD BC,#BUILD_DATA ; even loopen LD A,#50 ; max 50 stuks LD L,A LOOP_ADD_B: LD A,0(IX) OR A JR Z,ADD_BUILD2 LD (BUILD_NUM),A ADD IX,BC DEC L JR NZ,LOOP_ADD_B RET BUILD_NUM: .db 0 ADD_BUILD2: LD A,(BUILD_NUM) INC A LD 0(IX),A ; nummer vorige + 1 LD A,H ;type gebouw LD 1(IX),A LD 2(IX),D LD 3(IX),E EXX ; bewaar info per huisje ; anders LD HL,#EXTR_B_DATA LD B,#0 LD C,A SLA C SLA C SLA C ADD HL,BC PUSH IX POP DE ; DE is dest. INC DE ; num INC DE ; type INC DE ; x INC DE ; y LD BC,#8 LDIR ; pompen of verzuipen ! EXX LD HL,#BUILDINGS INC (HL) LD A,#1 ; gebouw is goed toegevoegd RET NO_BETON_CHK: LD A,(HL) CP #64 RET Z LD A,6(IX) SUB #32 LD 6(IX),A RET RESET_STATUS: LD A,(ITEMSELECTED) SUB #64 LD D,A LD HL,#BBB_VALUE SLA A SLA A LD C,A LD B,#0 ADD HL,BC LD (HL),#1 ; maak weer beschikbaar INC HL LD A,(HL) INC HL DEC A LD (HL),A INC D ; correctie voor berekening LD A,(B_BALK_NR) LD E,A CP D JR NC,RESETSTATUS2 ADD A,#4 CP D JR C,RESETSTATUS2 SUB #4 DEC D LD A,D SUB E ADD A ADD A ADD A ADD A ADD A ADD #32 LD E,A LD A,D ADD A ADD A ADD A ADD A ADD A LD D,A LD IY,#BB_BLW_COP CALL PUTBLK CALL BB_PUT_BUILD CALL P_BB_PART RESETSTATUS2: JP CANCEL_BB ;--------------------------------------- CANCELACTION: LD HL,#BUT_PRESSED BIT 1,(HL) RET NZ SET 1,(HL) LD A,(MSELECT_ON) OR A CALL NZ,MSEL_OFF LD A,(MBUSY) OR A JP NZ,CHK_CANCEL2 LD A,(ITEMSELECTED) OR A RET Z CALL CLEAR_ITEM LD IX,(TNKADR) RES 7,11(IX) LD HL,#TANKTAB LD (TNKADR),HL ; ook voor gebouwen ? LD HL,#0 LD (P_BUILD),HL ; ja dus RET MSEL_OFF: LD HL,#TANK1 LD BC,#22 ;BYTE 22 ADD HL,BC LD B,#127 ;tank sum LD DE,#TANK_DATA CANCEL_LOOP: RES 0,(HL) ADD HL,DE DJNZ CANCEL_LOOP RET ;----------------------------------------- BB_CANCEL: LD BC,#4 LD HL,#SPRATR+16 LD (HL),#212 ADD HL,BC LD (HL),#212 ADD HL,BC LD (HL),#212 ADD HL,BC LD (HL),#212 ADD HL,BC LD (HL),#212 ADD HL,BC LD (HL),#212 DI LD A,#1 OUT (0x99),A LD A,#0x8E OUT (0x99),A LD A,#0x10 OUT (0x99),A LD A,#0x76 OUT (0x99),A LD HL,#SPRATR+16 LD BC,#0x1898 OTIR EI RET ;--------------------------------------- ; Build Balk commando ;--------------------------------------- SCRL_BB_L: LD A,(BB_WAIT) OR A RET NZ LD A,(B_BALK_TYPE) OR A JR Z,SCRL_BBB_L LD A,(T_BALK_NR) CP #8 RET Z DEC A LD (T_BALK_NR),A JP INIT_BBAR SCRL_BBB_L: LD A,(B_BALK_NR) OR A RET Z DEC A LD (B_BALK_NR),A JP INIT_BBAR SCRL_BB_R: LD A,(BB_WAIT) OR A RET NZ LD A,(B_BALK_TYPE) OR A JR Z,SCRL_BBB_R LD A,(T_BALK_NR) CP #9 RET Z INC A LD (T_BALK_NR),A JP INIT_BBAR SCRL_BBB_R: LD A,(B_BALK_NR) CP #4 RET Z INC A LD (B_BALK_NR),A JP INIT_BBAR SCRL_BB_UP: LD A,(BB_WAIT) OR A RET NZ LD A,(B_BALK_TYPE) CP #0 RET Z LD A,#0 LD (B_BALK_TYPE),A JP INIT_BBAR SCRL_BB_DN: LD A,(BB_WAIT) OR A RET NZ LD A,(B_BALK_TYPE) CP #32 RET Z LD A,#32 LD (B_BALK_TYPE),A INIT_BBAR: LD A,#6 LD (BB_WAIT),A LD A,(B_BALK_TYPE) OR A JR Z,PLACE_BBAR PLACE_TBAR: CALL SPRITES_OFF LD HL,#TBB_VALUE LD A,(T_BALK_NR) SUB #8 ; start op 9 ADD A ADD A LD C,A LD B,#0 ADD HL,BC ; begin van tbb_valuelijst ADD A ADD A ADD A LD D,A CALL INIT_LOOP_BB RET PLACE_BBAR: CALL SPRITES_OFF LD HL,#BBB_VALUE LD A,(B_BALK_NR) ADD A ; * 4 ADD A LD C,A LD B,#0 ADD HL,BC ADD A ADD A ADD A LD D,A INIT_LOOP_BB: LD B,#4 ; aantal plaatjes LD E,#32 ; plaats op scherm LOOP_P_BBAR0: PUSH BC PUSH HL LD A,(HL) CP #0 JP Z,P_BB_EMPTY CP #1 JP Z,P_BB_OCC CP #2 JP Z,P_BB_BUSY JP P_BB_READY END_LOOP_BB: POP HL POP BC LD A,E ADD #32 LD E,A LD A,D ADD #32 END_LOOPBB3: LD D,A INC HL INC HL INC HL INC HL DJNZ LOOP_P_BBAR0 CALL SPRITES_ON RET P_BB_EMPTY: LD IY,#BB_X_COP CALL PUTBLK CALL P_BB_PART JP END_LOOP_BB P_BB_OCC: LD IY,#BB_BLW_COP CALL PUTBLK CALL BB_PUT_BUILD CALL P_BB_PART JP END_LOOP_BB P_BB_BUSY: LD IY,#BB_BLW_COP CALL PUTBLK CALL BB_PUT_BUILD LD IY,#BB_BUSY_COP CALL PUTBLK CALL P_BB_PART JP END_LOOP_BB P_BB_READY: LD IY,#BB_BLW_COP CALL PUTBLK CALL BB_PUT_BUILD LD IY,#BB_READY_COP CALL PUTBLK CALL P_BB_PART JP END_LOOP_BB BB_PUT_BUILD: ; ; check if tank bar LD A,(B_BALK_TYPE) OR A JR Z,BB_PUT_BUILD2 BB_PUT_TANK2: LD IY,#BB_TNK_COP LD A,D LD 0(IY),A JP PUTBLK BB_PUT_BUILD2: LD IY,#BB_BLD_COP LD A,D ; ADD 32 LD 0(IY),A JP PUTBLK P_BB_PART: LD IY,#BB_MOVE_COP LD 4(IY),E ; plek op scherm LD 7(IY),#0 CALL PUTBLK LD 7(IY),#1 CALL PUTBLK RET ;------------------------------------------- SEL_FROM_BB: LD A,(MBUSY) OR A RET NZ LD A,(B_BALK_TYPE) OR A JR Z,SEL_BUILDING LD A,D SUB #32 SRA A SRA A SRA A SRA A SRA A ; / 32 LD B,A LD A,(T_BALK_NR) SUB #8 ADD B LD E,A ADD A ; * 4 ADD A ; LD C,A LD B,#0 LD HL,#TBB_VALUE ADD HL,BC LD A,(HL) OR A ; niet mogelijk RET Z CP #2 ; al bezig RET Z CP #1 ; ga beginnen JP Z,START_BUILD RET RET SEL_BUILDING: LD A,D SUB #32 SRA A SRA A SRA A SRA A SRA A ; / 32 LD B,A LD A,(B_BALK_NR) ADD B LD E,A ADD A ; * 4 ADD A ; LD C,A LD B,#0 LD HL,#BBB_VALUE ADD HL,BC LD A,(HL) OR A ; niet mogelijk RET Z CP #2 ; al bezig RET Z CP #1 ; ga beginnen JP Z,START_BUILD ; anders is ie ready !!!!!! LD A,E LD C,A ADD #64 ; 64 + item LD (ITEMSELECTED),A LD A,#1 LD (MBUSY),A LD HL,#BB_TYPES ; cursor LD B,#0 ADD HL,BC LD A,(HL) LD (BB_SIZE),A LD IX,(TNKADR) RES 7,11(IX) ; geen tank LD IX,#IX_FOR_B ; INC C LD 1(IX),C CALL P_BLD_IMG CALL CANCEL_ITEM RET IX_FOR_B: .db 0,0 START_BUILD: PUSH HL INC HL INC HL INC HL LD A,(HL) LD C,A LD B,#0 CALL CALC_MONEY POP HL JR C,NO_START ; niet genoeg geld LD (HL),#2 LD A,D ; cursor positie AND #0b11100000 LD IY,#BB_BLD2_COP LD 4(IY),A CALL PUTBLK LD A,7(IY) XOR #1 LD 7(IY),A CALL PUTBLK RET NO_START: LD A,#50 LD (ISTEXT),A LD A,#5 CALL INIT_TEXT RET ;----------------------------------------- ; OPTION MENU Win 98 version ! cool ; doet even nix ;----------------------------------------- OPTION_MENU: LD A,#200 LD (ISTEXT),A LD A,#4 CALL INIT_TEXT RET LD A,(MBUSY) OR A RET NZ XOR A LD (MSTOP),A LD (MOUSE_SHAPE),A LD (CURSOR_TYPE),A CALL PULL_DOWN MENU_MAIN: XOR A ; CALL FIRE_BUTTON0 CALL Z,MENU_COOR LD A,(MSTOP) OR A RET NZ JP MENU_MAIN MENU_COOR: LD DE,(MOUSEY) LD A,D CP #96 JR C,MAREA2 CP #144 JR NC,MAREA2 LD A,E CP #125 JR C,MAREA2 CP #140 JR NC,MAREA2 LD A,#1 LD (MSTOP),A RET MAREA2: RET PULL_DOWN: LD A,(SWAP) LD IY,#MENU_COP LD 7(IY),A CALL SPRITES_OFF LD B,#110 DO_SCROLL: XOR A LD (JIFFY),A CALL MENU_SCRL MWAIT_LOOP: LD A,(JIFFY) CP #1 ;JR C,MWAIT_LOOP XOR A LD (JIFFY),A DEC B DEC B JR NZ,DO_SCROLL CALL MENU_SCRL CALL SPRITES_ON RET MENU_SCRL: LD A,#112 SUB B LD 2(IY),B LD 10(IY),A LD 8(IY),A EXX CALL PUTBLK EXX RET ;--------------------------------------------- ; INTERRUPT ROUTINE !!! ;----------------------------------------- INT_ROUTINE: DI PUSH AF ; XOR A ; OUT (0x99),A ; LD A,0x8F ; reg 15 op 0 ; OUT (0x99),A IN A,(0x99) ; CHK OF INT VAN VDP IS AND A JP P,INT_NOT_V9938 PUSH BC PUSH DE PUSH HL PUSH IX PUSH IY EXX PUSH BC PUSH DE PUSH HL CALL INTERRUPT POP HL POP DE POP BC EXX POP IY POP IX POP HL POP DE POP BC INT_NOT_V9938: POP AF EI RETI ; Z80 NORM.... ;--------------------------------------- INTERRUPT: LD A,(ISTEXT) OR A JR Z,INTT_1 DEC A LD (ISTEXT),A INTT_1: LD A,(BB_WAIT) OR A JR Z,INTT_2 DEC A LD (BB_WAIT),A INTT_2: CALL I_READ_BUTTONS ; buttons uitlezen CALL READ_MOUSIE LD A,(ITEMSELECTED) CP #128 JP NC,INTT_3 CP #64 JP NC,PLACE_BB_SPR INTT_3: JP MULTIPLE_SEL RET READ_MOUSIE: ; 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,#SPRATR LD A,(HL) 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 INC HL LD A,(HL) 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,#248 CHK_PIJL_BORD_X3: LD (HL),A MOUSE_SPRITE: DEC HL ; spratr in hl !! LD A,#1 OUT (0x99),A LD A,#0x8E OUT (0x99),A LD A,#0x00 ; ff OUT (0x99),A LD A,#0x76 ; 35 OUT (0x99),A LD BC,#0x0498 OTIR 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 ;----------------------------------------- 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 CHK_SPATIE: IN A,(0xAA) ; check op spatie... AND #0xF0 OR #8 OUT (0xAA),A IN A,(0xA9) AND #1 RET ;-------------------------------------------- ;- SUBS - ;-------------------------------------------- UPDATE_STEPS: LD HL,#BBB_VALUE LD B,#18 UPD_STEPS_L1: LD A,(HL) CP #2 JP Z,DO_STEP_UPD INC HL INC HL INC HL INC HL UPD_STEPS_L2: DJNZ UPD_STEPS_L1 RET DO_STEP_UPD: INC HL LD A,(HL) LD C,A INC HL LD A,(HL) ADD C CP #255 JP Z,STEP_READY LD (HL),A INC HL INC HL JP UPD_STEPS_L2 STEP_READY: DEC HL DEC HL LD (HL),#3 JP UPD_STEPS_L1 ;--------------------------------------- MULTIPLE_SEL: LD A,(PLAYFIELD) OR A JR Z,LABEL0009 LD A,(FIRE_BUTTONS) BIT 4,A JR Z,MS_1 LABEL0009: ; ; ms uit XOR A LD (MS_COUNT),A LD (HAS_SELECT),A LD (TOTAL_SELECT),A LD B,#4 LD IX,#SPRATR+40 LD DE,#4 LABEL0008: LD 0(IX),#212 EXX CALL PUT_SPRITE2 EXX ADD IX,DE DJNZ LABEL0008 RET MS_1: LD A,(MS_COUNT) CP #10 JR Z,MS_2_2 INC A LD (MS_COUNT),A CP #9 RET NZ MS_2: INC A LD (MS_COUNT),A LD HL,#SPRATR LD E,(HL) INC HL LD D,(HL) LD (ORIGIN_Y),DE LD A,#1 LD (HAS_SELECT),A EXX LD A,(MSELECT_ON) OR A CALL NZ,MSEL_OFF EXX MS_2_2: LD HL,#SPRATR LD E,(HL) INC HL LD D,(HL) LD A,(ORIGIN_X) CP D JR NC,LABEL0005 LD (SEL_X0),A LD A,D LD (SEL_X1),A JP LABEL0006 LABEL0005: LD (SEL_X1),A LD A,D LD (SEL_X0),A LABEL0006: LD A,(ORIGIN_Y) CP E JR NC,LABEL0007 LD (SEL_Y0),A LD A,E LD (SEL_Y2),A JP SEL_METH1 LABEL0007: LD (SEL_Y2),A LD A,E LD (SEL_Y0),A SEL_METH1: LD BC,(SEL_Y0) LD HL,(SEL_Y2) LD DE,#4 LD IX,#SPRATR+40 LD 0(IX),C LD 1(IX),B EXX CALL PUT_SPRITE2 EXX ADD IX,DE LD 0(IX),L LD 1(IX),B EXX CALL PUT_SPRITE2 EXX ADD IX,DE LD 0(IX),C LD 1(IX),H EXX CALL PUT_SPRITE2 EXX ADD IX,DE LD 0(IX),L LD 1(IX),H CALL PUT_SPRITE2 RET ORIGIN_Y: .db 0 ORIGIN_X: .db 0 SEL_Y0: .db 0 SEL_X0: .db 0 SEL_Y2: .db 0 SEL_X1: .db 0 ;------------------------------------------ A_TO_IY: EXX ; schaduw BC,DE,HL !!!! OR A CALL Z,CRASH LD IY,#TANK1-32 RRC A RRC A RRC A LD B,A AND #0b11100000 LD C,A LD A,B AND #0b00011111 LD B,A ADD IY,BC EXX RET HL_TO_IX: INC HL LD A,(HL) DEC HL A_TO_IX: EXX ; schaduw BC,DE,HL !!!! OR A CALL Z,CRASH LD IX,#TANK1-32 RRC A RRC A RRC A LD B,A AND #0b11100000 LD C,A LD A,B AND #0b00011111 LD B,A ADD IX,BC EXX RET CRASH: CALL COLOR_WHITE ; POP HL ; POP HL ; LD (CRASH_ADR),HL ;LD HL,#INT_DOS ;CALL PUT_INT ;CALL SET_SCREEN0 ;LD SP,(EXIT_STACK) RET ; einde prog EXIT_STACK: .dw 0 CRASH_ADR: .dw 0 A_TO_BLD: LD IY,#BUILDING1-BUILD_DATA EXX LD C,A LD B,#0 SLA C ; *2 RL B SLA C ; *4 RL B LD D,B ; DE met 4maal LD E,C ADD IY,DE ADD IY,DE ; *8 ADD IY,DE ; *12 LD C,A LD B,#0 ADD IY,BC EXX RET ;---------------------------------------------- VELD: LD A,(SWAP) LD (DOEL_PAGE),A XOR A LD (DOEL_Y),A LD (DOEL_X),A LD HL,(ADR) DEC H DEC HL DEC HL DEC HL DEC HL LD DE,#CPYTT LD B,#12 ; 12 * 12 cpytt ; x in lengte LD C,#12 J8CAF: LD A,(HL) EX AF,AF LD A,C CP #1 JR Z,MAKE_CPYTT CP #12 JR Z,MAKE_CPYTT LD A,B CP #1 JR Z,MAKE_CPYTT CP #12 JR Z,MAKE_CPYTT LD A,(HL) OR A INC HL JR Z,PUT_FIELD LD A,#16 LD (BRON_X),A XOR A JR CONT_VELD PUT_FIELD: LD A,(HL) ADD A ADD A ADD A ADD A LD (BRON_X),A LD A,(HL) AND #0b11110000 CONT_VELD: LD (BRON_Y),A LD A,(DOEL_X) ADD #16 LD (DOEL_X),A EXX LD HL,#FASTCOP DI ; vdp klaar ? LD A,#32 ; reg 32 + GEEN auto inc. OUT (0x99),A ; als control register LD A,#0x91 ;in reg 17 OUT (0x99),A LD A,#2 ; waarde 2 in reg 15 OUT (0x99),A LD A,#0x8F ; execute OUT (0x99),A LUS3: IN A,(0x99) ;lees status RRA ; is CE nog 1 dan C is loop JR C,LUS3 XOR A ; status reg. op 0 OUT (0x99),A LD A,#0x8F OUT (0x99),A LD C,#0x9B OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI EI EXX DEC HL MAKE_CPYTT: INC HL INC HL EX AF,AF OR A JR NZ,CONT_CPYTT LD A,(HL) OR A JR Z,CONT_CPYTT BLW_CPYTT: LD A,#1 LD (DE),A INC DE LD A,(HL) ; nummer tank of zo ??? LD (DE),A INC DE CONT_CPYTT: INC HL INC HL DEC B JP NZ,J8CAF DEC C JR Z,END_VELD LD A,(DOEL_Y) ADD #16 LD (DOEL_Y),A XOR A LD (DOEL_X),A LD A,C LD BC,#208 ; 54+128 ; !!! 64-10 + 2*64 ADC HL,BC LD C,A LD B,#12 JP J8CAF END_VELD: XOR A LD (DE),A INC DE LD (DE),A ; laatste entry leeg RET ;---------------------------------------- MLBC16: LD B,#0 LD C,A SLA C RL B SLA C RL B SLA C RL B SLA C RL B RET ;----------------------------------------- PTANK: LD A,(OFFSET) LD B,A LD A,0(IX) SUB B INC A ADD A,A ADD A,A ADD A,A ADD A,A ADD A,4(IX) LD 4(IY),A CP #16 JP C,CONT2 CP #161 JP NC,CONT2 LD A,(OFFSET+1) LD B,A LD A,1(IX) SUB B INC A ADD A,A ADD A,A ADD A,A ADD A,A ADD A,5(IX) LD 6(IY),A CP #16 JP C,CONT2 CP #161 JP NC,CONT2 CALL RITANK CALL PUTBLK LD 0(IY),#0 LD 2(IY),#160 BIT 0,22(IX) JP Z,IN_SCREEN LD HL,#0 ; super multiple select update LD A,4(IY) SRL A LD C,A LD B,#0 ADD HL,BC LD A,6(IY) LD D,A LD B,A SRL B RR C LD C,#0 ADD HL,BC LD A,D AND #0b10000000 RLC A LD E,A CALL SETVDP LD A,#0xFF OUT (0x98),A LD BC,#7 ADD HL,BC LD A,E CALL SETVDP LD A,#0xFF OUT (0x98),A ;---------------------------------- LD BC,#15*128-7 ADD HL,BC LD A,D ADD #15 AND #0b10000000 RLC A LD E,A CALL SETVDP LD A,#0xFF OUT (0x98),A LD BC,#7 ADD HL,BC LD A,E CALL SETVDP LD A,#0xFF OUT (0x98),A JP IN_SCREEN PTANK_UP: LD 4(IY),C LD 6(IY),B LD A,#176 SUB B LD 10(IY),A LD 8(IY),#16 CALL RITANK CALL PUTBLK LD 2(IY),#160 LD 10(IY),#16 LD 0(IY),#0 RET PTANK_LT: LD 6(IY),B LD 4(IY),C LD A,#176 SUB C LD 8(IY),A ; LD 4(IY),A LD 10(IY),#16 CALL RITANK CALL PUTBLK LD 0(IY),#0 LD 2(IY),#160 RET PTANK_DN: LD 4(IY),C LD 10(IY),B LD A,#16 SUB B ADD #160 LD 2(IY),A LD 6(IY),#16 LD 8(IY),#16 CALL RITANK CALL PUTBLK LD 0(IY),#0 LD 2(IY),#160 RET PTANK_RI: LD 6(IY),B LD 8(IY),C ; offset copieren LD A,#16 SUB C LD 0(IY),A LD 4(IY),#16 LD 10(IY),#16 CALL RITANK CALL PUTBLK LD 0(IY),#0 LD 2(IY),#160 RET RITANK: LD A,9(IX) ; richting AND #0b00000111 ; eventuele radar found bitje weg.. ADD A,A ADD A,A ADD A,A ADD A,A ADD A,0(IY) LD 0(IY),A LD A,11(IX) AND #0b00000111 ; type tank ADD A,A ADD A,A ADD A,A ADD A,A ADD A,2(IY) LD 2(IY),A LD A,13(IX) AND #0b10000000 ;soort bit ADD A,0(IY) LD 0(IY),A RET ;--------------------------------------------- XYTO16: LD A,D SRL A SRL A SRL A SRL A LD B,A LD A,(OFFSET) ADD A,B DEC A LD D,A LD A,E SRL A SRL A SRL A SRL A LD B,A LD A,(OFFSET+1) ADD A,B DEC A LD E,A RET ;------------------------------------ ;--- sub routine blocked !!! ;----------------------------------- BLCKED: LD A,(HL) CP #64 RET ; deze return waarde kan nog veranderen ! CALC_ADR: LD HL,#VELD_ADRES LD A,C ; Y MAAL 256 ADD H LD H,A SLA B ; X MAAL 4 SLA B LD C,B LD B,#0 ADD HL,BC ; plus x INC HL RET ; ; PUSH HL ; PUSH IX ; INC HL ; LD A,(HL) ; OR A ; JR Z,CALC_ADR2 ; CALL A_TO_IX ; LD B,0(IX) ; LD C,1(IX) ; LD HL,VELD_ADRES ; LD A,C ; Y MAAL 256 ; ADD H ; LD H,A ; SLA B ; X MAAL 4 ; SLA B ; LD C,B ; LD B,0 ; ADD HL,BC ; plus x ; INC HL ; POP IX ; POP BC ; SBC HL,BC ;JP NZ,CRASH ; PUSH BC ; POP HL ; RET ; CALC_ADR2: ; POP IX ; POP HL ; RET ;-------------------------------------- ; UPD_TANK_LAY ;-------------------------------------- RES_TANK_LAY: LD B,0(IX) LD C,1(IX) CALL CALC_ADR LD A,(HL) CP #1 JR Z,RES_TANK_LAY2 CP #16 JR NC,RES_TANK_LAY2 LD A,9(IX) AND #0b00000011 ADD #2 LD (HL),A RES_TANK_LAY2: LD B,#0 LD A,13(IX) CP #127 JR NC,NO_RADREVEAL ; rood ontdekt niet !! LD B,#255 NO_RADREVEAL: INC B INC HL LD (HL),#0 ; RESET tank positie RET ;----------------------------------------------- CLEAR_ITEM: XOR A LD (ITEMSELECTED),A LD (CURSOR_TYPE),A LD (MBUSY),A LD (ACTIVE_MENU),A ; commando balk reset CALL SPRITES_OFF LD IY,#MENU_COM_CLN XOR A LD 7(IY),A LD A,#72 LD 6(IY),A CALL PUTBLK LD A,#80 LD 6(IY),A CALL PUTBLK LD A,#88 LD 6(IY),A CALL PUTBLK LD A,#96 LD 6(IY),A CALL PUTBLK LD A,#58 LD 6(IY),A CALL PUTBLK LD IY,#MENU_COM_SWP CALL PUTBLK LD IY,#EMPTY LD 7(IY),#0 CALL PUTBLK LD 7(IY),#1 CALL PUTBLK JP SPRITES_ON SHOW_POWER: LD A,(ITEMSELECTED) OR A RET Z CP #2 JP Z,HARV_INHOUD CP #127 JR NC,BUILDING_POW CP #64 RET NC LD IX,(TNKADR) LD A,12(IX) ; power berekenen JP SHOW_POW2 BUILDING_POW: LD IX,(P_BUILD) LD A,6(IX) SHOW_POW2: EX AF,AF LD A,(SWAP) XOR #1 LD E,A LD IY,#POWER_INFO ; volledige balk LD 7(IY),E ; naar onzichtbare scherm CALL PUTBLK EX AF,AF SRL A SRL A SRL A LD B,A LD A,#31 SUB B RES 0,A ; even getal OR A JR Z,SHOW_POW3 ; full power ; LD IY,#POWER_BALK LD 8(IY),A LD 7(IY),E CALL PUTBLK SHOW_POW3: LD IY,#POWER_COP LD 3(IY),E ; from onzichtbaar LD A,E XOR #1 LD 7(IY),A ; to zichtbaar CALL PUTBLK ; nou nog het upgrade balkje LD A,(ITEMSELECTED) CP #127 RET C BIT 1,8(IX) RET Z ; geen upgrade bar LD A,11(IX) ; upgrade status OR A RET Z SRL A SRL A SRL A RES 0,A OR A RET Z LD B,A LD IY,#HARV_BALK LD A,#32 SUB B LD 2(IY),A ADD #24 LD 6(IY),A LD 10(IY),B LD A,(SWAP) LD 7(IY),A EX AF,AF CALL PUTBLK LD IY,#HARV_COP EX AF,AF LD 3(IY),A XOR #1 LD 7(IY),A JP PUTBLK RET HARV_INHOUD: ; ; harv inhoud displayen LD IX,(TNKADR) LD A,16(IX) CP #7 RET C SUB #6 SRL A LD B,A LD IY,#HARV_BALK LD A,#32 SUB B LD 2(IY),A ADD #24 LD 6(IY),A LD 10(IY),B LD A,(SWAP) LD 7(IY),A EX AF,AF CALL PUTBLK LD IY,#HARV_COP EX AF,AF LD 3(IY),A XOR #1 LD 7(IY),A JP PUTBLK COMMAND_TANK: LD D,#0b10000111 JP EXTRACT_COM COMMAND_HARV: LD D,#0b00011110 JP EXTRACT_COM COMMAND_B: LD IY,(P_BUILD) LD D,#0b01000000 BIT 0,8(IY) JR NZ,COMMAND_B3 LD D,#0b00100000 BIT 1,8(IY) JR NZ,COMMAND_B3 LD D,#0 LD A,6(IY) CP #255 ; niet helemaal JR Z,COMMAND_B2 ; ?huh LD D,#0b01000000 COMMAND_B2: LD A,10(IY) SUB 9(IY) JR Z,COMMAND_B4 LD A,#0b00100000 OR D LD D,A JP COMMAND_B4 COMMAND_B3: LD A,#0b10000000 OR D LD D,A COMMAND_B4: JP EXTRACT_COM CANCEL_ITEM: LD D,#0b10000000 JP EXTRACT_COM COMMAND_ENM: LD D,#0 EXTRACT_COM: CALL SPRITES_OFF LD IY,#MENU_COM_CLN XOR A LD 7(IY),A LD A,#72 LD 6(IY),A CALL PUTBLK LD A,#80 LD 6(IY),A CALL PUTBLK LD A,#88 LD 6(IY),A CALL PUTBLK LD A,#96 LD 6(IY),A CALL PUTBLK BIT 0,D LD IY,#MENU_COM_ATT CALL NZ,PUTBLK BIT 1,D LD IY,#MENU_COM_MOV CALL NZ,PUTBLK BIT 2,D LD IY,#MENU_COM_STP CALL NZ,PUTBLK BIT 3,D LD IY,#MENU_COM_RET CALL NZ,PUTBLK BIT 4,D LD IY,#MENU_COM_HRV CALL NZ,PUTBLK BIT 5,D LD IY,#MENU_COM_UPG CALL NZ,PUTBLK BIT 6,D LD IY,#MENU_COM_REP CALL NZ,PUTBLK BIT 7,D LD IY,#MENU_COM_CAN CALL NZ,PUTBLK LD IY,#MENU_COM_SW2 CALL PUTBLK JP SPRITES_ON ;------------------------------------------- REMOVE_TANK: ; XOR A ; sample nummer 0 ; CALL PLAY LD D,0(IX) LD E,1(IX) LD B,D LD C,E PUSH IX LD IX,#PLOF_BUF LD 0(IX),D LD 1(IX),E CALL ADD_PLOFJE POP IX CALL CALC_ADR ; 2 byte veld layer op 0 LD A,(HL) CP #16 JR NC,REMOVE_TANK2 LD A,R AND #0b00000011 ADD #6 LD (HL),A REMOVE_TANK2: INC HL LD (HL),#0 LD C,25(IX) ; Y LD B,24(IX) ; X CALL CALC_ADR DEC HL LD A,(HL) OR A JR NZ,REMOVE_TANK3 INC HL CALL POINT LD D,A CALL PLACE_UNIT REMOVE_TANK3: BIT 7,11(IX) CALL NZ,CLEAR_ITEM LD A,23(IX) AND #0x0F CALL NZ,AI_UPDATE ; ALS TNK EEN MIS HEEFT UPD DAN LD A,13(IX) ; nummer tank LD H,A LD B,#254 ; tank sum LD DE,#TANK_DATA ;loop door de tabel om attack LD IY,#TANK1 ; nummers te resetten !! LABEL0010: LD A,14(IY) CP H CALL Z,RES_ATTACK ADD IY,DE DJNZ LABEL0010 ; remove tank uit tnk_totaal ; verschilt per tank LD A,13(IX) CP #128 JR C,REM_TNK_BLW LD HL,(DED_CNT_RED) INC HL LD (DED_CNT_RED),HL LD HL,#TNK_CNT_RED JR LABEL0012 REM_TNK_BLW: LD HL,(DED_CNT_BLW) INC HL LD (DED_CNT_BLW),HL LD HL,#TNK_CNT_BLW LABEL0012: DEC (HL) PUSH IX POP HL LD BC,#TANK_DATA LABEL0011: LD (HL),#0 INC HL DEC BC LD A,B OR C JP NZ,LABEL0011 RET RES_ATTACK: LD 14(IY),#0 RES 5,11(IY) RES 6,11(IY) SET 4,11(IY) LD A,22(IY) ; reset inslag shoot en AND #0b10000001 ; of er op je geschotenis LD 22(IY),A LD A,0(IY) LD 2(IY),A LD A,1(IY) LD 3(IY),A RET REMOVE_BUILD: LD IX,#PLOF_BUF LD D,2(IY) LD E,3(IY) LD B,D LD C,E CALL CALC_ADR LD B,5(IY) ;hoogte gebouw REM_B_LOOPY: PUSH HL PUSH DE PUSH BC LD B,4(IY) ; lengte gebouw REM_B_LOOPX: LD 0(IX),D LD 1(IX),E CALL ADD_PLOFJE LD A,R AND #0b00000011 ADD #65 LD (HL),A ; random stukje INC D INC HL INC HL INC HL INC HL DJNZ REM_B_LOOPX POP BC POP DE POP HL INC E INC H DJNZ REM_B_LOOPY LD HL,#BUILDINGS DEC (HL) ; gebouw -1 LD A,0(IY) LD 0(IY),#0 ; nummer op 0 is gebouw weg LD A,(ITEMSELECTED) BIT 7,A RET Z PUSH IY POP BC LD IX,(P_BUILD) PUSH IX POP HL SBC HL,BC JP Z,CLEAR_ITEM RET ;----------------------------------- ; ADD_PLOFJE ; ; IN: PLOF_BUF GEVULD ! X EN Y ; ;----------------------------------- PLOF_BUF: .db 0,0 ADD_PLOFJE: EXX LD A,(PLOF_BUF) LD D,A LD A,(PLOF_BUF+1) LD E,A LD HL,#PLOF_TABEL INC HL INC HL LD A,#80 ; max ontplof stukjes LD B,A CHECK_PLOF: LD A,(HL) OR A JR Z,LABEL0002 INC HL INC HL INC HL DJNZ CHECK_PLOF ; even opletten RET ; max. plof bereikt LABEL0002: LD A,(PLOF_COUNT) INC A ; 1 plofke erbij LD (PLOF_COUNT),A LD (HL),#8 ; NUMMER DEC HL LD (HL),E ; EN Y DEC HL LD (HL),D ; EN X EXX RET ;---------------------------------- ; SPICE PLOF ;---------------------------------- WAIT: .db 0 SPICE_BOOM: LD A,(WAIT) INC A AND #0b00000111 LD (WAIT),A RET NZ LD IX,(TNKADR) LD B,0(IX) LD C,1(IX) CALL CALC_ADR PUSH HL LD IX,#SPICE_RAD LD B,#9 SPICE_BOOM_LP: POP HL PUSH HL LD E,0(IX) LD D,1(IX) ADC HL,DE LD D,#0 LD A,(HL) CP #48 JR NC,END_BOOM_LP CP #16 JR C,NORMAL_SPICE CP #32 JR C,EXTRA_SPICE LD (HL),#32 JR END_BOOM_LP EXTRA_SPICE: LD A,#16 LD D,A NORMAL_SPICE: LD A,2(IX) ADD D LD (HL),A END_BOOM_LP: LD DE,#3 ADD IX,DE DJNZ SPICE_BOOM_LP POP HL RET ;----------------------------------- ; Music Module init ;----------------------------------- MMODULE_INIT: LD B,#12 LD HL,#PDATA_1 PLOOP1: LD A,(HL) OUT (0xC0),A ; OUT REG INC HL LD A,(HL) OUT (0xC1),A ; OUT INHOUD INC HL DJNZ PLOOP1 ; TILL B=0 RET ;------------------------------------ ; Play a sample ; A register bevat nummer sample ;----------------------------------- PLAY: LD HL,#SAMPLES SLA A LD C,A LD B,#0 ADD HL,BC LD E,(HL) INC HL LD D,(HL) EX DE,HL LD B,#6 PLOOP2: LD A,(HL) OUT (0xC0),A ; OUT REG INC HL LD A,(HL) OUT (0xC1),A ; OUT INHOUD INC HL DJNZ PLOOP2 ; TILL B=0 RET SAMPLES: .dw SAM_PLOF1 .dw SAM_PLOF2 SAM_PLOF1: .db 7,1 ; MOET!!! .db 9,0 .db 10,0 .db 11,0xFF ; EI LOW .db 12,0x07 ; EI HI .db 7,0xA0 ; IETS (0xA0 IS PLAY) SAM_PLOF2: .db 7,1 ; MOET!!! .db 9,0 .db 10,0 .db 11,0xFF ; EI LOW .db 12,0x07 ; EI HI .db 7,0xA0 ; IETS (0xA0 IS PLAY) ; --------- swap mode ---------------- CHANGE_INT: DI ; is dit nodig ? LD A,(0xF3DF) RES 4,A LD (0xF3DF),A OUT (0x99),A LD A,#128+0 OUT (0x99),A LD A,#16 OUT (0x99),A LD A,#128+19 OUT (0x99),A EI RET ;--------------------------------- ; CALCULATE MONEY ; BC bevat bedrag * 10 ; UIT Carry is te weinig !!! ;--------------------------------- CALC_MONEY: LD HL,(MONEY) SBC HL,BC RET C LD (MONEY),HL RET ;--------------------------------- ; PLAATS MONEY ;---------------------------------- PUT_MONEY: LD HL,(DIS_MONEY) LD BC,(MONEY) SBC HL,BC RET Z LD HL,(DIS_MONEY) JR C,INC_MONEY DEC HL DEC HL DEC HL DEC HL INC_MONEY: INC HL INC HL LD (DIS_MONEY),HL LD IY,#DEEL2 LD IX,#MONEY_CHAR LD B,#5 ; aantal cijfers te delen CALL DLINI LD IX,#MONEY_CHAR LD HL,(MONEY_POS) LD D,#5 JP PUT_CHARS PUT_FPS: RET ; LD HL,(DED_CNT_RED) ; LD IY,DEEL2 ; LD IX,MONEY_CHAR ; LD B,5 ; aantal cijfers te delen ; CALL DLINI ; ; LD IX,MONEY_CHAR ; LD HL,(MONEY_POS) ; LD D,5 ; JP PUT_CHARS ;---------------------------------- ; DEEL - delen van getallen ;---------------------------------- DLINI: LD D,1(IY) LD E,0(IY) XOR A DEEL: SBC HL,DE JR C,ENDLP1 INC A JR DEEL ENDLP1: ADD HL,DE LD 0(IX),A LD A,B CP #1 RET Z INC IX INC IY INC IY DEC B LD D,1(IY) LD E,0(IY) XOR A JR DEEL ;---------------------------------------- ; PUT KARAKTER ;------------------------------------- PUT_CHARS: LD IY,#LETCOP LD 4(IY),L LD 6(IY),H PUT1LP: LD A,0(IX) SLA A SLA A SLA A ;3 KEER = 8 > 2^3 ;LD B,A ; LD A,96 ;ADD B LD 0(IY),A CALL PUTBLK LD A,7(IY) XOR #1 LD 7(IY),A CALL PUTBLK LD A,4(IY) ADD #8 LD 4(IY),A INC IX DEC D JR NZ,PUT1LP RET ;-------------------------------------------- INIT_TEXT: EXX LD HL,#TEXTTAB LD B,#0 LD C,A SLA C RL B ADD HL,BC LD E,(HL) INC HL LD D,(HL) LD (TEXTADR),DE EXX RET ;-------------------------------------------- PUT_TEXT: LD IY,#LETCOP2 LD DE,(TEXTADR) LD 4(IY),#20 LD 6(IY),#20 PUT2LP: LD A,(DE) CP #255 RET Z CP #32 JR Z,PUT2LP_CONT DEBUG: SUB #46 LD B,#0 SLA A RL B SLA A RL B SLA A ;3 KEER = 8 > 2^3 RL B LD 0(IY),A SLA B SLA B SLA B LD A,B ADD #136 LD 2(IY),A LD A,(SWAP) LD 7(IY),A CALL PUTBLK PUT2LP_CONT: INC DE LD A,4(IY) ADD #6 LD 4(IY),A CP #160 JR C,PUT2LP LD A,6(IY) ADD #8 LD 6(IY),A LD A,#20 LD 4(IY),A JR PUT2LP ;-------------------------------------- ; routine voor kopieren van stukken scherm ; gewijzigd worden ; AF ; BC ; HL PUTBLK: DI ; vdp klaar ? LD A,#2 ; waarde 2 in reg 15 OUT (0x99),A LD A,#0x8F ; execute OUT (0x99),A NOP NOP ; wacht op vdp LUS2: IN A,(0x99) ;lees status RRA ; is CE nog 1 dan C is loop JR C,LUS2 XOR A ; status reg. op 0 OUT (0x99),A LD A,#0x8F ; reg 15 op 0 voor int! OUT (0x99),A PUSH IY ; hl moet iy bevatten !! POP HL LD A,#0x20 ; register 32 OUT (0x99),A ; als control register LD A,#0x91 ;in reg 17 OUT (0x99),A ; LD BC,0x0F9B ; 15 bytes naar port 9b LD C,#0x9B OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI EI RET ;-------------------------------------------- ; put sprite ; in = IX met attribuut tabel bevat ook nummer sprite ;----------------------------------------- PUT_SPRITE: DI LD A,#1 OUT (0x99),A LD A,#0x8E OUT (0x99),A LD C,3(IX) LD B,#0 LD HL,#0x7600 ; ipv 35FF ADD HL,BC LD A,L OUT (0x99),A LD A,H OUT (0x99),A PUSH IX POP HL ; hl bevat attribuut tabel LD BC,#0x0498 OTIR EI RET PUT_SPRITE2: LD A,#1 OUT (0x99),A LD A,#0x8E OUT (0x99),A LD C,3(IX) LD B,#0 LD HL,#0x7600 ; ipv 35FF ADD HL,BC LD A,L OUT (0x99),A LD A,H OUT (0x99),A PUSH IX POP HL ; hl bevat attribuut tabel LD BC,#0x0498 OTIR RET SPRITE_CLR: LD A,#1 ; Zet sprite kleur OUT (0x99),A LD A,#0x8E OUT (0x99),A LD HL,#0x7400 ; 33FF ADD HL,BC LD A,L OUT (0x99),A LD A,H OUT (0x99),A EX DE,HL LD BC,#0x1098 OTIR RET PLACE_BB_SPR: XOR A LD (BB_BLOCKED),A LD A,#1 LD (BB_OUT_RANGE),A LD IX,#SPRATR+16 LD IY,#BB_SERIE LD HL,#SPRATR LD A,(HL) AND #0b11110000 LD E,A INC HL LD A,(HL) AND #0b11110000 LD D,A PUSH DE CALL XYTO16 ; adres van eerste LD B,D LD C,E CALL CALC_ADR LD A,(BB_SIZE) LD 0(IY),A ; size in serie INC IY LD B,A SPR_LOOP0: LD A,(BB_OUT_RANGE) OR A JR Z,SPR_LOOP0_CNT CALL IS_OUT_RANGE ; LD A,(BB_OUT_RANGE) ; OR A ; JR NZ,ADD_RED SPR_LOOP0_CNT: DEC HL LD A,(HL) INC HL LD D,(HL) INC HL LD E,(HL) DEC HL OR A JR NZ,ADD_RED LD A,E OR A JR NZ,ADD_RED LD A,D CP #64 JR C,ADD_RED CP #80 JR NC,ADD_RED ADD_WHT: XOR A LD 0(IY),A JP END_LOOP0 ADD_RED: LD A,#1 LD 0(IY),A END_LOOP0: INC IY CALL CALC_NXT_ADR DJNZ SPR_LOOP0 POP DE ;adres weer terug LD IY,#BB_SERIE LD B,0(IY) LD C,#0 INC IY SPR_LOOP1: PUSH BC PUSH DE LD A,E CP #16 JP C,OUT_RANGE CP #176 JP NC,OUT_RANGE LD A,D CP #16 JP C,OUT_RANGE CP #176 JP C,IN_RANGE OUT_RANGE: LD E,#212 IN_RANGE: LD 0(IX),E LD 1(IX),D CALL KAN_BB_SPR POP DE LD BC,#4 ADD IX,BC INC IY POP BC INC C CALL NEXT_COOR DJNZ SPR_LOOP1 RET NEXT_COOR: LD A,B DEC A RET Z CP #1 JP Z,NEXT_COOR1 CP #2 JP Z,NEXT_COOR2 CP #3 JP Z,NEXT_COOR1 CP #4 JP Z,NEXT_COOR2 NEXT_COOR1: LD A,E ADD A,#16 LD E,A RET NEXT_COOR2: LD A,D ADD A,#16 LD D,A LD A,E SUB #16 LD E,A RET CALC_NXT_ADR: LD A,B DEC A RET Z CP #1 JP Z,NEXT_ADR1 CP #2 JP Z,NEXT_ADR2 CP #3 JP Z,NEXT_ADR1 CP #4 JP Z,NEXT_ADR2 NEXT_ADR1: INC H RET NEXT_ADR2: DEC H INC HL INC HL INC HL INC HL RET KAN_BB_SPR: LD A,C ADD #4 LD C,A SLA C SLA C SLA C SLA C LD B,#0 LD A,0(IY) CP #0 JP Z,BB_SPR_WHT JP BB_SPR_RED IS_OUT_RANGE: PUSH HL LD D,#1 DEC H CALL BB_TEST_RANGE INC HL INC HL INC HL INC HL CALL BB_TEST_RANGE INC H CALL BB_TEST_RANGE INC H CALL BB_TEST_RANGE DEC HL DEC HL DEC HL DEC HL CALL BB_TEST_RANGE DEC HL DEC HL DEC HL DEC HL CALL BB_TEST_RANGE DEC H CALL BB_TEST_RANGE DEC H CALL BB_TEST_RANGE POP HL LD A,D LD (BB_OUT_RANGE),A RET BB_TEST_RANGE: LD A,(HL) CP #128 RET NC LD (STORAGE1),A LD A,(ITEMSELECTED) CP #64 JR NZ,BB_TEST_RANGE2 LD A,(HL) CP #64 JR Z,BB_TEST_RANGE3 BB_TEST_RANGE2: LD A,(STORAGE1) CP #96 RET C BB_TEST_RANGE3: LD D,#0 RET STORAGE1: .db 0 BB_SPR_WHT: LD A,(BB_OUT_RANGE) OR A JR NZ,BB_SPR_RED LD DE,#SPRKLR_WHT CALL SPRITE_CLR JP PUT_SPRITE2 BB_SPR_RED: LD A,#1 LD (BB_BLOCKED),A LD DE,#SPRKLR_RD CALL SPRITE_CLR JP PUT_SPRITE2 ;-------------------------------------------------- ; ADD TANK !! ; ; routine die een tank toevoegd ; ; IN: ; HL = coordinaten H=Y L=X ; BC = soort tank & type B=soort C=type ; ; UIT: ; A = nummer tank > 0 is gelukt ; ;----------------------------------------------- ADD_TANK: LD A,B OR A JP Z,ADD_TNK_RED LD A,(TNK_CNT_BLW) CP #127 ; NIET MEER DAN 127 TANKS LD A,#0 RET Z ; LD A,(TNK_CNT_BLW) INC A LD (TNK_CNT_BLW),A LD IX,#TEMPLATE_TNK LD 11(IX),C LD 0(IX),H ; X EN Y LD 2(IX),H LD 1(IX),L ; LD 3(IX),L ; dest. = source LD IY,#TANK1 LD DE,#TANK_DATA LD B,#0 ; niet 0 MAAR 1 !!!!! LP_CALC_BLW: INC B LD A,13(IY) OR A JR Z,ADD_TANK3 ADD IY,DE JR LP_CALC_BLW ADD_TANK3: LD 13(IX),B ; nummer LD 12(IX),#255 ; power LD HL,#TEMP_HARV ; search template LD B,#0 SLA C SLA C ADD HL,BC LD A,(HL) LD 10(IX),A ;speed byte INC HL LD A,(HL) LD 16(IX),A ; attack INC HL LD A,(HL) LD 17(IX),A ; shield INC HL LD A,(HL) LD 18(IX),#1 ; wait time LD 19(IX),A PUSH IX POP HL ;bron LD BC,#TANK_DATA ; aantal PUSH IY POP DE ; dest LDIR LD B,0(IY) LD C,1(IY) CALL CALC_ADR LD A,13(IX) INC HL LD (HL),A ; update veld layer DEC HL DEC HL LD (HL),#0 RET ADD_TNK_RED: LD A,(TNK_CNT_RED) CP #127 ; NIET MEER DAN 127 TANKS LD A,#0 RET Z ; LD A,(TNK_CNT_RED) INC A LD (TNK_CNT_RED),A LD IX,#TEMPLATE_TNK LD 11(IX),C LD 0(IX),H ; X EN Y LD 2(IX),H LD 1(IX),L ; LD 3(IX),L ; dest. = source LD IY,#TANKRED LD DE,#TANK_DATA LD B,#127 ; dan is ie 128 bij de eerste loop LP_CALC_RED: INC B LD A,13(IY) OR A JR Z,ADD_TANK4 ADD IY,DE JR LP_CALC_RED ADD_TANK4: LD 13(IX),B ; nummer LD 12(IX),#255 ; power LD HL,#TEMP_HARV ; search template LD B,#0 SLA C SLA C ADD HL,BC LD A,(HL) LD 10(IX),A ;speed byte INC HL LD A,(HL) LD 16(IX),A ; attack INC HL LD A,(HL) LD 17(IX),A ; shield INC HL LD A,(HL) LD 18(IX),#1 ; wait time LD 19(IX),A PUSH IX POP HL ;bron LD BC,#TANK_DATA ; aantal PUSH IY POP DE ; dest LDIR LD B,0(IY) LD C,1(IY) CALL CALC_ADR LD A,13(IX) INC HL LD (HL),A ; update veld layer RET TEST_ADD_TNK: ; LD HL,(MONEY) ; MAX 2TOTDE15 ; LD BC,30 ; XOR A ; SBC HL,BC ; RET C LD A,R AND #0b00000011 ADD #25 LD B,A LD C,#18 PUSH BC CALL CALC_ADR INC HL LD A,(HL) OR A POP HL RET NZ LD A,R AND #0b00000001 LD B,#1 ; 1 = blauw / 0 = rood LD A,#3 ; random tank !! ; AND 0b00000011 ; joepie werkt !! INC A ; 0 = 1 / 3 = 4 LD C,A CALL ADD_TANK OR A RET Z LD HL,(MONEY) ; MAX 2TOTDE15 LD BC,#30 XOR A SBC HL,BC LD (MONEY),HL RET MAKE_RED_BASE: LD B,#25 ; over de steentjes heen.... LD C,#13 ; dit moet ook weg !! CALL CALC_ADR LD (HL),#96 INC HL INC HL INC HL INC HL LD (HL),#97 INC H LD (HL),#99 DEC HL DEC HL DEC HL DEC HL LD (HL),#98 LD B,#50 ; dit kan dus hierna weer weg ! LD C,#46 CALL CALC_ADR LD (HL),#112+16 INC HL INC HL INC HL INC HL LD (HL),#113+16 INC H LD (HL),#115+16 DEC HL DEC HL DEC HL DEC HL LD (HL),#114+16 LD B,#49 ; dit kan dus hierna weer weg ! LD C,#49 CALL CALC_ADR LD (HL),#118+32 ; factory INC HL INC HL INC HL INC HL LD (HL),#119+32 INC HL INC HL INC HL INC HL LD (HL),#120+32 INC H LD (HL),#123+32 DEC HL DEC HL DEC HL DEC HL LD (HL),#122+32 DEC HL DEC HL DEC HL DEC HL LD (HL),#121+32 LD B,#53 ; EN DIT OOK LD C,#46 CALL CALC_ADR LD (HL),#132 INC HL INC HL INC HL INC HL LD (HL),#133 INC H LD (HL),#135 DEC HL DEC HL DEC HL DEC HL LD (HL),#134 RET FREE_BLW_BASE: ; ; maak wat radar schoon ! LD B,#25 LD C,#10 CALL FREE_PART LD B,#29 LD C,#12 CALL FREE_PART LD B,#28 LD C,#19 CALL FREE_PART LD B,#50 ; stukie rode base LD C,#46 CALL FREE_PART LD B,#49 LD C,#52 CALL FREE_PART LD B,#53 LD C,#49 CALL FREE_PART RET FREE_PART: LD DE,#RAD_SIEGE CALL FREE_PART_LOOP CALL CALC_ADR DEC HL LD (HL),#0 RET FREE_PART_LOOP: LD A,(DE) CP #100 RET Z PUSH BC ADD B LD B,A INC DE LD A,(DE) ADD C LD C,A INC DE CALL CALC_ADR POP BC DEC HL LD (HL),#0 JR FREE_PART_LOOP RET ;------------------------------------------------ ; Variabelen en data gebied ;------------------------------------------------ INT_DOS: .dw 0 INT_GAME: .dw INT_ROUTINE ADR: .dw 0x4000+260 ; waar staat het veld ???? + de rand LINE: .db 10 FASTCOP: BRON_X: .db 0,0 BRON_Y: .db 0,2 DOEL_X: .db 0,0 DOEL_Y: .db 0 DOEL_PAGE: .db 0 NUM_X: .db 16,0 NUM_Y: .db 16,0 .db 0,0 VDP_LOG: .db 0xD0 ALGCOP: .db 0,0,0,2,0,0,0,0,16,0,16,0,0,0,0xD0 TNKCOP: .db 0,0,160,2,0,0,0,0,16,0,16,0,0,0,0x98 TNKCOP_RI: .db 0,0,160,2,0,0,0,0,16,0,16,0,0,0,0x98 TNKCOP_DN: .db 0,0,160,2,0,0,0,0,16,0,16,0,0,0,0x98 TNKCOP_LT: .db 0,0,160,2,0,0,0,0,16,0,16,0,0,0,0x98 TNKCOP_UP: .db 0,0,160,2,0,0,0,0,16,0,16,0,0,0,0x98 TANK_IMG: .db 0,0,96,3,224,0,0,3,32,0,32,0,0,0,0x98 BUILD_IMG: .db 0,0,64,3,224,0,0,3,32,0,32,0,0,0,0x98 EMPTY: .db 160,0,0,3,208,0,24,0,32,0,32,0,0,0,0xD0 RADCOP: .db 192,0,128,0,192,0,128,1,65,0,65,0,0,0,0xD0 POWER_BALK: .db 200,0,56,3,208,0,58,0,32,0,8,0,0,0,0xD0 POWER_INFO: .db 200,0,40,3,208,0,58,0,32,0,8,0,0,0,0xD0 POWER_COP: .db 208,0,58,0,208,0,58,0,32,0,8,0,0,0,0xD0 HARV_BALK: .db 192,0,0,3,232,0,24,0,8,0,32,0,0,0,0xD0 HARV_COP: .db 232,0,24,0,232,0,24,0,8,0,32,0,0,0,0xD0 ITEM_CANCEL: .db 208,0,120,3,200,0,96,0,48,0,8,0,0,0,0xD0 CANCEL_COP: .db 208,0,96,3,200,0,72,0,48,0,32,0,0,0,0xD0 LIJN_COP: .db 0,0,0,3 .db 64,0,31,0 .db 112,0,1,0 .db 0,0,0xD0 MENU_COP: .db 0,0,0,3 .db 64,0,32,0 .db 112,0,112,0 .db 0,0,0xD0 PLOF_COP: .db 0,0,64,2 .db 0,0,0,0 .db 16,0,16,0 .db 0,0,0x98 LETCOP: .db 0,0,128,3,0,0,0,0,8,0,8,0,0,0,0xD0 LETCOP2: .db 0,0,136,3,0,0,0,0,8,0,8,0,0,0,0x98 CONCRETE_COP: .db 0,0,80,2 .db 0,0,0,0 .db 16,0,16,0 .db 0,0,0xD0 SHOOT0: .db 128,0,0,2 .db 0,0,0,0 .db 16,0,16,0 .db 0,0,0x98 SHOOT1: .db 144,0,0,2 .db 0,0,0,0 .db 16,0,16,0 .db 0,0,0x98 IMPACT0: .db 192,0,0,2 .db 0,0,0,0 .db 16,0,16,0 .db 0,0,0x98 COP_BSEL_1: .db 192,0,64,2 .db 0,0,0,0 .db 16,0,16,0 .db 0,0,0x98 COP_BSEL_2: .db 224,0,64,2 .db 0,0,0,0 .db 16,0,16,0 .db 0,0,0x98 COP_BSEL_3: .db 208,0,64,2 .db 0,0,0,0 .db 16,0,16,0 .db 0,0,0x98 COP_BSEL_4: .db 240,0,64,2 .db 0,0,0,0 .db 16,0,16,0 .db 0,0,0x98 BB_BUSY_COP: .db 0,0,0,3 .db 224,0,0,3 .db 32,0,32,0 .db 0,0,0x98 BB_BLW_COP: .db 32,0,0,3 .db 224,0,0,3 .db 32,0,32,0 .db 0,0,0xD0 BB_RED_COP: .db 64,0,0,3 .db 224,0,0,3 .db 32,0,32,0 .db 0,0,0xD0 BB_X_COP: .db 96,0,0,3 .db 224,0,0,3 .db 32,0,32,0 .db 0,0,0xD0 BB_READY_COP: .db 128,0,0,3 .db 224,0,0,3 .db 32,0,32,0 .db 0,0,0x98 BB_BLD_COP: .db 0,0,64,3 .db 224,0,0,3 .db 32,0,32,0 .db 0,0,0x98 BB_TNK_COP: .db 0,0,96,3 .db 224,0,0,3 .db 32,0,32,0 .db 0,0,0x98 BB_BLD2_COP: .db 0,0,0,3 .db 0,0,176,0 .db 32,0,32,0 .db 0,0,0x98 BB_MOVE_COP: .db 224,0,0,3 .db 0,0,176,0 .db 32,0,32,0 .db 0,0,0xD0 BB_STEPS_BAR: .db 194,0,0,3 .db 0,0,176,0 .db 4,0,16,0 .db 0,0,0xD0 GRAY_ITEM: .db 160,0,0,3 .db 224,0,0,3 .db 32,0,32,0 .db 0,0,0xD0 PUT_ITEM: .db 224,0,0,3 .db 208,0,24,0 .db 32,0,32,0 .db 0,0,0xD0 MENU_COM_ATT: .db 0,0,32,3 .db 200,0,72,0 .db 48,0,8,0 .db 0,0,0xD0 MENU_RED_ATT: .db 0,0,48,3 .db 200,0,72,0 .db 48,0,8,0 .db 0,0,0xD0 MENU_COM_MOV: .db 48,0,32,3 .db 200,0,80,0 .db 48,0,8,0 .db 0,0,0xD0 MENU_RED_MOV: .db 48,0,48,3 .db 200,0,80,0 .db 48,0,8,0 .db 0,0,0xD0 MENU_COM_HRV: .db 144,0,32,3 .db 200,0,72,0 .db 48,0,8,0 .db 0,0,0xD0 MENU_RED_HRV: .db 144,0,48,3 .db 200,0,72,0 .db 48,0,8,0 .db 0,0,0xD0 MENU_COM_RET: .db 192,0,32,3 .db 200,0,96,0 .db 48,0,8,0 .db 0,0,0xD0 MENU_RED_RET: .db 192,0,48,3 .db 200,0,96,0 .db 48,0,8,0 .db 0,0,0xD0 MENU_COM_STP: .db 0,0,40,3 .db 200,0,88,0 .db 48,0,8,0 .db 0,0,0xD0 MENU_RED_STP: .db 0,0,56,3 .db 200,0,88,0 .db 48,0,8,0 .db 0,0,0xD0 MENU_COM_REP: .db 48,0,40,3 .db 200,0,72,0 .db 48,0,8,0 .db 0,0,0xD0 MENU_RED_REP: .db 48,0,56,3 .db 200,0,72,0 .db 48,0,8,0 .db 0,0,0xD0 MENU_COM_UPG: .db 96,0,40,3 .db 200,0,80,0 .db 48,0,8,0 .db 0,0,0xD0 MENU_RED_UPG: .db 96,0,56,3 .db 200,0,80,0 .db 48,0,8,0 .db 0,0,0xD0 MENU_COM_CAN: .db 144,0,40,3 .db 200,0,96,0 .db 48,0,8,0 .db 0,0,0xD0 MENU_COM_CLN: .db 144,0,56,3 .db 200,0,72,0 .db 48,0,8,0 .db 0,0,0xD0 MENU_COM_SWP: .db 200,0,58,0 .db 200,0,58,1 .db 48,0,46,0 .db 0,0,0xD0 MENU_COM_SW2: .db 200,0,72,0 .db 200,0,72,1 .db 48,0,32,0 .db 0,0,0xD0 SWAP: .db 0 OFFSET: .db 1,1 ; zorg dat er altijd een rand #0xomeen is ! MAXSET: .db 53,53 ; vierkant veld !! is max offset + breedt BALK: .db 0 ; xlengte .db 0 ; ylengte .dw 0 ; xbegin .dw 0 ; ybegin STOP: .db 0 ; anders dan 0 is stop MSTOP: .db 0 MBUSY: .db 0 TNKADR: .dw 0 B_BALK_TYPE: .db 0 B_BALK_NR: .db 0 T_BALK_NR: .db 0 BB_WAIT: .db 0 BB_UP_DOWN: .db 0 RADAR: .db 0 ; niet elke keer updaten !! VDPADR: .dw 0x0300+100 MS_COUNT: .db 0 ; multiple select counter TEMPLATE_TNK: .ds TANK_DATA ; template voor toevoegen tank ! TEMP_HARV: ; ; templates per tank .db 2 ; speed byte .db 0,140 ; ATTACK / SHIELD .db 60 TEMP_SIEGE: .db 2 .db 190,150 .db 19 TEMP_TANK: .db 2 .db 175,140 .db 15 TEMP_QUAD: .db 4 .db 160,120 .db 10 TEMP_TRIKE: .db 8 .db 155,80 .db 7 SPRATR: MOUSEY: .db 96 MOUSEX: .db 128 MOUSE_SHAPE: .db 0 .db 4 .db 0,0,4,4 .db 0,0,8,8 .db 0,0,12,12 .db 0,0,32,16 ; build vlak sprite .db 0,0,32,20 .db 0,0,32,24 .db 0,0,32,28 .db 0,0,32,32 .db 0,0,32,36 .db 0,0,36,40 .db 0,0,40,44 .db 0,0,44,48 .db 0,0,48,52 SPRKLR_WHT: .db 15,15,15,15,15,15,15,15 .db 15,15,15,15,15,15,15,15 SPRKLR_RD: .db 10,10,10,10,10,10,10,10 .db 10,10,10,10,10,10,10,10 BB_TYPES: .db 1,4,6,4,6,4,1,4,255 ; zie bb BB_SIZE: .db 0 ; 1, 4(2) of 6(3) BB_BLOCKED: .db 0 ; 1 is blocked 0 is vrij ! BB_OUT_RANGE: .db 0 BB_SERIE: .db 0,0,0,0,0,0,0 ; Hoe groot en welke spritesvoor BB BBB_VALUE: ; 1 = aanwezig , build step, current step ; 2 = busy with building ; 3 = ready building ; 0 = niet aanwezig .db 1,64,63,2 ; status, steps, current, money neede .db 1,8,7,24 .db 1,2,1,80 .db 1,16,15,10 .db 1,2,1,90 .db 0,4,3,14 .db 0,8,7,1 .db 0,2,1,2 TBB_VALUE: .db 0,16,15,0 ; 5types units .db 0,8,7,0 .db 0,4,3,0 .db 0,2,1,0 .db 0,2,1,0 ; BBB +13 ETB_VALUE: .db 1,16,15,0 .db 1,8,7,0 .db 1,4,3,0 .db 1,2,1,0 .db 0,2,1,0 ; BBB + 18 UPG_LEV_BLD: .db 0 ; total upg level UPG_LEV_UNT: .db 0 ; MAX 4 ? IS_UNT_UPGRADING: .db 0 ; 1 per keer aub IS_BLD_UPGRADING: .db 0 ITEMSELECTED: .db 0 ; 0- 31 is enemy tanks of buildin ; ; 32-63 is eigen tanks of building ; ; 64-? item van build balk SELECTED: .db 0 ; is er een tank geselecteerd HAS_SELECT: .db 0 ;er is multiple select gedaan MSELECT_ON: .db 0 ; er zijn tanks geselecteerd TOTAL_SELECT: .db 0 ; nax 25 in selectie ! CURSOR_TYPE: .db 0 ; ?? FIRE_BUTTONS: .db 0 BUT_PRESSED: .db 0 ; bit 0 pressed but1 ; ; bit 1 pressed but2 RADARS: .dw RAD_DUMMY .dw RAD_SIEGE .dw RAD_TANK .dw RAD_QUAD .dw RAD_TRIKE RAD_DUMMY: .db 100,100 RAD_SIEGE: ; altijd op 100,100 eindigen .db -1,-3,0,-3,1,-3 .db -2,-2,-1,-2,0,-2,1,-2,2,-2 .db -3,-1,-2,-1,-1,-1,0,-1,1,-1,2,-1,3,-1 .db -3,0,-2,0,-1,0,1,0,2,0,3,0 .db -3,1,-2,1,-1,1,0,1,1,1,2,1,3,1 .db -2,2,-1,2,0,2,1,2,2,2 .db -1,3,0,3,1,3 .db 100,100 RAD_TANK: ; altijd op 100,100 eindigen .db -1,-2,0,-2,1,-2 .db -2,-1,-1,-1,0,-1,1,-1,2,-1 .db -2,0,-1,0,1,0,2,0 .db -2,1,-1,1,0,1,1,1,2,1 .db -1,2,0,2,1,2 .db 100,100 RAD_QUAD: ; altijd op 100,100 eindigen .db -1,-1,0,-1,1,-1,-1,0,1,0,-1,1,0,1,1,1,100,100 RAD_TRIKE: ; altijd op 100,100 eindigen .db -1,-1,0,-1,1,-1,-1,0,1,0,-1,1,0,1,1,1,100,100 RAD_HARVB: ; altijd op 100,100 eindigen .db -1,-1,0,-1,1,-1,-1,0,1,0,-1,1,0,1,1,1 .db 0,-2,2,0,0,2,-2,0,2,-2,2,2,-2,2,-2,-2,100,100 RAD_HARVR: ; altijd op 100,100 eindigen .db -1,-1,0,-1,1,-1,-1,0,1,0,-1,1,0,1,1,1 .db 0,-2,2,0,0,2,-2,0,2,-2,2,2,-2,2,-2,-2 .db 0,-3,3,0,0,3,-3,0,3,-3,3,3,-3,3,-3,-3 .db 0,-4,4,0,0,4,-4,0,4,-4,4,4,-4,4,-4,-4 .db 0,-5,5,0,0,5,-5,0,5,-5,5,5,-5,5,-5,-5 .db 0,-6,6,0,0,6,-6,0,6,-6,6,6,-6,6,-6,-6 .db 0,-7,7,0,0,7,-7,0,7,-7,7,7,-7,7,-7,-7,100,100 SPICE_RAD: .dw -1*4+-1*256 .db 17 .dw 0+-1*256 .db 18 .dw 1*4+-1*256 .db 19 .dw -1*4+0*256 .db 20 .dw 0+0 .db 16 .dw 1*4+0*256 .db 21 .dw -1*4+1*256 .db 22 .dw 0*4+1*256 .db 23 .dw 1*4+1*256 .db 24 FACTORY_DEPLOY: .dw (0*4)+0*256,(1*4)-1*256 .dw (2*4)-1*256,(3*4)-1*256,(4*4)+0*256,(4*4)+1*256 .dw (3*4)+2*256,(2*4)+2*256,(1*4)+2*256,(0*4)+256 .dw (-1*4)+0,0-1*256,(1*4)-2*256,(2*4)-2*256 .dw (3*4)-2*256,(4*4)-1*256,5*4,(5*4)+1*256,(4*4)+2*256 .dw (3*4)+3*256,(2*4)+3*256,(1*4)+3*256,(0*4)+2*256 .dw (-1*4)+1*256,100,100 QUAKE: .db 0 ; nummer van slachtoffer PLAYFIELD: .db 0 ; cursor binnen area 3 = 1 MOUSE_OFF: .db 0 ; AAN OF UIT MOUSE_USE: .db 0 ; " """""""" MOUSE_PORT: .db 0 ; PORT 1 OF 2 MOUSE_WAIT1: .db 0 ; WAIT CYCLE 1 MOUSE_WAIT2: .db 0 ; WAIT CYCLE 2 DIS_MONEY: .dw 200 MONEY: .dw 300 ; maal 10 MONEY_POS: .db 204,4 MONEY_CHAR: .db 0,0,0,0,0 FPS_OUT: .dw 0 DEEL2: .dw 10000 DEEL1: .dw 1000 .dw 100 DEEL0: .dw 10 .dw 1 ISTEXT: .db 0 TEXTADR: .dw 0 TEXTTAB: .dw TEXT_TNK1 .dw TEXT_TNK2 .dw TEXT_TNK3 .dw TEXT_TNK4 .dw TEXT_MENU1 .dw TEXT_OUTOFMONEY TEXT_TNK1: .str "YES SIR >>" .db 255 TEXT_TNK2: .str "YO >>" .db 255 TEXT_TNK3: .str "AFFIRMITIVE.." .db 255 TEXT_TNK4: .str "ACKNOWLEDGED" .db 255 TEXT_MENU1: .str "DOME ALPHA 3" .db 255 TEXT_OUTOFMONEY: .str "NOT ENOUGH FUNDS..." .db 255 PDATA_1: .db 4,0x78 ; CONTREL/FLAG .db 7,1 ; MOET!!! .db 8,0 ; DIV INIT .db 9,0 ; ST LOW .db 10,0 ; ST HI .db 11,0x0 ; EI LOW .db 12,0x0 ; EI HI .db 16,0xF0 ; 16 Khz PLAY .db 17,0x51 ; 16 Khz PLAY .db 18,255 ; VOL ADPCM .db 24,8 ; ADPCM AAN .db 7,0x60 ; IETS (0xA0 IS PLAY) DEST_OFFSET: .db 0,0,1,0,0,1,1,1 .db 2,0,2,1,0,2,1,2,2,2 .db 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,4,4 PLOF_COUNT: .db 0 PLOF_TABEL: .db 0,0,0 ; X Y nummer .db 0,0,0 ; nummer = 0 > leeg einde rij .db 0,0,0 ; nummer = 1 > plof aanwezig .db 0,0,0 .ds 240 ; genoeg ruimte ? EVENT: .db 0 EVENTHANDLER: .dw BUILD .dw UPDATE .dw CHKXY .dw RADAR_UPDATE .dw AI .dw ALGEMEEN CPYTT: ; copy tank tabel .ds 144*2 ; indeling is 0 1 of 2 en dan ix+ .db 0,0 ; voor de afronding z.w.m.z. en dus 40 un P_BUILD: .dw 0 ; pointer naar huidig geslect building EXTR_B_DATA: .ds 8 ; steen .db 2,2,255,154,0,0,0,0 ; windtrap .db 3,2,255,154,0,0,0,0 ; ref .db 2,2,255,154,0,0,0,0 ; silo .db 3,2,255,154,0,0,2,0 ; factory .db 2,2,255,154,0,0,0,0 ; radar .db 1,1,255,154,0,0,0,0 ; tower .db 2,2,255,154,0,0,3,0 ; const yard. .ds 8 BUILDINGS: .db 4 BUILDING1: .db 1,7,25,13,2,2,200,150 ; yard coors .db 0b00000000 ; 0 ; repair bitje ; 0 ; is upgrading.. .db 0 ; cur. upgrade level .db 3 ; max. upgrade level .db 0 ; upgrade status .db 0 ; refinery bezet ja/nee .ds BUILD_DATA*24 ;--------------------------------------------- BUILDING_RED: .db 26,7,50,46,2,2,255,100,0,0,0,0,0 .db 27,1,53,46,2,2,255,100,0,0,0,0,0 .db 28,4,49,49,3,2,255,100,0,0,0,0,0 .ds BUILD_DATA*22 ; 50 stuks max. ; 25 blauw / 25 rood TNK_CNT_BLW: .db 2 TNK_CNT_RED: .db 2 BLD_CNT_BLW: .db 1 BLD_CNT_RED: .db 0 DED_CNT_BLW: .dw 0 DED_CNT_RED: .dw 0 .area _DATA