#include "asm86.h" #include "ti86asm.inc" #include "ti86abs.inc" #include "ti86ops.inc" #include "ti86math.inc" _randint .equ $5544 _formreal .equ $5191 _asap_ind .equ $D623 _dispOP1 .equ $515B _SetXXOP1 .equ $4613 _SetXXOP2 .equ $4617 _SetXXXXOP2 .equ $461B _cpOP1OP2 .equ $41FB _flushallmenus .equ $49DC _exec_pg3 .equ $5714 _homeup .equ $4A95 sqrtFlags .equ 36 sqrtKEYinstalled .equ 6 #define locate1(xa,xb,xc,xd,xe,xf) ld bc,xa\ ld (list+1),bc\ ld bc,xb\ ld (length+1),bc\ ld bc,xc\ ld (kl1+1),bc\ ld bc,xd\ ld (kl2+1),bc\ ld bc,xe\ ld (kl3+1),bc\ ld bc,xf\ ld (kl4+1),bc #define locate2(xg,xh,xi) ld bc,xg\ ld (kl5+1),bc\ ld bc,xh\ ld (kl6+1),bc\ ld bc,xi\ ld (kle+1),bc\ call convert .org _asm_exec_ram nop jp Title_Screen .dw $0000 .dw description title: .db "Drugwars 2.1",0 .db "by",0 .db "Jonah Cohen",0 Title_Screen: call _runindicoff call _clrScrn call _flushallmenus ld a,(iy+sqrtFlags) ld (sk+1),a res sqrtKEYinstalled,(iy+sqrtFlags) ld bc,$0502 ld (_curRow),bc ld hl,title call _puts ld bc,$0a05 ld (_curRow),bc call _puts ld bc,$0506 ld (_curRow),bc call _puts call getkey jp z,exit call _ZEROOP1 ld de,health call _MOVFROP1 ld de,guns call _MOVFROP1 ld hl,2000 call _SetXXXXOP2 call _OP2TOOP1 ld de,wallet call _MOVFROP1 ld hl,5000 call _SetXXXXOP2 call _OP2TOOP1 ld de,debt call _MOVFROP1 call _ZEROOP1 ld de,Cocaine_amount call _MOVFROP1 ld de,Heroin_amount call _MOVFROP1 ld de,Acid_amount call _MOVFROP1 ld de,Weed_amount call _MOVFROP1 ld de,Speed_amount call _MOVFROP1 ld de,Ludes_amount call _MOVFROP1 call _op1set1 ld de,new_cocaine call _MOVFROP1 xor a ld (day),a jr first_day subway: .db "subway...",0 new_day: call _clrScrn ld bc,$0603 ld (_curRow),bc ld hl,subway call _puts ld hl,debt rst 20h ;call _MOV10TOOP1 ld hl,debt_interest call _MOV10TOOP2 rst 28h ;call _FPMULT call _INTGR ld de,debt call _MOVFROP1 first_day: ld a,(day) inc a ld (day),a cp 31 jp z,ending_sequence ld hl,new_cocaine ld de,Cocaine_price call NewDrug ld hl,new_heroin ld de,Heroin_price call NewDrug ld hl,new_acid ld de,Acid_price call NewDrug ld hl,new_weed ld de,Weed_price call NewDrug ld hl,new_speed ld de,Speed_price call NewDrug ld hl,new_ludes ld de,Ludes_price call NewDrug xor a call _SetXXOP1 ld a,30 call _SetXXOP2 call _randint call _CONVOP1 cp 3 jp m,coke_bust jp z,heroin_outrageous cp 4 jp z,heroin_cheap cp 5 jp z,acid_cheap cp 6 jp z,weed_cheap cp 7 jp z,speed_cheap cp 8 jp z,ludes_cheap cp 9 jp z,new_trenchcoat cp 10 jp z,new_trenchcoat cp 11 jp z,new_trenchcoat cp 12 jp z,found_drugs cp 13 jp z,buy_gun cp 14 jp z,buy_gun cp 15 jp z,mugged cp 19 jp m,cops jr normal_day NewDrug: ;input: ; hl=pointer to lower value, then upper value, then multiplier ; de=pointer to storage (drug) ;output: ; OP1 and OP2 trashed ; (de) contains new value push de push hl ld bc,10 add hl,bc rst 20h call _MOV10TOOP2 call _randint pop hl call _MOV10TOOP2 rst 28h pop de call _MOVFROP1 ret move_and_subtract: call _MOV10TOOP2 call _FPSUB ret normal_day: call _clrScrn call _runindicoff ld hl,trenchcoat rst 20h ld hl,Cocaine_amount call move_and_subtract ld hl,Heroin_amount call move_and_subtract ld hl,Acid_amount call move_and_subtract ld hl,Weed_amount call move_and_subtract ld hl,Speed_amount call move_and_subtract ld hl,Ludes_amount call move_and_subtract ld de,empty_spaces call _MOVFROP1 xor a ld (cursor_up+1),a ld (cursor_to_top+1),a ld bc,$0f00 ld (_curRow),bc ld hl,day_string call _puts ld a,(day) call _SetXXOP1 ld a,2 call _formreal ld hl,_OP3 call _puts locate1(choice_list, $0600, display_prices, display_trenchcoat, buy, sell) locate2(loan_shark, jet, exit) ld bc,$0100 keyloop: push bc call _homeup list: ld hl,$0000 length: ld bc,$0000 call move pop bc ld (_curRow),bc ld a,$7f call _putc call getkey kle: jp z,$0000 cp k1 kl1: jp z,$0000 cp k2 kl2: jp z,$0000 cp k3 kl3: jp z,$0000 cp k4 kl4: jp z,$0000 cp k5 kl5: jp z,$0000 cp k6 kl6: jp z,$0000 cp kUp jr z,cursor_up cp kDown jr z,cursor_down cp kEnter jr z,enter_pressed jr keyloop cursor_up: ld a,0 ;changed later (why i didn't use xor a) cp c jr z,cursor_to_bottom ;check if cursor is already at top dec c ;otherwise, move up one jp keyloop cursor_to_bottom: ld hl,(length+1) ld c,h dec c jp keyloop cursor_down: ld a,(length+2) dec a cp c jr z,cursor_to_top inc c jp keyloop cursor_to_top: ld c,0 jp keyloop enter_pressed: xor a cp c e1: jp z,$0000 call add_one_and_check e2: jp z,$0000 call add_one_and_check e3: jp z,$0000 call add_one_and_check e4: jp z,$0000 call add_one_and_check e5: jp z,$0000 e6: jp $0000 add_one_and_check: inc a cp c ret convert: ld bc,(kl1+1) ld (e1+1),bc ld bc,(kl2+1) ld (e2+1),bc ld bc,(kl3+1) ld (e3+1),bc ld bc,(kl4+1) ld (e4+1),bc ld bc,(kl5+1) ld (e5+1),bc ld bc,(kl6+1) ld (e6+1),bc ret display_prices: call _clrScrn call _homeup ld hl,Cocaine_price call move_and_display ld hl,Heroin_price call move_and_display ld hl,Acid_price call move_and_display ld hl,Weed_price call move_and_display ld hl,Speed_price call move_and_display ld hl,Ludes_price call move_and_display ld hl,wallet call move_and_display call _homeup ld hl,drug_names ld bc,$0700 call move call getkey jp z,exit jp normal_day display_trenchcoat: call _clrScrn call _homeup ld hl,Cocaine_amount call move_and_display ld hl,Heroin_amount call move_and_display ld hl,Acid_amount call move_and_display ld hl,Weed_amount call move_and_display ld hl,Speed_amount call move_and_display ld hl,Ludes_amount call move_and_display ld hl,empty_spaces call move_and_display call _homeup ld hl,drug_names ld bc,$0600 call move ld hl,trenchcoat_space call _puts call getkey jp z,exit jp normal_day move_and_display: rst 20h call _dispOP1 ret buy: call buy_and_sell_display cp LcapC jp z,buy_cocaine cp LcapH jp z,buy_heroin cp LcapA jp z,buy_acid cp LcapW jp z,buy_weed cp LcapS jp z,buy_speed cp LcapL jp z,buy_ludes jr buy buy_cocaine: ld bc,Cocaine_price ld hl,buy_sell_storage ld (buy_sell_storage),bc ld bc,Cocaine_amount ld (buy_sell_storage+2),bc jp buy_drugs buy_heroin: ld bc,Heroin_price ld (buy_sell_storage),bc ld bc,Heroin_amount ld (buy_sell_storage+2),bc jp buy_drugs buy_acid: ld bc,Acid_price ld (buy_sell_storage),bc ld bc,Acid_amount ld (buy_sell_storage+2),bc jp buy_drugs buy_weed: ld bc,Weed_price ld (buy_sell_storage),bc ld bc,Weed_amount ld (buy_sell_storage+2),bc jp buy_drugs buy_speed: ld bc,Speed_price ld (buy_sell_storage),bc ld bc,Speed_amount ld (buy_sell_storage+2),bc jp buy_drugs buy_ludes: ld bc,Ludes_price ld (buy_sell_storage),bc ld bc,Ludes_amount ld (buy_sell_storage+2),bc buy_drugs: ;storage addresses: ; price=(buy_sell_storage) ; amount=(buy_sell_storage+2) call _clrScrn ld hl,wallet rst 20h ld hl,(buy_sell_storage) call _MOV10TOOP2 call _FPDIV call _INTGR ld de,temporary_afford_value ;store value for comparison later call _MOVFROP1 ld bc,$0f02 ld (_curRow),bc ld a,48 call _formreal ld hl,_OP3 call _puts ld hl,empty_spaces rst 20h ;call _MOV10TOOP1 ld a,48 call _formreal ld hl,_OP3 ld bc,$0d03 ld (_curRow),bc call _puts call _OP1TOOP3 ld bc,$0002 ld (_curRow),bc ld hl,buy_messages call _puts inc c ld (_curRow),bc call _puts call _homeup call _puts ld a,$0d ld (_asap_ind),a call _exec_pg3 jp check_value input_valid: ld hl,(buy_sell_storage) rst 20h call _OP5TOOP2 rst 28h ;call _FPMULT rst 08h ;call _OP1TOOP2 ld hl,wallet rst 20h ;call _MOV10TOOP1 call _FPSUB ld de,wallet call _MOVFROP1 ld hl,(buy_sell_storage+2) rst 20h call _OP5TOOP2 rst 30h ld de,(buy_sell_storage+2) call _MOVFROP1 jp normal_day buy_and_sell_display: call _clrScrn call _homeup ld hl,choose_a_drug call _puts call _newline call _puts call $4078 ;alpha-lock ld a,$0c ld (_asap_ind),a call _exec_pg3 res 4,(iy+$12) ;undo res 7,(iy+$12) ;alpha-lock call _runindicoff rst 10h ;findsym ;bde->wlstring ld a,b ld h,d ld l,e call _load_ram_ahl inc hl inc hl ld a,(hl) ret check_value: call _OP1TOOP5 ld a,(_OP1) bit 7,a jp nz,buy_drugs rst 08h ;save input value ld hl,empty_spaces rst 20h call _FPSUB ld a,(_OP1) bit 7,a jp nz,buy_drugs call _OP5TOOP1 call _ZEROOP2 call _cpOP1OP2 jp z,normal_day rst 08h ld hl,temporary_afford_value rst 20h call _FPSUB ld a,(_OP1) bit 7,a jp z,input_valid jp buy_drugs sell: call buy_and_sell_display cp LcapC jp z,sell_cocaine cp LcapH jp z,sell_heroin cp LcapA jp z,sell_acid cp LcapW jp z,sell_weed cp LcapS jp z,sell_speed cp LcapL jp z,sell_ludes jr sell sell_cocaine: ld bc,Cocaine_price ld hl,buy_sell_storage ld (buy_sell_storage),bc ld bc,Cocaine_amount ld (buy_sell_storage+2),bc jp sell_drugs sell_heroin: ld bc,Heroin_price ld (buy_sell_storage),bc ld bc,Heroin_amount ld (buy_sell_storage+2),bc jp sell_drugs sell_acid: ld bc,Acid_price ld (buy_sell_storage),bc ld bc,Acid_amount ld (buy_sell_storage+2),bc jp sell_drugs sell_weed: ld bc,Weed_price ld (buy_sell_storage),bc ld bc,Weed_amount ld (buy_sell_storage+2),bc jp sell_drugs sell_speed: ld bc,Speed_price ld (buy_sell_storage),bc ld bc,Speed_amount ld (buy_sell_storage+2),bc jp sell_drugs sell_ludes: ld bc,Ludes_price ld (buy_sell_storage),bc ld bc,Ludes_amount ld (buy_sell_storage+2),bc sell_drugs: call _clrScrn ld hl,sell_message ld bc,$0002 ld (_curRow),bc call _puts ld hl,(buy_sell_storage+2) rst 20h call _formreal ld hl,_OP3 ld bc,$0902 ld (_curRow),bc call _puts call _homeup ld hl,buy_messages+28 ;"how many?" call _puts ld a,$0d ld (_asap_ind),a call _exec_pg3 jp check_sell_value valid_sell_value: ld hl,(buy_sell_storage) rst 20h call _OP5TOOP2 rst 28h ;call _FPMULT rst 08h ;call _OP1TOOP2 ld hl,wallet rst 20h ;call _MOV10TOOP1 rst 30h ld de,wallet call _MOVFROP1 ld hl,(buy_sell_storage+2) rst 20h call _OP5TOOP2 call _FPSUB ld de,(buy_sell_storage+2) call _MOVFROP1 jp normal_day check_sell_value: call _OP1TOOP5 ;save input ld a,(_OP1) bit 7,a jp nz,sell_drugs rst 08h ld hl,(buy_sell_storage+2) rst 20h call _FPSUB ld a,(_OP1) bit 7,a jp nz,sell_drugs call _OP5TOOP1 call _ZEROOP2 call _cpOP1OP2 jp z,normal_day jr valid_sell_value loan_shark: call _clrScrn ld a,(location) cp 0 jp nz,wrong_location locate1(shark_messages, $0300, repay, borrow, normal_day, keyloop) locate2(keyloop, keyloop, normal_day) ld bc,$0100 jp keyloop repay: call repay_borrow_output ld hl,shark_messages2+21 call _puts ld a,$0d ld (_asap_ind),a call _exec_pg3 call _INTGR call _OP1TOOP5 rst 08h ld a,(_OP1) bit 7,a jr nz,repay call _OP5TOOP2 ld hl,debt rst 20h call _FPSUB ld a,(_OP1) bit 7,a jr nz,repay call _OP5TOOP2 ld hl,wallet rst 20h call _FPSUB ld a,(_OP1) bit 7,a jp nz,repay call _OP5TOOP2 ld de,wallet call _MOVFROP1 call _OP5TOOP2 ld hl,debt rst 20h call _FPSUB ld de,debt call _MOVFROP1 jp normal_day repay_borrow_output: call _clrScrn ld hl,shark_messages2 ld bc,$0002 ld (_curRow),bc call _puts ld hl,debt rst 20h ld a,48 call _formreal ld hl,_OP3 call _puts ld hl,shark_messages2+10 ld bc,$0003 ld (_curRow),bc call _puts ld hl,wallet rst 20h ld a ,48 call _formreal ld hl,_OP3 call _puts call _homeup ret borrow: call repay_borrow_output ld hl,shark_messages2+29 call _puts ld a,$0d ld (_asap_ind),a call _exec_pg3 call _INTGR call _OP1TOOP5 ld a,(_OP1) bit 7,a jr nz,borrow ld hl,5000 call _SetXXXXOP2 call _OP2TOOP1 call _OP5TOOP2 call _FPSUB ld a,(_OP1) bit 7,a jr nz,crazy call _OP5TOOP2 ld hl,debt rst 20h rst 30h ld hl,30000 call _SetXXXXOP2 call _OP2TOOP3 rst 08h call _OP3TOOP1 call _FPSUB ld a,(_OP1) bit 7,a jr nz,crazy call _OP5TOOP2 ld hl,wallet rst 20h rst 30h ld de,wallet call _MOVFROP1 call _OP5TOOP2 ld hl,debt rst 20h rst 30h ld de,debt call _MOVFROP1 jp normal_day crazy: call _clrScrn call _homeup ld hl,crazy_message call _puts call getkey jp borrow wrong_location: call _homeup ld hl,only_in_bronx call _puts call getkey jp normal_day jet: call _clrScrn locate1(jet_choice_list, $0600, bronx, not_bronx, not_bronx, not_bronx) locate2(not_bronx, not_bronx, normal_day) ld bc,$0100 jp keyloop bronx: xor a jr change_local not_bronx: xor a inc a change_local: ld (location),a jp new_day special_drug: push de push bc call _SetXXXXOP2 call _OP2TOOP1 pop hl call _SetXXXXOP2 call _randint pop de call _MOVFROP1 ret coke_bust: ld hl,50000 call _SetXXXXOP2 xor a call _SetXXOP1 call _randint ld hl,40000 call _SetXXXXOP2 rst 30h rst 30h ld de,Cocaine_price call _MOVFROP1 call _clrScrn call _homeup ld hl,coke_bust_message ld bc,$0300 call move call getkey jp normal_day heroin_outrageous: ld hl,30000 ld bc,50000 ld de,Heroin_price call special_drug call _clrScrn call _homeup ld hl,heroin_outrageous_message ld bc,$0300 call move call getkey jp normal_day heroin_cheap: ld hl,500 ld bc,1500 ld de,Heroin_price call special_drug call _clrScrn call _homeup ld hl,heroin_cheap_message ld bc,$0300 call move call getkey jp normal_day acid_cheap: ld hl,400 ld bc,800 ld de,Acid_price call special_drug call _clrScrn call _homeup ld hl,acid_cheap_message ld bc,$0300 call move call getkey jp normal_day weed_cheap: ld hl,60 ld bc,140 ld de,Weed_price call special_drug call _clrScrn call _homeup ld hl,weed_cheap_message ld bc,$0200 call move call getkey jp normal_day speed_cheap: ld hl,20 ld bc,50 ld de,Speed_price call special_drug call _clrScrn call _homeup ld hl,speed_cheap_message ld bc,$0200 call move call getkey jp normal_day ludes_cheap: call _OP1SET2 ld de,Ludes_price call _MOVFROP1 call _clrScrn call _homeup ld hl,ludes_cheap_message ld bc,$0200 call move call getkey jp normal_day new_trenchcoat: call _clrScrn ld a,3 ld (cursor_up+1),a ld (cursor_to_top+1),a locate1(trenchcoat_message, $0500, buy_trenchcoat, normal_day, keyloop, keyloop) ld bc,keyloop ld (kl5+1),bc ld (kl6+1),bc ld (e1+1),bc ld (e2+1),bc ld (e3+1),bc ld bc,normal_day ld (kle+1),bc ld (e5+1),bc ld bc,buy_trenchcoat ld (e4+1),bc ld bc,$0103 jp keyloop buy_trenchcoat: ld hl,wallet rst 20h ld hl,200 call _SetXXXXOP2 call _FPSUB ld a,(_OP1) bit 7,a jr nz,cannot_buy_trenchcoat ld de,wallet call _MOVFROP1 ld hl,trenchcoat rst 20h ld hl,200 call _SetXXXXOP2 rst 30h ld de,trenchcoat call _MOVFROP1 jp normal_day cannot_buy_trenchcoat: call _clrScrn call _homeup ld hl,cannot_buy_trenchcoat_message ld bc,$0200 call move call getkey jp normal_day found_drugs ld a,4 call _SetXXOP1 ld a,9 call _SetXXOP2 call _randint call _OP1TOOP3 call _OP1TOOP6 ld hl,empty_spaces call _MOV10TOOP2 rst 30h ld hl,trenchcoat call _MOV10TOOP2 call _FPSUB ld a,(_OP1) bit 7,a jp nz,normal_day inc a call _SetXXOP1 ld a,4 call _SetXXOP2 call _randint call _CONVOP1 cp 1 call z,found_cocaine cp 2 call z,found_heroin cp 3 call z,found_acid cp 4 call z,found_weed push bc push hl rst 20h rst 08h call _OP6TOOP1 rst 30h pop de call _MOVFROP1 call _clrScrn call _homeup ld hl,found_drugs_message call _puts pop bc add hl,bc call _puts ld hl,found_drugs_message+22 call _puts call _newline call _puts ld bc,$0a00 ld (_curRow),bc call _OP6TOOP1 ld a,99 call _formreal ld hl,_OP3 call _puts call getkey jp normal_day found_cocaine: ld bc,31 ld hl,Cocaine_amount ret found_heroin: ld bc,39 ld hl,Heroin_amount ret found_acid: ld bc,46 ld hl,Acid_amount ret found_weed: ld bc,51 ld hl,Weed_amount ret cops: call _clrScrn call _homeup ld hl,cops_message call _puts ld a,2 call _SetXXOP1 ld a,4 call _SetXXOP2 call _randint ld a,48 call _formreal ld bc,$0001 ld (_curRow),bc ld hl,_OP3 call _puts call _CONVOP1 inc a ld (number_of_cops),a call getkey call _clrScrn locate1(cops_menu, $0500, fight, run, view_guns, view_health) locate2(no_of_pigs, keyloop, exit) ld bc,$0100 jp keyloop check_health: call _puts call getkey call _clrScrn ld a,(health) cp 30 jp z,dead ld a,(number_of_cops) cp 0 jp z,win_fight ld bc,$0100 jp keyloop fight: call _clrScrn call _homeup ld a,(guns) call _SetXXOP1 ld a,3 call _SetXXOP2 rst 28h ld a,6 call _SetXXOP2 rst 30h xor a call _SetXXOP2 call _randint call _CONVOP1 cp 0 jp z,missed cp 1 jp z,missed cp 2 jp z,hit cp 3 jp z,hit cp 4 jp z,hit cp 5 jp z,hit jp shot missed: ld hl,missed_message jp check_health hit: ld hl,health ld a,(hl) add a,3 ld (hl),a ld hl,running+11 call _puts call _newline call _puts call _newline call _newline call getkey ld hl,been_hit jp check_health shot: ld a,(number_of_cops) dec a ld (number_of_cops),a ld hl,shot_message call _puts call _newline jp check_health dead: call _homeup ld hl,killed ld bc,$0400 call move call getkey jp exit run: call _clrScrn ld bc,$0602 ld (_curRow),bc ld hl,running call _puts push hl ld a,1 call _SetXXOP1 ld a,6 call _SetXXOP2 call _randint call getkey call _clrScrn call _homeup call _CONVOP1 pop hl cp 6 jr z,escaped cp 5 jr z,escaped push af ld bc,$0300 call move call getkey pop af ld hl,they_missed cp 1 jp z,check_health ld a,(health) add a,3 ld (health),a ld hl,been_hit jp check_health escaped: ld hl,lost_them call _puts call _newline cp 6 call z,sewer call _puts call getkey jp normal_day sewer: ld hl,lost_them+36 ret view_guns: call _clrScrn ld bc,$0001 ld (_curRow),bc ld hl,you_have_guns call _puts ld a,(guns) call _SetXXOP1 ld a,48 call _formreal ld hl,_OP3 ld a,9 ld (_curCol),a jp check_health view_health: call _clrScrn ld bc,$0001 ld (_curRow),bc ld bc,$0400 ld hl,you_have_health call move ld a,(health) call _SetXXOP1 ld a,48 call _formreal ld hl,_OP3 ld bc,$0901 ld (_curRow),bc jp check_health no_of_pigs: call _clrScrn ld bc,$0001 ld (_curRow),bc ld hl,still_cops call _puts ld a,(number_of_cops) call _SetXXOP1 ld a,48 call _formreal ld hl,_OP3 ld bc,$0f01 ld (_curRow),bc jp check_health win_fight: call _homeup ld hl,killed_them_all ld bc,$0400 call move ld hl,1000 call _SetXXXXOP2 call _OP2TOOP1 ld hl,2000 call _SetXXXXOP2 call _randint ld bc,$0a03 ld (_curRow),bc ld a,48 call _formreal ld hl,_OP3 call _puts rst 08h ld hl,wallet rst 20h rst 30h ld de,wallet call _MOVFROP1 call getkey jp normal_day buy_gun: call _clrScrn ld hl,magnum_string cp 14 call z,baretta ld a,2 ld (cursor_up+1),a ld (cursor_to_top+1),a ld (list+1),hl ld bc,$0400 ld (length+1),bc ld bc,buy_the_gun ld (kl1+1),bc ld (e3+1),bc ld bc,normal_day ld (kl2+1),bc ld (kle+1),bc ld (e4+1),bc ld bc,keyloop ld (kl3+1),bc ld (kl4+1),bc ld (kl5+1),bc ld (kl6+1),bc ld (e1+1),bc ld (e2+1),bc ld (e5+1),bc ld (e6+1),bc ld bc,$0102 jp keyloop baretta: ld hl,baretta_string ret buy_the_gun: ld hl,wallet rst 20h ld hl,500 call _SetXXXXOP2 call _FPSUB ld a,(_OP1) bit 7,a jp nz,gun_unaffordable ld de,wallet call _MOVFROP1 ld a,(guns) inc a ld (guns),a jp normal_day gun_unaffordable: call _newline call _newline call _newline ld hl,gun_unaffordable_message call _puts call getkey jp normal_day mugged: ld a,(guns) cp 0 jp nz,normal_day call _ZEROOP1 ld de,wallet call _MOVFROP1 call _clrScrn call _homeup ld bc,$0200 ld hl,mugged_message call move call getkey jp normal_day move: ;-------------------------------------------------- ;moves down the screen displaying string at hl ; ;input: ; b=number of strings to display (max=8) ; c=column location ; hl=pointer to string ; (_curRow) and (_curCol) point to first location ;output: ; hl=hl+c ; (_curRow)=(_curRow)+c ; (_curCol)=c ; b=0 ; a is trashed ;-------------------------------------------------- call _puts ld a,c ld (_curCol),a ld a,(_curRow) inc a ld (_curRow),a djnz move ret getkey: call _getkey res 4,(iy+$09) cp kExit ret ending_sequence: call _clrScrn call _homeup ld hl,debt rst 20h call _ZEROOP2 call _cpOP1OP2 jp nz,never_repaid_shark ld hl,Cocaine_amount ld de,Cocaine_price call add_value ld hl,Heroin_amount ld de,Heroin_price call add_value ld hl,Acid_amount ld de,Acid_price call add_value ld hl,Weed_amount ld de,Weed_price call add_value ld hl,Speed_amount ld de,Speed_price call add_value ld hl,Ludes_amount ld de,Ludes_price call add_value ld hl,score ld bc,$0400 call move ld a,6 call _SetXXOP1 call _TENX rst 08h ld hl,wallet rst 20h call _FPDIV call _INTGR ld a,3 call _formreal ld hl,_OP3 ld bc,$0803 ld (_curRow),bc call _puts call _getkey jr exit score: .db 0,"Game Over",0,0 .db "Score = /100",0 add_value: push de call _MOV10TOOP2 pop hl rst 20h rst 28h rst 08h ld hl,wallet rst 20h rst 30h ld de,wallet call _MOVFROP1 ret never_repaid_message: .db "You never repaid the",0 .db "loan shark!",0,0 .db "Score = 0/100",0 never_repaid_shark: ld hl,never_repaid_message ld bc,$0400 call move call getkey exit: res 2,(iy+$09) sk: ld a,$00 ld (iy+sqrtFlags),a call _clrScrn call _homeup ret Cocaine_price: .db $00,$00,$FC,$00,$00,$00,$00,$00,$00,$00 Heroin_price: .db $00,$00,$FC,$04,$00,$00,$00,$00,$00,$00 Acid_price: .db $00,$00,$FC,$00,$00,$00,$00,$00,$00,$00 Weed_price: .db $00,$00,$FC,$00,$00,$00,$00,$00,$00,$00 Speed_price: .db $00,$00,$FC,$00,$00,$00,$00,$00,$00,$00 Ludes_price: .db $00,$00,$FC,$00,$00,$00,$00,$00,$00,$00 Cocaine_amount: .db $00,$00,$FC,$00,$00,$00,$00,$00,$00,$00 Heroin_amount: .db $00,$00,$FC,$00,$00,$00,$00,$00,$00,$00 Acid_amount: .db $00,$00,$FC,$00,$00,$00,$00,$00,$00,$00 Weed_amount: .db $00,$00,$FC,$00,$00,$00,$00,$00,$00,$00 Speed_amount: .db $00,$00,$FC,$00,$00,$00,$00,$00,$00,$00 Ludes_amount: .db $00,$00,$FC,$00,$00,$00,$00,$00,$00,$00 trenchcoat: .db $00,$02,$FC,$10,$00,$00,$00,$00,$00,$00 ;begins equal to 100 empty_spaces: .db $00,$02,$FC,$10,$00,$00,$00,$00,$00,$00 ;unused spaces in trenchcoat temporary_afford_value: .db $00,$00,$FC,$00,$00,$00,$00,$00,$00,$00 ;used for buying and selling wallet: .db $00,$03,$FC,$20,$00,$00,$00,$00,$00,$00 ;wallet value $2000 debt: .db $00,$03,$FC,$50,$00,$00,$00,$00,$00,$00 ;debt value $5000 debt_interest: .db $00,$00,$FC,$11,$00,$00,$00,$00,$00,$00 ;1.1, multiplied by debt every day day: .db $00 ;begins on day 0 location: .db $00 health: .db $00 guns: .db $00 number_of_cops: .db $00 buy_sell_storage: .dw $0000,$0000 new_cocaine: .db $00,$00,$FC,$10,$00,$00,$00,$00,$00,$00 .db $00,$04,$FC,$15,$00,$00,$00,$00,$00,$00 .db $00,$04,$FC,$30,$00,$00,$00,$00,$00,$00 new_heroin: .db $00,$00,$FC,$10,$00,$00,$00,$00,$00,$00 .db $00,$03,$FC,$50,$00,$00,$00,$00,$00,$00 .db $00,$04,$FC,$14,$00,$00,$00,$00,$00,$00 new_acid: .db $00,$02,$FC,$10,$00,$00,$00,$00,$00,$00 .db $00,$01,$FC,$10,$00,$00,$00,$00,$00,$00 .db $00,$01,$FC,$45,$00,$00,$00,$00,$00,$00 new_weed: .db $00,$01,$FC,$10,$00,$00,$00,$00,$00,$00 .db $00,$01,$FC,$30,$00,$00,$00,$00,$00,$00 .db $00,$01,$FC,$90,$00,$00,$00,$00,$00,$00 new_speed: .db $00,$01,$FC,$10,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$70,$00,$00,$00,$00,$00,$00 .db $00,$01,$FC,$25,$00,$00,$00,$00,$00,$00 new_ludes: .db $00,$01,$FC,$10,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$10,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$60,$00,$00,$00,$00,$00,$00 choice_list: .db "1=Prices",0 .db "2=Trenchcoat",0 .db "3=Buy",0 .db "4=Sell",0 .db "5=Loan Shark",0 .db "6=Jet",0 day_string: .db "Day ",0 drug_names: .db " Cocaine:",0 .db " Heroin:",0 .db " Acid:",0 .db " Weed:",0 .db " Speed:",0 .db " Ludes:",0 .db " Wallet:",0 trenchcoat_space: .db " Empty:",0 choose_a_drug: .db " Choose a drug: " .db "---------------------" .db "[C] [H] [A]",0 .db "[W] [S] [L]" .db "---------------------" .db "?",0 buy_messages: .db "You can afford",0 .db "You can hold",0 .db "How many?",0 sell_message: .db "You have",0 shark_messages: .db "1=Repay",0 .db "2=Borrow",0 .db "3=Nevermind!",0 shark_messages2: .db "You owe $",0 .db "You have $",0 .db "Repay $",0 .db "Borrow $",0 crazy_message: .db "You think he's crazy," .db "man?!",0 only_in_bronx: .db "The loan shark only " .db "deals in the Bronx!",0 jet_choice_list: .db "1=Bronx",0 .db "2=Ghetto",0 .db "3=Central Park",0 .db "4=Manhattan",0 .db "5=Coney Island",0 .db "6=Brooklyn",0 coke_bust_message: .db "Pigs made a coke",0 .db "bust! Prices are",0 .db "outrageous!",0 heroin_outrageous_message: .db "Addicts are buying",0 .db "heroin at outrageous",0 .db "prices!",0 heroin_cheap_message: .db "Pigs are selling",0 .db "cheap heroin from",0 .db "last week's raid!",0 acid_cheap_message: .db "The market has been",0 .db "flooded with cheap",0 .db "homemade acid!",0 weed_cheap_message: .db "Weed prices have",0 .db "bottomed out!",0 speed_cheap_message: .db "Rival dealers are",0 .db "selling cheap speed!",0 ludes_cheap_message: .db "Lude prices have",0 .db "plummeted!",0 trenchcoat_message: .db "Will you buy a new",0 .db "trenchcoat with more",0 .db "pockets for $200?",0 .db "1=Yeah",0 .db "2=No way",0 cannot_buy_trenchcoat_message: .db "You don't have",0 .db "enough cash.",0 found_drugs_message: .db "You found units of ",0 .db " on a dead",0 .db "dude in the subway!",0 .db "cocaine",0 .db "heroin",0 .db "acid",0 .db "weed",0 cops_message: .db "Officer Hardass and " .db " of his deputies are" .db "after you!",0 cops_menu: .db "1=Fight",0 .db "2=Run",0 .db "3=View Guns",0 .db "4=View Health",0 .db "5=No. of Pigs",0 missed_message: .db "You missed them!",0 shot_message: .db "You killed one of",0 .db "them!",0 killed: .db "You were killed by",0 .db "Officer Hardass!",0,0 .db "What a loser!",0 running: .db "Running...",0 .db "They're firing at",0 .db "you!",0,0 they_missed: .db "They missed!",0 been_hit: .db "You've been hit!",0 lost_them: .db "You lost them in a",0 .db "vacant building!",0 .db "sewer!",0 you_have_guns: .db "You have guns.",0 you_have_health: .db "You have /30",0 .db "health.",0,0 .db "30/30 = Death",0 still_cops: .db "You still have pigs" .db "chasing after you!",0 killed_them_all: .db "You killed them all!",0,0 .db "On Hardass' corpse,",0 .db "you find $ .",0 magnum_string: .db "Will you pay $500 for" .db "a .44 Magnum?",0 .db "1=Sure",0 .db "2=No way",0,0 baretta_string: .db "Will you pay $500 for" .db "a Baretta? ",0 .db "1=Sure",0 .db "2=No way",0,0 gun_unaffordable_message: .db "You don't have enough" .db "cash.",0 mugged_message: .db "You were mugged on",0 .db "the subway!",0 description: .db "Drugwars 2.1 by Jonah Cohen",0 .end END