;USR0:VTTREK.MAC.7 7-Mar-85 FM+1D.19H.44M.15S., by BUDD ; Make LINK with FORTRAN v7 + remove some once only kludgery ;VTTREK.MAC.31 8-Jan-81 09:09:14, Edit by HESS TOPS20==1 ;[BUDD] ; VT100 TREK Version 2.0 ; ; TREK is a VT100 game for up to eight players. It's written in ; MACRO-10 for VT100s that are equipped with the Advanced Video ; Option. ; ; Each player runs the game from a separate tty and job. The ; jobs communicate via a sharable high segment. ; ; TREK.RNO contains a complete game description. The program ; uses a file of help texts named TREK.HLP. This file should be ; on the same device in the same ppn as the TREK.EXE. The file isn't ; required in order to run the game. ; ; Version 2.0 contains all of the modifications since the release ; of Version 1.0 plus many new routines. TREK.RNO describes ; Version 2.0 and the differences between the old and new versions. ; ; TREK timing is based on 1200 baud lines. Lower baud rates give a ; slow-motion effect and an advantage to interceptors and bases. There ; has been no opportunity to test the program at higher baud rates. ; ; Questions, comments, suggestions, etc, are welcome. ; ; For further information, contact: ; ; Cliff Zimmerman ; Manufacturing Planning Information Systems ; ML1-4, F16 ; 223-6294 ((617)-493-6294) ; ; Revisions since release of version 1.0: ; ; 7-Jan-81 Conversion to TOPS20 ; ; 16-Sep-80 added optional ADJBP macro for KL to KI conversion. ; ; 16-Sep-80 added ROTRAN routine to randomize starting orientation. ; ; 05-Oct-80 move one-line messages to the bottom of the display. ; ; 12-Oct-80 modify RF command to allow setting energy/torpedoes. ; ; 28-Oct-80 photon fire visually detectable up to 2048 distance. ; ; 28-Oct-80 'harden' starbases by allowing them to refuel. ; ; 04-Nov-80 ship-to-ship messages displayed at bottom of screen. ; ; 04-Nov-80 'more' message shifted to keypad. ; ; 04-Nov-80 added planet rebellions. ifndef tops20, ;default to TOPS10 ifndef ftki10, ;Not KI10 title TREK sall twoseg .TEXT "/SYMSEG:LOW" ;[BUDD] SYMBOL TABLE IN LOWSEG .TEXT "SYS:FORLIB/SEGMENT:LOW/SEARCH" ;[BUDD] MATHLIB STUFF IN LOWSEG %VER==:0 ;[BUDD] ??? FORLIB WANTS IT ife tops20,< search UUOSYM > ifn tops20,< search monsym,macsym .jbuuo==40 > ;Version definitions tk.ver=2 ;Version 2 tk.min=0 ;Minor ver tk.who=0 ;Who last edited tk.edt=100 ;Edit # ; acs rs=0 t1=1 ;temporary registers t2=2 t3=3 t4=4 uot=5 ;accumulator for universal table index row=6 ;accumulator for row values col=7 ;accumulator for col values lst=10 ;accumulator for target list routines p1=11 ;registers used by the queue routines. p2=12 ;must be considered permanent by any routine p3=13 ;that isn't a queue routine. p4=14 suot=15 ;uot of this ship - set at startup, never changed ap=16 ;general purpose register c=16 ; (ap is sometimes called c) p=17 ;pdl pointer sp=17 ; (p is sometimes called sp) pdlsz=200 ;pdl size pdl: block pdlsz ;push down list ife tops20,< ttychn=1 ;tty channel hlpchn=2 ;help file channel > sh.ct=10 ;number of ships sb.ct=10 ;number of starbases pl.ct=100 ;number of planets and interceptors st.ct=100 ;number of stars sh.mn=0 ;low index of ships in universal table sb.mn=10 ;low index of starbases pl.mn=20 ;low index of planets and interceptors st.mn=120 ;low index of stars sh.mx=7 ;high index of ships in universal table sb.mx=17 ;high index of starbases pl.mx=117 ;high index of planets st.mx=217 ;high index of stars vtflag: 1 v52flg: 0 ;-1 if vt100 in vt52 mode dbugf: 0 ifn tops20,< hlpjfn: z savmod: z ;tty JFN mode saved here d.tcnt: z ;counter to prevent time from being displayed too ofter bootf: -1 ; once only flag for BOOTS gjblk: gj%old .nulio,,.nulio -1,,tk.dev -1,,tk.dir -1,,tk.nam 0 ;file type - to be supplied 0 ;protection 0 ;account 0 ;JFN (not used) tk.nam: block 10 ;name of program tk.dir: block 10 ;directory of program tk.dev: block 10 ;device of program > ife tops20,< l.hr: z ;last hour displayed l.mn: z ;last minute displayed > d.line: z d.last: z f.data: z ;data for fortran calls f.loc: 200,,f.data ;location of fortran data f.max: z f.hit: z f.uot: z max.en: dec 5000000 k256: 128.0 k181: 90.50966802 i.char: z i.sign: z i.nbr: z i.path: z i.pos: z i.spos: z i.max: z sin.a: z cos.a: z tan.a: z sin.b: z cos.b: z tan.b: z time.f: 0 var.x: 0 var.y: ^d256 p.ener: z p.time: z p.save: z p.rang: z b1: z e1: z r1: z x1: z y1: z z1: z x2: z y2: z z2: z comp.x: z comp.y: z comp.z: z a.absx: z a.absy: z a.absz: z ran.mn: 1 ran.mx: 100 ran.nr: z ran.sd: z r.fire: z ;= 0 rapid fire off ;< 0 rapid fire on rf.pha: ^d200 ;rapid fire phaser energy rf.pho: ^d1 ;rapid fire photon count a.fire: z ;phaser/photon work area for bases, interceptors, ;and unmanned ships: ; ;lh - weapons code, bit 9: 0 = pha, 1 = pho. ;rh - energy to be applied. ; ship masks ; ; ship masks are used in the event queue to indicate which ship an ; event applies to, and in the universal table to indicate which ; libraries an object is in. the mask is always the leftmost 8 bits ; in a halfword. the bits are in reverse order. bit 18 pertains to ; ship 8, bit 25 to ship 1. mask.f: 252000 ;all federation ships mask.k: 524000 ;all klingon ships mask.a: 776000 ;all ships, federation and klingon mask.c: 0 ;this ship only (set during setup) mask.o: 776000 ;any ship but this one (set during setup) mask.u: 524000 ;'us' - friendly ships (set during setup) mask.t: 524000 ;'them' - enemy ships (set during setup) mska.u: z ;'us' for unmanned ships. mska.t: z ;'them' for unmanned ships. ; ally masks ; ; used to determine which side an object is on. masks bits ; 29 thru 31 in the u.tab word. ally.f: 1b31 ;federation mask. ally.k: 1b30 ;klingon mask. ally.n: 1b29 ;neutral mask. ally.a: 7b31 ;neutral, federation, or klingon. ally.u: 1b30 ;'us' - our side (set by setup routine). ally.t: 1b30 ;'them' - their side (set by setup routines). alya.u: z ;'us' for unmanned ships. alya.t: z ;'them' for unmanned ships. chan.c: z chan.f: z chan.k: z chan.a: z u.side:: z ;side a player is on (used during startup) eadd.t: z ;event queue add area eadd.a: z eadd.b: z eadd.x: z eadd.y: z eadd.z: z ewrk.t: z ;event queue work area ewrk.a: z ewrk.b: z ewrk.x: z ewrk.y: z ewrk.z: z m.time: z work.q: block 600 reloc 400K ifn tops20,< SHRBEG:: segver: byte (3)tk.who (9)tk.ver (6)tk.min (18)tk.edt ;matched against EV+2 at startup > ; high-segment information shared by all ships gam.nr: z ;tournament game nbr or 0 if random gam.tm: ^d120 ;minutes remaining in the game gam.hr: z ;current hour gam.mn: z ;current minute i.lock: z ;initial (startup) lock. keeps 2 or more players ;from starting up simultaneously. i.time: z ;time i.lock was set. allows i.lock to be reset if ;system crash occurred while a player was starting up. q.time:: 1 ;= 0, no non-ship (base, planet, interceptor) ; is waiting to be activated. ;> 0, lowest time that a non-ship is due to be ; activated. mask.q:: z ;8-bit mask (0-7) indicating active ships. time.q:: block 120 ;mstime that an unmanned ship or a non-ship is to ;be activated. zero means the entry is empty. rebel: block 120 ;mstime after which a planet may consider rebellion. ; event queue q.size=600*6 ;size of the event queue hq.min=0 hq.max=77*6 lq.min=100*6 lq.max=577*6 q:: block q.size evnt.t==q ;mstime after which event is to occur. ;= 0, entry is empty. ;< 0, entry is being temporarily held by a ship. evnt.a==q+1 ;event code word: ;0-7 ships to whom event applies (8-bit mask, ships ; 7 to 0). when a ship processes the event, ; it sets its bit to 0. when the mask is all 0, ; all ships have processed the event and the ; entry is returned to the available pool. ;8-9 weapons code: ; 0 = phasers ; 1 = photon torpedo ; message code: ; 0 = ship detected ; 1 = ship attacked ;10-17 uot of ship that sourced the event. this is ; the 'secondary' uot. ;18 message bit indicating an 'under attack' msg ; should be displayed. ;19-29 not used. ;30-35 event code. evnt.b==q+2 ;uot word: ;0-17 energy (for weapons and energy transfer). ;18-27 not used. ;28-35 uot of ship to whom the event is to occur. ; (may also be the sourcing uot, depending on ; the event.) this is the 'primary' uot. evnt.x==q+3 ;absolute coordinates of object to whom event is to evnt.y==q+4 ;occur. used to test whether object has moved since evnt.z==q+5 ;event was initiated (mainly for weapons). z ; universal object tables ; ; data describing all of the objects in the galaxy. u.tab is a ; general information word filled in when the galaxy is loaded. ; initially, u.tab contains only uid's (id identifying what the ; object is). the term 'uot' usually means the index into these ; tables. u.tab:: repeat 4, ;federation, klingon ships repeat 4, ;federation, klingon bases repeat 20, ;planets and their interceptors repeat 100, ;stars z u.absx: block 220 ;absolute x,y,z coordinates of u.absy: block 220 ;the object (floating point) u.absz: block 220 u.ener: block 220 ;ship and shield energy. all objects have an u.shld: block 220 ;energy allocation. (binary milliunits) u.msg: block 130 ;message area, one line per ship u.alrt: block 10 ;alert status (ships only). u.job: block 10 ;job nr of player ife tops20,< u.ppn: block 10 ;ppn of player u.nam1: block 10 ;12-char name of player u.nam2: block 10 > ifn tops20,< u.namx: block 10 ;user number of player > u.time: block 10 ;mstime player was last active. when game ;is run, any player with no activity for ;past 5 minutes is reset. this is intended ;as a means to reset the game after a system ;crash. the time is updated every second ;or so whether the player enters a command ;or not, so it's not a time limit within ;which a player has to make a move. u.begx: block 10 ;ship positions assigned at startup. players u.begy: block 10 ;coming back into the game begin at their u.begz: block 10 ;original starting position. u.lstx: block 10 ;last known position of a ship. u.lsty: block 10 u.lstz: block 10 u.tty: block 10 ;tty of player. tty nbr determines ;whether a player was previously in the ;game, hence is in the shared section. u.wait: block 10 ;mstime at which a player may reenter the ;game. player must wait 2 minutes before ;reentry is allowed. u.torp: block 10 ;number of torpedoes a ship has. n.muot: block 10 ;object toward which an unmanned ship is ;moving. n.mssn: block 10 ;unmanned ship's current mission. ; wf.dis and wf.ene - distances and energy used when moving at ; standard warp factors. wf.dis: dec 1 ;warp 0 dec 2 ;warp 1 dec 4 ;warp 2 dec 8 ;warp 3 dec 16 ;warp 4 dec 32 ;warp 5 dec 64 ;warp 6 dec 128 ;warp 7 dec 256 ;warp 8 dec 512 ;warp 9 wf.ene: dec 1 ;warp 0 dec 4 ;warp 1 dec 16 ;warp 2 dec 64 ;warp 3 dec 256 ;warp 4 dec 1024 ;warp 5 dec 4096 ;warp 6 dec 16384 ;warp 7 dec 65536 ;warp 8 dec 262144 ;warp 9 ; universal table initial values, loaded at startup ; ; u.tab bit assignments and values: ;18 0 0 (positive), object is active. ; 1 (negative), object is inactive or destroyed. ;19 1 0 - ship is not occupied (not under human control). ; 1 - ship is under automatic control. ; 2-7 not used. ;26 8 enemy detected. ; 0 - notify others. ; 1 - others have been notified. ;27 9 enemy under attack. ; 0 - notify others. ; 1 - others have been notified. ; 10-17 planets: ; 10 not used. ;29 11 defenses up (1) or down (0). ;30-32 12-14 launched interceptor bits. ;33-35 15-17 interceptor in base bits. ; interceptors: ;28-31 10-13 count-down field, fire if zero. ;32-35 14-17 index to a.fact and b.fact, offset values for motion. ; 18-25 library mask, 1 bit per ship. if mask bit is set, object ; is in that ships library. ; 26-28 not used. ; 29-31 alliance: ; 29 neutral. ; 30 klingon. ; 31 federation. ; 32-35 object id (uid). ; 0 - not used. ; 1 - star. ; 2 - planet. ; 3 - federation base. ; 4 - klingon base. ; 5 - federation ship. ; 6 - klingon ship. ; 7 - interceptor. ui.t0: byte (1)0(17)0(8)0(3)0(3)0(4)0 ;romulan ui.t1: byte (1)0(17)0(8)0(3)0(3)4(4)1 ;star ui.t2: byte (1)0(17)107(8)0(3)0(3)4(4)2 ;planet ui.t3: byte (1)0(17)0(8)125(3)0(3)1(4)3 ;fed base ui.t4: byte (1)0(17)0(8)252(3)0(3)2(4)4 ;kli base ui.t5: byte (1)0(17)0(8)125(3)0(3)1(4)5 ;fed ship ui.t6: byte (1)0(17)0(8)252(3)0(3)2(4)6 ;kli ship ui.t7: byte (1)1(17)0(8)0(3)0(3)4(4)7 ;interceptor ui.e0: dec 3000000 ;ship energy starting values ui.e1: dec 200000000 ui.e2: dec 20000000 ui.e3: dec 5000000 ui.e4: dec 5000000 ui.e5: dec 3000000 ui.e6: dec 3000000 ui.e7: dec 0 ui.s0: dec 2000000 ;shield energy starting values ui.s1: dec 200000000 ui.s2: dec 20000000 ui.s3: dec 5000000 ui.s4: dec 5000000 ui.s5: dec 2000000 ui.s6: dec 2000000 ui.s7: dec 499000 shrend: reloc ;end of shareable data base ; ship object tables ; ; object information from the perspective of the ship o.relx: block 220 ;object x,y,z coordinates relative to o.rely: block 220 ;the ship (floating point) o.relz: block 220 o.elev: block 220 ;object elevation, bearing, and range o.bear: block 220 ;(b,e are tangents; r is floating point) o.rang: block 220 s.uot: z ;uot of the ship (same as suot accumulator) s.mask: z ;a work mask s.muid: z ;a work universal id s.warp: dec 7 ;current warp factor s.11: 1.0 ;3x3 matrix for vector calculations s.12: 0.0 s.13: 0.0 s.21: 0.0 s.22: 1.0 s.23: 0.0 s.31: 0.0 s.32: 0.0 s.33: 1.0 a.11: 1.0 ;3x3 work matrix a.12: 0.0 a.13: 0.0 a.21: 0.0 a.22: 1.0 a.23: 0.0 a.31: 0.0 a.32: 0.0 a.33: 1.0 ; wf.tab - this ship's warp factor distances (changeable by player). wf.tab: dec 1,2,4,8,16,32,64,128,256,512 ; table of ranges used by unmanned ships. n.rang: block 120 ; a list of nearest objects of a class and their ranges, used by ; unmanned ships. n.nuot: block 10 nupl.n=n.nuot ;nearest neutral planet. nupl.u=n.nuot+1 ;nearest friendly planet. nupl.t=n.nuot+2 ;nearest enemy planet. nusb.u=n.nuot+3 ;nearest friendly base. nusb.t=n.nuot+4 ;nearest enemy base. nush.u=n.nuot+5 ;nearest friendly ship. nush.t=n.nuot+6 ;nearest enemy ship. nuin.a=n.nuot+7 ;nearest interceptor, any side. n.nran: block 10 nrpl.n=n.nran ;nearest neutral planet. nrpl.u=n.nran+1 ;nearest friendly planet. nrpl.t=n.nran+2 ;nearest enemy planet. nrsb.u=n.nran+3 ;nearest friendly base. nrsb.t=n.nran+4 ;nearest enemy base. nrsh.u=n.nran+5 ;nearest friendly ship. nrsh.t=n.nran+6 ;nearest enemy ship. nrin.a=n.nran+7 ;nearest interceptor, any side. n.ener: z ;total shield plus ship energy of unmanned ship. n.pcnt: z ;count of captured planets, used by unmanned ships. n.scnt: z ;count of near enemy ships, used by unmanned ships. ; quadrant table used at startup. xyz.i is the index. xyz.t entries ; have a bit for x,y,z. if set, bit means coordinate is to be ; negated. determines where objects will go at startup, ensures that ; objects will be evenly distributed in 8 quadrants of galaxy. xyz.i: 7 xyz.t: dec 0,1,3,2,5,4,6,7 ; target list l.idx: z luot.a: exp -1,-1,-1,-1,-1 luot.b: exp -1,-1,-1,-1,-1 m.msg: block ^d11 m.ptr: point 7,m.msg m.wptr: z m.row: z t.row: ^d7 ;target row and col, not necessarily within range of t.col: ^d41 ;the viewer or the screen. t.view: 1 t.elem: z t.uot: -1 ;if not < 0, indicates target is locked on object t.uot t.bear: z ;to confuse things, target b,e is kept in degrees, not t.elev: z ;as tangents (floating point) t.rmax: z ;some min and max values used when determining whether t.rmin: z ;an object is pointed to by the target. t.cmax: z t.cmin: z a.fact: 128.0 ;each of a planet's 3 interceptors rotates 118.2565802 ;around the planet at a fixed distance of 90.50966802 ;128 units. rotation is in one of the planet's 48.98347936 ;3 primary planes. a.fact and b.fact are 0.0 ;used to compute the interceptor's next -48.98347936 ;position, in absolute coordinates, relative -90.50966802 ;to the absolute coordinates of the planet. -118.2565802 -128.0 ;it keeps the program from having to do a lot -118.2565802 ;of accumulator-destroying trig. -90.50966802 -48.98347936 ;a.fact = 128 * cos ang 0.0 ;b.fact = 128 * sin ang 48.98347936 ; 90.50966802 ;where ang varies from 0 to 360 in 118.2565802 ;22.5 degree increments b.fact: 0.0 48.98347936 90.50966802 118.2565802 128.0 118.2565802 90.50966802 48.98347936 0.0 -48.98347936 -90.50966802 -118.2565802 -128.0 -118.2565802 -90.50966802 -48.98347936 c.inte: z ;integer returned by VTGET c.char: z ;character returned by VTGET c.cmd: z ;command nbr returned by VTCMD c.dir: z ;direction returned by VTCMD c.nbr1: z ;1st number returned by VTCMD c.nbr2: z ;2nd number returned by VTCMD c.cnt: z ;nr of numbers entered c.imm: z ;immediate execute flag c.tab: xwd 0," " ;command abbreviations xwd 0,"SP" ;1 special xwd 0,"LO" ;2 lock target xwd 0,"RE" ;3 refuel and reload xwd 0,"SH" ;4 shields xwd 0,"TA" ;5 target xwd 0,"PH" ;6 phaser xwd 0,"TO" ;7 photon torpedo xwd 8,"MO" ;8 move xwd 0,"RO" ;9 rotate xwd 0,"WR" ;10 warp xwd 0,"LI" ;11 display target list xwd 0,"CA" ;12 capture planet xwd 0,"TR" ;13 transfer energy xwd 0,"BA" ;14 display all bases xwd 0,"BN" ;15 display nearest base xwd 0,"AL" ;16 list all objects xwd 0,"FE" ;17 list federation objects xwd 0,"KL" ;18 list klingon objects xwd 0,"PL" ;19 list planetary objects xwd 0,"SE" ;20 send a message xwd 0,"NE" ;21 get the news (a HELP feature) xwd 0,"US" ;22 list users xwd 0,"HE" ;23 help xwd 0,"H " ;24 help synonym xwd 0,"X " ;25 exit program xwd 0,"Q " ;26 quit (exit synonym) xwd 0,"R " ;27 refresh screen xwd 0,"RT" ;28 refresh with VT100 self-test xwd 0,"RF" ;29 rapid fire mode on/off xwd 0,"ST" ;30 display active status xwd 0,"AS" ;31 request assistance xwd 0,"RA" ;32 red alert xwd 0,"YA" ;33 yellow alert xwd 0,"SA" ;34 secure from alert xwd 0,"FB" ;35 list fed bases xwd 0,"FP" ;36 list fed planets xwd 0,"FS" ;37 list fed ships xwd 0,"KB" ;38 list kli bases xwd 0,"KP" ;39 list kli planets xwd 0,"KS" ;40 list kli ships xwd 0,"NP" ;41 list neutral planets xwd 0,"PN" ;42 list neutral planets (synonym) ; xwd 0,"S " ;43 display/suppress stars c.size=.-c.tab ;size of command abbr table d.tab: asciz " " asciz " UP" asciz " DN" asciz " RI" asciz " LF" asciz " FED" asciz " KLI" asciz " ALL" asciz " ALL" asciz " FW" asciz " BK" asciz " RI" asciz " LF" w.row: z w.col: z w.id: z w.uot: z w.bear: z w.elev: z w.rang: z ; scanner tables ; ; scan.1 and scan.2 contain data on objects that are visible in the ; viewer. ; ; scan.1: ; bit 0-8 object nbr (index to universal tables) ; bit 9-17 object id (1 thru 7) ; bit 18-26 viewer column ; bit 27-35 viewer row ; scan.2: ; range (converted to integer) ; ; the scan tables are in ascending sequence by row, descending ; sequence by range within row. scan.1: block ^d145 scan.2: block ^d145 s.max: z s.star: z v.pos: z v.col: z v.row: z v.flag: z v.rset: z v.mod: z v.gra: asciz "(0" v.asc: asciz "(B" ; viewer tables ; ; viewer area 'bit maps'. ; ; v.wrk: work area for one viewer row ; v.tab: complete viewer area (all rows) ; ; viewer tables are in '6-bit'; the low 5 bits correspond to an ; entry in the viewer element table; the high bit indicates the ; location is the target if 1, not the target if 0 v.wrk: block ^d14 v.tab: block ^d173 v.wrkp: point 6,v.wrk v.tabp: point 6,v.tab v.wptr: point 6,v.wrk v.tptr: point 6,v.tab ; viewer object table ; ; list of displayable objects at 8 ranges ; ; 1st 6 bytes are element nrs (from v.elem); 00 implies end of elements. ; 7th byte is offset from center of object; 7 implies no display. v.obj: byte (5)17,22,12,22,17,00(6)2 ;range 0 - rom ship byte (5)05,00,00,00,00,00(6)0 ; star byte (5)13,15,14,00,00,00(6)1 ; planet byte (5)20,12,20,12,20,00(6)2 ; fed base byte (5)11,12,11,12,11,00(6)2 ; kli base byte (5)16,21,27,21,16,00(6)2 ; fed ship byte (5)17,22,10,22,17,00(6)2 ; kli ship byte (5)24,17,25,00,00,00(6)1 ; interceptor byte (5)23,12,23,00,00,00(6)1 ;range 1 - rom ship byte (5)05,00,00,00,00,00(6)0 ; star byte (5)13,15,14,00,00,00(6)1 ; planet byte (5)20,12,20,12,20,00(6)2 ; fed base byte (5)11,12,11,12,11,00(6)2 ; kli base byte (5)22,26,22,00,00,00(6)1 ; fed ship byte (5)23,17,23,00,00,00(6)1 ; kli ship byte (5)30,00,00,00,00,00(6)0 ; interceptor byte (5)04,00,00,00,00,00(6)0 ;range 2 - rom ship byte (5)05,00,00,00,00,00(6)0 ; star byte (5)13,15,14,00,00,00(6)1 ; planet byte (5)17,17,17,00,00,00(6)1 ; fed base byte (5)12,12,12,00,00,00(6)1 ; kli base byte (5)04,00,00,00,00,00(6)0 ; fed ship byte (5)04,00,00,00,00,00(6)0 ; kli ship byte (5)04,00,00,00,00,00(6)0 ; interceptor byte (5)01,00,00,00,00,00(6)0 ;range 3 - rom ship byte (5)05,00,00,00,00,00(6)0 ; star byte (5)17,00,00,00,00,00(6)0 ; planet byte (5)04,00,00,00,00,00(6)0 ; fed base byte (5)04,00,00,00,00,00(6)0 ; kli base byte (5)01,00,00,00,00,00(6)0 ; fed ship byte (5)01,00,00,00,00,00(6)0 ; kli ship byte (5)02,00,00,00,00,00(6)0 ; interceptor byte (5)02,00,00,00,00,00(6)0 ;range 4 - rom ship byte (5)06,00,00,00,00,00(6)0 ; star byte (5)03,00,00,00,00,00(6)0 ; planet byte (5)01,00,00,00,00,00(6)0 ; fed base byte (5)01,00,00,00,00,00(6)0 ; kli base byte (5)02,00,00,00,00,00(6)0 ; fed ship byte (5)02,00,00,00,00,00(6)0 ; kli ship byte (5)00,00,00,00,00,00(6)7 ; interceptor byte (5)00,00,00,00,00,00(6)7 ;range 5 - rom ship byte (5)03,00,00,00,00,00(6)0 ; star byte (5)01,00,00,00,00,00(6)0 ; planet byte (5)02,00,00,00,00,00(6)0 ; fed base byte (5)02,00,00,00,00,00(6)0 ; kli base byte (5)00,00,00,00,00,00(6)7 ; fed ship byte (5)00,00,00,00,00,00(6)7 ; kli ship byte (5)00,00,00,00,00,00(6)7 ; interceptor byte (5)00,00,00,00,00,00(6)7 ;range 6 - rom ship byte (5)01,00,00,00,00,00(6)0 ; star byte (5)02,00,00,00,00,00(6)0 ; planet byte (5)00,00,00,00,00,00(6)7 ; fed base byte (5)00,00,00,00,00,00(6)7 ; kli base byte (5)00,00,00,00,00,00(6)7 ; fed ship byte (5)00,00,00,00,00,00(6)7 ; kli ship byte (5)00,00,00,00,00,00(6)7 ; interceptor byte (5)00,00,00,00,00,00(6)7 ;range 7 - rom ship byte (5)02,00,00,00,00,00(6)0 ; star byte (5)00,00,00,00,00,00(6)7 ; planet byte (5)00,00,00,00,00,00(6)7 ; fed base byte (5)00,00,00,00,00,00(6)7 ; kli base byte (5)00,00,00,00,00,00(6)7 ; fed ship byte (5)00,00,00,00,00,00(6)7 ; kli ship byte (5)00,00,00,00,00,00(6)7 ; interceptor v.elem: xwd 0,"0 " ;viewer element table xwd 1,"1~" ; xwd 1,"0~" ;a list of all characters that can be displayed xwd 0,"0." ;in the viewer area xwd 0,"0-" ; xwd 0,"1*" ;left half: xwd 0,"0*" ; 0 - can be displayed in any mode xwd 1,"0`" ; 1 - requires graphics mode xwd 0,"00" ; 2 - requires ascii mode xwd 0,"08" ; xwd 0,"0=" ;right half - 1st character: xwd 0,"0(" ; 0 - normal intensity xwd 0,"0)" ; 1 - bold (increased) intensity xwd 0,"0@" ; xwd 1,"0f" ;right half - 2nd character: xwd 2,"0o" ; character to be displayed xwd 0,"0O" xwd 1,"0p" xwd 1,"0q" xwd 1,"0r" xwd 1,"0t" xwd 1,"0u" xwd 2,"0v" xwd 0,"0V" xwd 0,"0H" ; list of specific object names o.name: exp nm00,nm01,nm02,nm03,nm04,nm05,nm06,nm07 exp nm10,nm11,nm12,nm13,nm14,nm15,nm16,nm17 exp nm20,0,0,0,nm21,0,0,0,nm22,0,0,0,nm23,0,0,0 exp nm24,0,0,0,nm25,0,0,0,nm26,0,0,0,nm27,0,0,0 exp nm30,0,0,0,nm31,0,0,0,nm32,0,0,0,nm33,0,0,0 exp nm34,0,0,0,nm35,0,0,0,nm36,0,0,0,nm37 nm00: asciz "ENTERPRISE" nm01: asciz "COBRA" nm02: asciz "INTREPID" nm03: asciz "HAWK" nm04: asciz "LEXINGTON" nm05: asciz "PYTHON" nm06: asciz "VALIANT" nm07: asciz "RAVEN" nm10: asciz "17" nm11: asciz "21" nm12: asciz "18" nm13: asciz "22" nm14: asciz "19" nm15: asciz "23" nm16: asciz "20" nm17: asciz "24" nm20: asciz "ALPHA 1" nm21: asciz "BETA 2" nm22: asciz "GAMMA 3" nm23: asciz "DELTA 4" nm24: asciz "EPSILON 5" nm25: asciz "ZETA 6" nm26: asciz "RIGEL 7" nm27: asciz "THETA 8" nm30: asciz "IOTA 9" nm31: asciz "KAPPA 10" nm32: asciz "LAMBDA 11" nm33: asciz "OMICRON 12" nm34: asciz "SIGMA 13" nm35: asciz "TAU 14" nm36: asciz "UPSILON 15" nm37: asciz "OMEGA 16" o.nbr: exp 20,24,30,34,40,44,50,54 exp 60,64,70,74,100,104,110,114 exp 10,12,14,16,11,13,15,17 o.init: asciz "E" asciz "C" asciz "I" asciz "H" asciz "L" asciz "P" asciz "V" asciz "R" ; list of generic (universal) object names u.name: asciz " " asciz "Star " asciz "Neu Planet " asciz "Fed Starbase " asciz "Kli Starbase " asciz "Fed Starship " asciz "Kli Cruiser " asciz "Interceptor " p.name: ascii "Neu P" ascii "Fed P" ascii "Kli P" su.ln1: asciz " FederationKlingon Empire" su.ln2: asciz " ------------------------" spc.55: asciz " " spc.31: asciz " " n.wrk: block 3 wtime: z t.time: z t.more: z t.mor1: z t.mor2: z t.mor3: z t.mor4: z row.1: z row.2: z ; PSI interrupt blocks ife tops20,< ivb: exp ictrap,0,ps.vds,0 ccarg: exp .pcstp xwd 0,0 0 > ifn tops20,< levtab: lev1pc lev2pc lev3pc lev1pc: z lev2pc: z lev3pc: z chntab: 0 ;(0) 1,,ictrap ;(1) ctrl-c 2,,itypin ;(2) typein repeat ^d33,<0> ;Unused channels > flsh.p: z flsh.t: block 60 flsh01: z flsh03: byte (2)0(16)2(18)3 z flsh05: byte (2)1(16)1(18)1 byte (2)2(16)2(18)1 byte (2)2(16)0(18)1 byte (2)1(16)1(18)2 z flsh11: byte (2)1(16)2(18)2 byte (2)2(16)3(18)2 byte (2)2(16)1(18)3 byte (2)1(16)1(18)2 byte (2)1(16)2(18)1 z flsh16: byte (2)1(16)3(18)3 byte (2)2(16)4(18)3 byte (2)2(16)2(18)5 byte (2)1(16)2(18)3 byte (2)1(16)3(18)2 z flsh24: byte (2)1(16)2(18)2 byte (2)1(16)4(18)3 byte (2)2(16)4(18)3 byte (2)2(16)4(18)5 byte (2)2(16)4(18)6 byte (2)2(16)5(18)7 byte (2)1(16)2(18)3 byte (2)1(16)4(18)5 byte (2)1(16)5(18)4 byte (2)1(16)5(18)4 z ife tops20,< in.cnt: z in.ptr: z in.lst: iowd 200,in.blk 0 in.blk: block 200 op.blk: xwd 0,.iodmp+io.syn op.dev: sixbit /DSK/ xwd 0,io.blk lk.blk: lk.nam: sixbit /VTTREK/ lk.ext: sixbit /HLP/ 0 lk.ppn: xwd 0,0 > io.ptr: z io.cnt: z io.blk: block 13 z ;tty characteristics ife tops20,< tolct: z tofrm: z tonfc: z towid: z topag: z > opdef call [pushj p,] opdef ret [popj p,] opdef pjrst [jrst] ;replaces pushj/popj sequences opdef retskp [jrst rskp] ;***** TYPE types an ascii string without a CRLF. ; TYPEC types an ascii string followed by a CRLF. ; CRLF types a CRLF. define type (string)< outstr [asciz $'string'$] > define typec (string)< outstr [asciz $'string' $]> define crlf < outstr [asciz $ $]> ;***** DSPTYP types an ascii string in the display area. ; MSPTYP types an ascii string on the message line. define dsptyp (string)< dspstr [asciz $'string'$] > define msptyp (string)< mspstr [asciz $'string'$] > ;***** MORDSP causes the MOR key to flash. ; MORCLR returns the MOR key to its normal state. define mordsp < outstr [asciz /MOR8/] > define morclr < outstr [asciz /MOR8/] > ;***** GETIME gets the mstime and compares it to the last mstime retrieved. ; if not greater, assume new day and subtract 24 hours. ife tops20,< define getime (ac)< mstime ac, camge ac,u.time(suot) add ac,[^d86400000] movem ac,u.time(suot) >> ifn tops20,< define getime (ac)< ifn ac-t1, save t2 time movem t1,u.time(suot) rest t2 ifn ac-t1, >> ;***** SAVE saves up to 10 registers. ; REST restores registers saved by SAVE. define save (d0,d1,d2,d3,d4,d5,d6,d7,d8,d9)< ifn d0, ifn d1, ifn d2, ifn d3, ifn d4, ifn d5, ifn d6, ifn d7, ifn d8, ifn d9, > define rest (d0,d1,d2,d3,d4,d5,d6,d7,d8,d9)< ifn d9, ifn d8, ifn d7, ifn d6, ifn d5, ifn d4, ifn d3, ifn d2, ifn d1, ifn d0, > ; TREK is a KL10 program. The following macro handles the ADJBP if ; the program is run on a KI. KL versions have REPEAT 0 preceding ; the macro, KI versions have REPEAT 1. ifn ftki10,< define adjbp (r,p)< move rs,r move r,p ibp r sojg rs,.-1 >> ife tops20,< define gexit < exit 1, exit >> ifn tops20,< define gexit < haltf jrst trek >> ; Displays in the 4-line display area and on the message line are ; performed using local UUOs. The DSP UUOs display in the display ; area. The MSP UUOs display on the message line. loc 41 call uuoser ife tops20,< loc 137 byte (3)tk.who (9)tk.ver (6)tk.min (18)tk.edt > reloc opdef dspini [1b8] opdef dspchr [2b8] opdef dspstr [3b8] opdef dsppos [4b8] opdef dspout [5b8] opdef dspclr [6b8] opdef dspimm [7b8] opdef mspini [10b8] opdef mspchr [11b8] opdef mspstr [12b8] opdef msppos [13b8] opdef mspout [14b8] opdef mspclr [15b8] opdef mspimm [16b8] ifn tops20,< opdef inchrw [35b8] opdef outchr [36b8] opdef outstr [37b8] > uuoser: save ap ldb ap,[point 9,.jbuuo,8] jumpe ap,uuoerr call @uuotab-1(ap) rest ap ret uuoerr: ife tops20,< outstr [asciz / ? Illegal LUUO /] exit 1, jrst .-1 > ifn tops20,< exch ap,t1 hrroi t1,[asciz / ? Illegal LUUO /] psout exch t1,ap haltf jrst .-1 > uuotab: %dsini %dschr %dsstr %dspos %dsout %dsclr %dsimm %msini %mschr %msstr %mspos %msout %msclr %msimm repeat <37-<.-uuotab>>, ifn tops20,< reloc uuotab+34 .sichw .sochr .sostr > %dsini: push p,t1 hrrz ap,.jbuuo move t1,[ascii / /] skipn ap jrst [movem t1,utxt.b move t1,[xwd utxt.b,utxt.b+1] blt t1,utxt.b+53 jrst %dsi.1] sose ap imuli ap,13 movem t1,utxt.b(ap) hrri t1,utxt.b+1(ap) hrli t1,utxt.b(ap) blt t1,utxt.b+12(ap) %dsi.1: move t1,[point 7,utxt.b] add t1,ap movem t1,.dpptr movem t1,.dwptr pop p,t1 ret %dschr: hrrz ap,.jbuuo move ap,(ap) idpb ap,.dwptr ret %dsimm: hrrz ap,.jbuuo move ap,(ap) outchr ap idpb ap,.dwptr push p,t1 move t1,.dwptr subi t1,54 dpb ap,t1 pop p,t1 ret %dsstr: push p,t1 hrrz ap,.jbuuo move t1,[point 7,0] add t1,ap %dss.1: ildb ap,t1 jumpe ap,%dss.2 idpb ap,.dwptr jrst %dss.1 %dss.2: pop p,t1 ret %dspos: hrrz ap,.jbuuo soj ap, adjbp ap,.dpptr movem ap,.dwptr ret %dsout: push p,t1 push p,t2 push p,t3 push p,t4 push p,row push p,col hrrz ap,.jbuuo skipn ap jrst [movei ap,1 call %dso.1 movei ap,2 call %dso.1 movei ap,3 call %dso.1 movei ap,4 call %dso.1 jrst .+2] call %dso.1 pop p,col pop p,row pop p,t4 pop p,t3 pop p,t2 pop p,t1 ret %dso.1: move row,ap addi row,^d17 sose ap imuli ap,13 move t1,[point 7,utxt.a] add t1,ap movem t1,.dptra move t1,[point 7,utxt.b] add t1,ap movem t1,.dptrb movei col,6 setzm .dcol %dso.2: ildb t1,.dptra ildb t2,.dptrb came t1,t2 call %dso.3 caige col,^d59 aoja col,%dso.2 skipe .dcol outstr [asciz/8/] ret %dso.3: skipg .dcol jrst %dso.4 camg col,.dcol jrst %dso.4 move t3,col sub t3,.dcol soje t3,%dso.5 outstr [asciz/[/] caie t3,1 call %dso.6 outstr [asciz/C/] jrst %dso.5 %dso.4: outstr [asciz/[/] move t3,row call %dso.6 outstr [asciz/;/] move t3,col call %dso.6 outstr [asciz/H/] %dso.5: outchr t2 dpb t2,.dptra movem col,.dcol ret %dso.6: idivi t3,^d10 tro t3,"0" tro t4,"0" caie t3,"0" outchr t3 outchr t4 ret %dsclr: move ap,[ascii / /] movem ap,utxt.a move ap,[xwd utxt.a,utxt.a+1] blt ap,utxt.a+127 ret .dpptr: z ;permanent pointer .dwptr: z ;working pointer .dptra: z .dptrb: z .dcol: z utxt.a: block 4*13 utxt.b: block 4*13 %msini: push p,t1 move t1,[ascii / /] movem t1,mtxt.b move t1,[xwd mtxt.b,mtxt.b+1] blt t1,mtxt.b+12 %msi.1: move t1,[point 7,mtxt.b] movem t1,.mpptr movem t1,.mwptr pop p,t1 ret %mschr: hrrz ap,.jbuuo move ap,(ap) idpb ap,.mwptr ret %msimm: hrrz ap,.jbuuo move ap,(ap) outchr ap idpb ap,.mwptr push p,t1 move t1,.mwptr subi t1,54 dpb ap,t1 pop p,t1 ret %msstr: push p,t1 hrrz ap,.jbuuo move t1,[point 7,0] add t1,ap %mss.1: ildb ap,t1 jumpe ap,%mss.2 idpb ap,.mwptr jrst %mss.1 %mss.2: pop p,t1 ret %mspos: hrrz ap,.jbuuo soj ap, adjbp ap,.mpptr movem ap,.mwptr ret %msout: push p,t1 push p,t2 push p,t3 push p,t4 push p,row push p,col call %mso.1 pop p,col pop p,row pop p,t4 pop p,t3 pop p,t2 pop p,t1 ret %mso.1: move t1,[point 7,mtxt.a] movem t1,.mptra move t1,[point 7,mtxt.b] movem t1,.mptrb movei col,6 setzm .mcol %mso.2: ildb t1,.mptra ildb t2,.mptrb came t1,t2 call %mso.3 caige col,^d59 aoja col,%mso.2 skipe .mcol outstr [asciz/8/] ret %mso.3: skipg .mcol jrst %mso.4 camg col,.mcol jrst %mso.4 move t3,col sub t3,.mcol soje t3,%mso.5 outstr [asciz/[/] caie t3,1 call %mso.6 outstr [asciz/C/] jrst %mso.5 %mso.4: outstr [asciz/[23;/] move t3,col call %mso.6 outstr [asciz/H/] %mso.5: outchr t2 dpb t2,.mptra movem col,.mcol ret %mso.6: idivi t3,^d10 tro t3,"0" tro t4,"0" caie t3,"0" outchr t3 outchr t4 ret %msclr: move ap,[ascii / /] movem ap,mtxt.a move ap,[xwd mtxt.a,mtxt.a+1] blt ap,mtxt.a+25 ret .mpptr: z .mwptr: z .mptra: z .mptrb: z .mcol: z mtxt.a: block 13 mtxt.b: block 13 ifn tops20,< .sichw: save t1 pbin hrrz ap,.jbuuo cain ap,t1 movei ap,0(p) cain ap,ap movei ap,-2(p) movem t1,(ap) rest t1 ret .sostr: save t1 hrrz t1,.jbuuo cain t1,t1 movei t1,0(p) cain t1,ap movei t1,-2(p) tlo t1,-1 psout rest t1 ret .sochr: pop p,(p) ;prune pdl move ap,0(p) ;restore ap movem t1,0(p) ;save t1 move t1,@.jbuuo pbout rest t1 ret ;exit from LUUO > ifn tops20,< EV:: jrst boots jrst boots byte (3)tk.who (9)tk.ver (6)tk.min (18)tk.edt > TREK:: ife tops20,< setz t1, setuwp t1, skip setzm dbugf skipe .jbddt setom dbugf > move sp,[iowd pdlsz,pdl] ;set up the push down list ifn tops20,< move t1,segver came t1,ev+2 ;same version? jrst vererr ;nope - srry > call inipsi call vtini skipn dbugf call vtest call fintty call setup movei c,cctrap ife tops20, ifn tops20, call vtest jrst trek1 type <> skipn dbugf call dspcon call enedsp call shldsp trek1: call wrpdsp call rotran call obload dspclr mspclr setzm t.time setzm t.more TRMAIN:: call vtcmd skipge t1,c.imm jrst [skipe t.more call @t.more jrst trmain] skipe t.more jrst [setzm t.more morclr jrst .+1] move ap,c.dir cain ap,5 jrst [call help jrst trmain] jumpe t1,tr.cmd tr.imm: skipe t.more jrst [setzm t.more morclr jrst .+1] call @[srscan srscan srscan srscan lrscan rfphas rfphot]-1(t1) jrst trmain tr.cmd: skipe t.more jrst [setzm t.more morclr jrst .+1] move t1,c.cmd jumpe t1,trmain call @[spec tlock refuel shield target phaser photon motion rotate warp dsplst captur trnsfr bases nearb alibr flibr klibr plibr send help users help help quit quit rfresh slftst rapfir score assist ralert yalert salert flibb flibp flibs klibb klibp klibs plibn]-1(t1) jrst trmain ife tops20, ;***** SRSCAN ; ; short range sensor scan. search depends on the value of the ; immediate flag: ; ; i = fed, 2 = kli, 3 = planet, 4 = anything SRSCAN:: call lstclr skipe t.more jrst [move uot,t.mor1 move ap,t.mor2 movem ap,c.imm move ap,t.mor3 movem ap,s.mask setzm t.more morclr jrst sr.mor] seto uot, hrrz t2,c.imm caile t2,2 jrst sr.nxt lsh t2,4 movem t2,s.mask sr.nxt: call sscan jrst sr.end cail lst,4 jrst [movem uot,t.mor1 move ap,c.imm movem ap,t.mor2 move ap,s.mask movem ap,t.mor3 movei ap,srscan movem ap,t.more jrst sr.end] sr.mor: aoj lst, movem uot,luot.b(lst) call catalg jrst sr.nxt sr.end: skipg lst jrst [mspini msptyp mspout ret] move ap,[xwd luot.b,luot.a] blt ap,luot.a+4 call lstout skipe t.more mordsp ret sscan: call stdscn ret fix ap,o.rang(uot) caile ap,^d1024 jrst sscan hrrz ap,c.imm cain ap,3 jrst ss.hit caie ap,4 jrst [hrrz ap,u.tab(uot) xor ap,s.mask trne ap,3b31 jrst sscan jrst ss.hit] caie t1,2 cain t1,7 skipa jrst sscan ss.hit: aos (p) ret LRSCAN:: call tarscn jrst [mspini msptyp mspout ret] call lstclr aoj lst, movem uot,luot.b(lst) call catalg move ap,[xwd luot.b,luot.a] blt ap,luot.a+4 dspini call lstdsp call lrshld dspout ret LRSHLD:: move ap,u.tab(uot) andi ap,17 caie ap,7 caig uot,17 skipa ret dspini 2 dsptyp < shields > skiple t3,u.shld(uot) jrst [dsptyp idivi t3,^d1000 call nbrout ret] movm t3,t3 dsptyp idivi t3,^d1000 call nbrout dsptyp <, energy > move t3,u.ener(uot) idivi t3,^d1000 call nbrout ret SPEC:: skipn dbugf ; skipa jrst [dspini dsptyp dspout ret] call lstclr skipe t.more jrst [move uot,t.mor1 move ap,t.mor2 movem ap,c.nbr1 setzm t.more morclr jrst sp.mor] seto uot, sp.nxt: call getlib jrst sp.end cail lst,4 jrst [movem uot,t.mor1 move ap,c.nbr1 movem ap,t.mor2 movei ap,spec movem ap,t.more jrst sp.end] sp.mor: aoj lst, movem uot,luot.b(lst) call catalg jrst sp.nxt sp.end: skipg lst jrst [mspini msptyp mspout ret] move ap,[xwd luot.b,luot.a] blt ap,luot.a+4 call lstout skipe t.more mordsp ret getlib: aoj uot, caile uot,217 ret camn uot,suot jrst getlib skipge t1,u.tab(uot) jrst getlib skipe c.nbr1 jrst [andi t1,17 came t1,c.nbr1 jrst getlib jrst .+1] aos (p) ret TLOCK:: call getobj ret fix t1,o.rang(uot) caile t1,^d1024 jrst [mspini msptyp mspout ret] movem uot,t.uot call conuot move t1,b1 movem t1,t.bear move t1,e1 movem t1,t.elev call contrc call tardsp type <8> mspini msptyp mspout ret SYNCH:: move t1,t.bear movem t1,b1 move t1,t.elev movem t1,e1 setzm t.bear setzm t.elev movei row,7 movei col,^d41 call tardsp type <8> call rot.zy call obload ret SHIELD:: move t2,c.dir caile t2,2 jrst shl.er move t1,c.cnt jumpe t1,shl.st move t1,c.nbr1 caige t1,0 jrst shl.er imuli t1,^d1000 movem t1,f.data movm t2,u.shld(suot) sub t1,t2 call enetst ret move t1,f.data skipa shl.st: movm t1,u.shld(suot) move t2,c.dir caig t2,0 skipl u.shld(suot) cain t2,2 movn t1,t1 movem t1,u.shld(suot) call shldsp ret shl.er: type <> ret TARGET:: setom t.uot move t1,c.cnt move t2,c.dir jrst @[ta.c0 ta.c1 ta.c2](t1) ret ta.c0: call tarfnd skip ret ta.00: mspini msptyp mspout setzm t.bear setzm t.elev call contrc call tardsp ret ta.c1: fltr t3,c.nbr1 jrst @[ta.d0 ta.d1 ta.d2 ta.d3 ta.d4](t2) ret ta.d0: jumpe t3,ta.00 call getlst ret move t3,b1 movem t3,t.bear move t3,e1 movem t3,t.elev call contrc call tardsp ret ta.d1: move t4,t.elev fadr t4,t3 jrst ta.d21 ta.d2: move t4,t.elev fsbr t4,t3 ta.d21: movem t4,t.elev jrst ta.dd ta.d3: move t4,t.bear fadr t4,t3 jrst ta.d41 ta.d4: move t4,t.bear fsbr t4,t3 ta.d41: movem t4,t.bear ta.dd: call contrc call tardsp ret ta.c2: fltr t3,c.nbr1 movem t3,t.bear fltr t3,c.nbr2 movem t3,t.elev call contrc call tardsp ret TRNSFR:: movei t1,^d200 skipe c.cnt move t1,c.nbr1 caile t1,0 caile t1,^d1000 jrst [type <> ret] movem t1,p.ener imul t1,t1 movem t1,p.time move t1,p.ener imuli t1,^d1000 skiple u.shld(suot) jrst [mspini mspstr @o.name(suot) msptyp < shields are up> mspout ret] call enetst ret move t1,p.time idivi t1,^d100 caige t1,^d2000 movei t1,^d2000 movem t1,p.time setz t2, call pflash call tarscn jrst trs.wt fixr t1,o.rang(uot) caile t1,^d1024 jrst trs.wt movem t1,eadd.t move t1,p.ener call eneadd caile uot,7 jrst trs.wt movei t1,2000 lsh t1,@uot ior t1,suot hrli t1,10 movsm t1,eadd.a movem uot,eadd.b call lqadd trs.wt: move t1,p.time pjrst trwait SCORE:: setzm n.nuot move c,[xwd n.nuot,n.nuot+1] blt c,n.nuot+7 movei t1,120 sco.1: sojl t1,sco.3 skipge c,u.tab(t1) jrst sco.1 andi c,17 cail c,7 jrst sco.1 caie c,2 jrst sco.2 move t2,u.tab(t1) trne t2,@ally.n jrst sco.1 trne t2,@ally.f soj c, sco.2: aos n.nuot(c) jrst sco.1 sco.3: save p1,p2,p3 dspini 1 dsptyp dspini 2 dsptyp < Federation:> move p1,n.nuot+5 move p2,n.nuot+3 move p3,n.nuot+1 call sco.4 dspini 3 dsptyp < Klingon Empire:> move p1,n.nuot+6 move p2,n.nuot+4 move p3,n.nuot+2 call sco.4 dspini 4 dspout rest p1,p2,p3 ret sco.4: dsppos ^d20 move t1,p1 call nbrfix dsptyp < ship> caie p1,1 dsptyp dsppos ^d31 move t1,p2 call nbrfix dsptyp < base> caie p2,1 dsptyp dsppos ^d42 move t1,p3 call nbrfix dsptyp < planet> caie p3,1 dsptyp ret ASSIST:: setz t1, call alerts mspini msptyp mspout ret RALERT:: movei t1,1 call alerts mspini msptyp mspout ret YALERT:: movei t1,2 call alerts mspini msptyp mspout ret SALERT:: movei t1,3 call alerts mspini msptyp mspout ret ALERTS:: move uot,suot move c,mask.u movem c,s.mask pjrst alert ALERT:: movei t2,2000 lsh t2,@uot movei t3,sh.mx alr.1: camn t3,uot jrst alr.2 andcam t2,u.alrt(t3) caig t1,1 iorm t2,u.alrt(t3) alr.2: sojge t3,alr.1 hrlz c,t1 hrr c,uot movem c,eadd.b move c,s.mask trz c,@t2 hrli c,12 movsm c,eadd.a setzm eadd.t pjrst lqins RAPFIR:: mspini skipn c.nbr1 skipe c.nbr2 skipa jrst [setzm r.fire msptyp mspout type <PHATOR8> ret] skipn t1,c.nbr1 movei t1,^d200 caile t1,0 caile t1,^d1000 jrst rf.err skipn t2,c.nbr2 movei t2,1 caile t2,0 caile t2,3 jrst rf.err movem t1,rf.pha movem t2,rf.pho setom r.fire msptyp mspout type <PHATOR8> ret rf.err: type <> ret RFPHAS:: push p,c.cnt push p,c.nbr1 move c,rf.pha movem c,c.nbr1 movei c,1 movem c,c.cnt call phaser pop p,c.nbr1 pop p,c.cnt ret PHASER:: movei t1,^d200 skipe c.cnt move t1,c.nbr1 caile t1,0 caile t1,^d1000 jrst [type <> ret] movem t1,p.ener imul t1,t1 movem t1,p.time call enetst ret move t1,p.time idivi t1,^d75 caige t1,^d3000 movei t1,^d3000 movem t1,p.time setz t2, ;weapons code (phaser = 0) call pflash call tarscn jrst pha.wt fixr t1,o.rang(uot) caile t1,^d1024 jrst pha.wt setz t2, ;weapons code (phaser = 0) call pqadd pha.wt: move t1,p.time pjrst trwait RFPHOT:: push p,c.cnt push p,c.nbr1 move c,rf.pho movem c,c.nbr1 movei c,1 movem c,c.cnt call photon pop p,c.nbr1 pop p,c.cnt ret PHOTON:: movei t1,1 skipe c.cnt move t1,c.nbr1 cail t1,1 caile t1,3 jrst [type <> ret] camle t1,u.torp(suot) jrst [mspini msptyp mspout ret] movem t1,p.save imuli t1,^d40000 call enetst ret movei t1,^d200 movem t1,p.ener pho.sr: sos u.torp(suot) hrrzi t2,1b27 ;weapons code (photon = 1) call pflash call tarscn jrst pho.wt fixr t1,o.rang(uot) addi t1,^d2000 hrrzi t2,1b27 ;weapons code (photon = 1) call pqadd pho.wt: movei t1,^d2000 call trwait sosle p.save jrst pho.sr ret ;***** PFLASH PFLASH:: ior t2,mask.o hrli t2,4 ;weapons fire event code movsm t2,eadd.a movem suot,eadd.b setzm eadd.t push sp,t2 call lqadd pop sp,t2 trnn t2,1b27 pjrst pha.fl pjrst pho.fl pha.fl: move row,t.row move col,t.col call rctest ret call vtpos type <> movei t1,^d10 type <(1 (B> sojg t1,.-1 type <> call getvwr call dspvwr type <8> ret pho.fl: move row,t.row move col,t.col movei c,flsh03 movem c,flsh.p call flshld type <(1> call flshbr type <(B8> call flshch type <8> ret ;***** PQADD PQADD:: movem t1,eadd.t caile uot,sh.mx jrst pqa.1 move t1,u.tab(uot) tlnn t1,1b19 jrst pqa.1 movei t1,2000 lsh t1,@uot skipa pqa.1: move t1,mask.c ior t1,suot ior t1,t2 ;weapons code hrli t1,5 ;hit request event code movsm t1,eadd.a hrl t1,p.ener hrr t1,uot movem t1,eadd.b move t1,u.absx(uot) movem t1,eadd.x move t1,u.absy(uot) movem t1,eadd.y move t1,u.absz(uot) movem t1,eadd.z pjrst lqadd MOTION:: move t2,c.dir caie t2,3 cain t2,4 jrst rolshp move t3,s.warp move t2,c.cnt cain t2,2 jrst mot.a caie t2,1 jrst mot.t skipe c.dir jrst mot.b mot.ls: call getlst ret call rot.zy jrst mot.c mot.b: skipl t3,c.nbr1 caile t3,^d9 jrst [type <> ret] jrst mot.c mot.a: fltr t1,c.nbr1 movem t1,b1 fltr t1,c.nbr2 movem t1,e1 call rot.zy jrst mot.c mot.t: skipn c.dir call rottar mot.c: move t1,wf.tab(t3) movem t1,f.data move t2,c.dir cain t2,2 movnm t1,f.data imul t1,t1 call enetst pjrst obload call movshp hrlz t1,mask.o hrri t1,1 ;movement event code movem t1,eadd.a movem suot,eadd.b setzm eadd.t call hqadd call obload pjrst ifnear movshp: fltr t1,f.data fmpr t1,s.11 fadrm t1,u.absx(suot) fltr t1,f.data fmpr t1,s.12 fadrm t1,u.absy(suot) fltr t1,f.data fmpr t1,s.13 fadrm t1,u.absz(suot) ret rolshp: skipg c.cnt ret move t1,c.nbr1 cain t2,3 movn t1,c.nbr1 fltr t1,t1 call sincos call rot.x call obload ret IFNEAR:: seto uot, ifnr.1: call stdscn ret caile t1,4 ;test only bases and planets jrst ifnr.1 move ap,u.tab(uot) trnn ap,3b31 ;test if neutral jrst ifnr.1 ;don't perturb neutral entities setz t1, fix ap,o.rang(uot) caig ap,^d1024 call tqins jrst ifnr.1 ROTATE:: skipg t1,c.cnt jrst rot.d cain t1,2 jrst rot.2 skipg t2,c.dir jrst rot.ls move t1,c.nbr1 caie t2,2 cain t2,4 movn t1,t1 fltr t1,t1 call sincos movei c,rot.z caig t2,2 movei c,rot.y call @c pjrst obload rot.ls: call getlst ret call rot.zy pjrst obload rot.d: skipg t2,c.dir jrst rot.t call tarfnd ret rot.t: call rottar pjrst obload rot.2: fltr t1,c.nbr1 movem t1,b1 fltr t1,c.nbr2 movem t1,e1 call rot.zy pjrst obload ROTTAR:: move t1,t.bear movem t1,b1 move t1,t.elev movem t1,e1 call rot.zy setzm t.bear setzm t.elev movei row,7 movem row,t.row movei col,^d41 movem col,t.col ret WARP:: skipn t1,c.cnt jrst wrp.ds move t2,c.nbr1 caige t2,0 jrst wrp.er caile t2,^d9 jrst wrp.er caie t1,2 jrst wrp.ex move t3,c.nbr2 caige t3,0 jrst wrp.er caile t3,^d1000 jrst wrp.er movem t3,wf.tab(t2) wrp.ex: movem t2,s.warp call wrpdsp ret wrp.ds: dspini 1 dsptyp dspini 2 dsptyp < w0:> move t1,wf.tab call nbrfix dsptyp < w1:> move t1,wf.tab+1 call nbrfix dsptyp < w2:> move t1,wf.tab+2 call nbrfix dsptyp < w3:> move t1,wf.tab+3 call nbrfix dsptyp < w4:> move t1,wf.tab+4 call nbrfix dspini 3 dsptyp < w5:> move t1,wf.tab+5 call nbrfix dsptyp < w6:> move t1,wf.tab+6 call nbrfix dsptyp < w7:> move t1,wf.tab+7 call nbrfix dsptyp < w8:> move t1,wf.tab+8 call nbrfix dsptyp < w9:> move t1,wf.tab+9 call nbrfix dspini 4 dspout ret wrp.er: type <> ret ret DSPLST:: skipe t1,c.nbr1 pjrst dspany movei lst,4 skipl luot.a(lst) pjrst lstout sojg lst,.-2 mspini msptyp mspout ret DSPANY:: cail t1,1 caile t1,30 jrst [type <> ret] move uot,o.nbr-1(t1) skipl c,u.tab(uot) trnn c,@mask.c jrst [mspini msptyp mspout ret] call lstclr aoj lst, movem uot,luot.b(lst) move c,[xwd luot.b,luot.a] blt c,luot.a+4 pjrst lstout CAPTUR:: call getobj ret hrrz t2,u.tab(uot) andi t2,7 caie t2,2 jrst ca.np move t2,o.rang(uot) camle t2,[512.0] jrst ca.re move t2,u.tab(uot) tlne t2,100 jrst ca.up move t2,u.tab(uot) trz t2,7b31 ior t2,ally.u movem t2,u.tab(uot) call catalg mspini msptyp mspout call rebtim movem t1,rebel(uot) ret ca.np: call ca.id msptyp < is not a planet> mspout ret ca.re: call ca.id msptyp < is not within 512 units> mspout ret ca.id: mspini jumpe t1,[msptyp ret] msptyp tro t1,"0" mspchr t1 ret ca.up: setz t1, call tqins mspini msptyp mspout ret REFUEL:: movei uot,7 call nscanp jrst ref.er camle t3,[512.0] jrst ref.er move t1,suot move t2,uot call reener call enedsp movei t1,^d1500 pjrst trwait ref.er: mspini msptyp mspout ret ;***** REENER ; ; refuels ship T1 from base (or planet) T2. REENER:: save t2 move t2,u.tab(t2) andi t2,17 move c,u.torp(t1) addi c,3 caie t2,2 addi c,2 caile c,^d10 movei c,^d10 movem c,u.torp(t1) move c,[^d250000] caie t2,2 add c,c addb c,u.ener(t1) movm t2,u.shld(t1) add c,t2 camle c,[^d5000000] jrst [move c,[^d5000000] sub c,t2 movem c,u.ener(t1) jrst .+1] rest t2 ret NEARB:: call lstclr movei uot,7 call nscanb jrst nrb.2 aoj lst, movem uot,luot.b(lst) nrb.2: movei uot,17 call nscanp jrst nrb.3 aoj lst, movem uot,luot.b(lst) nrb.3: skipg lst jrst [mspini msptyp mspout ret] move ap,[xwd luot.b,luot.a] blt ap,luot.a+4 call lstout ret NSCANB: movei t2,17 ;don't include planets skipa NSCANP: movei t2,117 setzb t3,t4 nsc.1: aoj uot, camle uot,t2 jrst nsc.2 skipge t1,u.tab(uot) jrst nsc.1 andi t1,17 move c,ally.u caie t1,7 tdnn c,u.tab(uot) jrst nsc.1 jumpe t3,nsc.11 camg t3,o.rang(uot) jrst nsc.1 nsc.11: move t3,o.rang(uot) move t4,uot jrst nsc.1 nsc.2: skipe uot,t4 aos (p) ret PLIBN:: move c,ally.n movem c,s.mask skipa PLIBR:: setzm s.mask setzm s.muid movei uot,17 pjrst libscn ALIBR:: seto uot, setzm s.mask setzm s.muid pjrst libscn FLIBB:: movei c,3 jrst flib FLIBP:: movei c,2 jrst flib FLIBS:: movei c,5 jrst flib FLIBR:: setz c, FLIB:: movem c,s.muid move c,ally.f movem c,s.mask seto uot, pjrst libscn KLIBB:: movei c,4 jrst klib KLIBP:: movei c,2 jrst klib KLIBS:: movei c,6 jrst klib KLIBR:: setz c, KLIB:: movem c,s.muid move c,ally.k movem c,s.mask seto uot, pjrst libscn BASES:: move c,ally.u movem c,s.mask setzm s.muid movei uot,7 pjrst libscn SEND:: move t1,c.nbr1 caig t1,2 jrst send.1 move uot,t1 subi uot,3 skipge u.tab(uot) jrst sen.na send.1: movei row,^d21 movem row,m.row call getmsg ret call movmsg move t2,c.nbr1 cail t2,3 jrst [movei t1,200 lsh t1,@t2 jrst send.2] move t1,@[mask.a mask.f mask.k](t2) trz t1,@mask.c send.2: hrli t1,3 ;message event code movsm t1,eadd.a movem suot,eadd.b setzm eadd.t pjrst lqadd sen.na: mspini mspstr @o.name(uot) msptyp < not available> mspout ret MOVMSG:: push sp,t1 push sp,t2 move t1,suot imuli t1,^d11 addi t1,u.msg move t2,t1 hrli t1,m.msg blt t1,^d10(t2) pop sp,t2 pop sp,t1 ret USERS:: call lstclr skipe t.more jrst [move uot,t.mor1 setzm t.more morclr jrst usr.mr] movei uot,10 usr.nx: sojl uot,usr.en skipl c,u.tab(uot) tlnn c,1b19 jrst usr.nx cail lst,4 jrst [movem uot,t.mor1 movei ap,users movem ap,t.more jrst usr.en] usr.mr: aoj lst, movem uot,luot.b(lst) jrst usr.nx usr.en: skipg lst jrst [mspini msptyp mspout ret] dspini usr.ot: skipl uot,luot.b(lst) call usrout sojg lst,usr.ot dspout skipe t.more mordsp ret USROUT:: dspini (lst) dspstr @o.name(uot) dsppos ^d16 ife tops20,< move t4,u.tty(uot) call sixout dsptyp < > move t4,u.nam1(uot) call sixout move t4,u.nam2(uot) call sixout dsptyp < > move t4,u.ppn(uot) call ppnout > ifn tops20,< dsptyp move t2,u.tty(uot) call octout dsptyp < > hrroi t1,io.blk move t2,u.namx(uot) dirst jfcl dspstr io.blk > ret ife tops20,< SIXOUT:: movei t1,6 setz t3, lshc t3,6 addi t3,40 dspchr t3 sojg t1,.-4 ret PPNOUT:: dsptyp <[> hlrz t2,t4 call octout dsptyp <,> hrrz t2,t4 call octout dsptyp <]> ret > OCTOUT:: idivi t2,10 push p,t3 skipe t2 call octout pop p,t3 addi t3,"0" dspchr t3 ret HELP:: dspini skipe t.more jrst [setzb t3,t.more morclr jrst hlp.m] call closin call openin jrst hlp.nf move t3,c.cmd hrrz t3,c.tab(t3) hlp.1: call readin jrst hlp.nf move t1,[point 7,io.blk] ildb t2,t1 hlp.2: caie t2,"." jrst hlp.1 ildb ap,t1 lsh ap,7 ildb t2,t1 cail t2,"A" caile t2,"Z" jrst [iori ap," " jrst hlp.21] ior ap,t2 ildb t2,t1 hlp.21: came ap,t3 jrst hlp.2 setz t3, hlp.3: call readin jrst hlp.4 move t1,[point 7,io.blk] ildb t2,t1 cain t2,"." jrst hlp.4 cail t3,4 jrst [movei ap,help movem ap,t.more dspout mordsp ret] hlp.m: aoj t3, dspini (t3) dspstr io.blk jrst hlp.3 hlp.4: dspout call closin ret hlp.nf: mspini msptyp mspout ret OPENIN:: ife tops20,< move c,[sixbit /VTTREK/] movem c,lk.nam move c,[sixbit /HLP/] movem c,lk.ext skipe dbugf jrst op.1 move ap,[xwd -1,135] ;get run device gettab ap, skipa movem ap,op.dev move ap,[xwd -1,136] ;get run ppn gettab ap, skipa movem ap,lk.ppn op.1: open hlpchn,op.blk ret lookup hlpchn,lk.blk ret setzm in.cnt retskp > ifn tops20,< save t1,t2 hrroi t1,[asciz /HLP/] movem t1,gjblk+.gjext setz t2, movei t1,gjblk gtjfn jrst openix movem t1,hlpjfn movx t2,7b5+of%rd openf jrst [move t1,hlpjfn rljfn jfcl jrst openix] aos -2(p) ;skip return openix: pop p,t2 pop p,t1 ret > READIN:: setzm io.blk move ap,[xwd io.blk,io.blk+1] blt ap,io.blk+12 move ap,[point 7,io.blk] movem ap,io.ptr setzm io.cnt rd.1: ifn tops20,< move t1,hlpjfn bin erjmp closin cain t2,15 jrst rd.1 cain t2,12 retskp idpb t2,io.ptr > ife tops20,< sosle in.cnt jrst rd.2 in hlpchn,in.lst jrst [movei ap,1200 movem ap,in.cnt move ap,[point 7,in.blk] movem ap,in.ptr jrst rd.2] ret rd.2: ildb ap,in.ptr skipg ap jrst [call closin ret] cain ap,15 jrst rd.1 cain ap,12 retskp idpb ap,io.ptr > aos io.cnt jrst rd.1 CLOSIN:: ife tops20,< close hlpchn, releas hlpchn, > ifn tops20,< save t1 move t1,hlpjfn closf jfcl setzm hlpjfn rest t1 > ret QUIT:: type <> call stwait move c,u.tab(suot) tlz c,1b19 movem c,u.tab(suot) call wrapup gexit SLFTST:: type <> movei t1,^d2000 call trwait jrst rfresh RFRESH:: call dspcon call enedsp call shldsp call wrpdsp skipe r.fire type <PHATOR8> ife tops20, ifn tops20, call d.time call vwrclr call obload dspclr mspclr ret ;***** STDSCN ; ; scans for active objects, skips stars and our ship. returns ; uot in uot and uid in t1. uot must be initialized to 1 less ; than the 1st u.tab entry to be scanned. in most cases, this ; value is -1. if object is found, skip return is taken. STDSCN:: aoj uot, caile uot,117 ret camn uot,suot jrst stdscn skipge t1,u.tab(uot) jrst stdscn hrrz t1,t1 andi t1,17 aos (sp) ret ;***** LIBSCN LIBSCN:: call lstclr skipe t.more jrst [move uot,t.mor1 move ap,t.mor2 movem ap,s.mask setzm t.more morclr jrst lb.mor] lb.nxt: call lbscn jrst lb.end skipn s.mask jrst lb.sc1 trnn t1,@s.mask jrst lb.nxt lb.sc1: skipn s.muid jrst lb.sc2 andi t1,17 came t1,s.muid jrst lb.nxt lb.sc2: cail lst,4 jrst [movem uot,t.mor1 move ap,s.mask movem ap,t.mor2 movei ap,libscn movem ap,t.more jrst lb.end] lb.mor: aoj lst, movem uot,luot.b(lst) jrst lb.nxt lb.end: skipg lst jrst [mspini msptyp mspout ret] move ap,[xwd luot.b,luot.a] blt ap,luot.a+4 call lstout skipe t.more mordsp ret lbscn: aoj uot, caile uot,117 ret camn uot,suot jrst lbscn skipge t1,u.tab(uot) jrst lbscn trnn t1,@mask.c jrst lbscn aos (p) ret ;***** GETOBJ GETOBJ:: skipe c.dir jrst go.er skipe t1,c.cnt jrst go.lst call tarscn jrst [mspini msptyp mspout ret] setz t1, aos (p) ret go.lst: caie t1,1 jrst go.er call getlst skipa aos (p) ret go.er: type <> ret ;***** TARFND TARFND:: save p1,p2,p3,p4 movei p1,^d13 movei p2,1 movei p3,7 movei p4,^d75 camle p1,t.row caml p2,t.row jrst tf.nul camle p4,t.col caml p3,t.col jrst tf.nul cain t2,1 move p1,t.row cain t2,2 move p2,t.row cain t2,3 move p3,t.col cain t2,4 move p4,t.col movem p1,t.rmax movem p2,t.rmin movem p3,t.cmin movem p4,t.cmax call tartst jrst tf.nul call contrc call tardsp type <8> rest p1,p2,p3,p4 aos (sp) ret tf.nul: mspini msptyp mspout rest p1,p2,p3,p4 ret ;***** TARTST TARTST:: setz t3, setob uot,f.hit tt.nxt: aoj uot, hrrz t1,scan.1(uot) jumpe t1,tt.end trz t1,-1000 camle t1,t.rmin caml t1,t.rmax jrst tt.nxt hrrz t2,scan.1(uot) lsh t2,-^d9 camle t2,t.cmin caml t2,t.cmax jrst tt.nxt came t1,t.row jrst .+3 camn t2,t.col jrst tt.nxt move t4,t1 soj t4, imuli t4,^d78 add t4,t2 adjbp t4,v.tabp ldb t4,t4 trz t4,40 cain t4,0 jrst tt.nxt push sp,uot hlrz uot,scan.1(uot) lsh uot,-^d9 call conuot move t1,b1 fsbr t1,t.bear fmpr t1,t1 move t2,e1 fsbr t2,t.elev fmpr t2,t2 fadr t1,t2 movem t1,f.data movei ap,f.loc call sqrt.## pop sp,uot jumpe t3,tt.n1 camg t3,rs jrst tt.nxt tt.n1: move t3,rs move t1,b1 movem t1,w.bear move t1,e1 movem t1,w.elev setzm f.hit jrst tt.nxt tt.end: skipge f.hit ret move t1,w.bear movem t1,t.bear move t1,w.elev movem t1,t.elev aos (sp) ret ;***** TARSCN TARSCN:: push sp,p1 push sp,p2 push sp,p3 push sp,p4 move p1,t.bear fsbr p1,[0.9] move p2,t.bear fadr p2,[0.9] move p3,t.elev fsbr p3,[2.1] move p4,t.elev fadr p4,[2.1] setzb t3,t4 setob uot,f.hit ts.nxt: call rngscn jrst ts.end call conuot camg p1,b1 camge p2,b1 jrst ts.nxt camg p3,e1 camge p4,e1 jrst ts.nxt jumpe t3,ts.n1 camg t3,o.rang(uot) jrst ts.nxt ts.n1: move t3,o.rang(uot) move t4,uot setzm f.hit jrst ts.nxt ts.end: pop sp,p4 pop sp,p3 pop sp,p2 pop sp,p1 movem t4,uot skipl f.hit aos (sp) ret ;***** RNGSCN RNGSCN:: aoj uot, caile uot,217 ret camn uot,suot jrst rngscn skipge u.tab(uot) jrst rngscn fixr ap,o.rang(uot) caile ap,^d2048 jrst rngscn aos (p) ret ;***** GETLST GETLST:: move t1,c.cnt caile t1,1 jrst gl.er skipl t1,c.nbr1 caile t1,4 jrst gl.er skipg t1 movei t1,1 skipge uot,luot.a(t1) jrst [mspini msptyp tro t1,"0" mspchr t1 msptyp < is empty> mspout ret] push p,t1 call lstxyz call rbecmp call conang pop p,t1 aos (p) ret gl.er: type <> ret ;***** LSTCLR LSTCLR:: setom luot.b move ap,[xwd luot.b,luot.b+1] blt ap,luot.b+4 setz lst, ret ;***** CATALG CATALG:: caig uot,7 jrst [move c,ally.t tdnn c,u.tab(uot) ret move c,u.absx(uot) movem c,u.lstx(uot) move c,u.absy(uot) movem c,u.lsty(uot) move c,u.absz(uot) movem c,u.lstz(uot) jrst cat.1] move c,u.tab(uot) andi c,17 caie c,7 cain c,1 ret cat.1: move c,mask.u iorm c,u.tab(uot) ret ;***** LSTOUT LSTOUT:: dspini movei lst,1 skipl luot.a(lst) call lstdsp caige lst,4 aoja lst,.-3 dspout ret ;***** LSTDSP LSTDSP:: dspini (lst) move t1,lst tro t1,"0" dspchr t1 dsptyp < > move uot,luot.a(lst) skipge t2,u.tab(uot) ret hrrz t2,t2 andi t2,7 cain t2,2 ;test for planet jrst [hrrz t3,u.tab(uot) andi t3,3b31 lsh t3,-4 move t3,p.name(t3) movem t3,u.name+6 jrst .+1] movei t3,3 imul t3,t2 dspstr u.name(t3) caie t2,1 ;test for star cain t2,7 ;test for interceptor jrst ldsp.1 dspstr @o.name(uot) ldsp.1: dsppos ^d35 call lstxyz call rbecmp call conang fixr t1,b1 call nbrfix dsptyp fixr t1,e1 call nbrfix dsptyp fixr t1,r1 caile t1,^d9999 jrst [idivi t1,^d1000 call nbrfix dsptyp ret] dsptyp < > call nbrfix dsptyp ret ;***** LSTXYZ LSTXYZ:: move c,ally.t caig uot,7 tdnn c,u.tab(uot) jrst lxyz.1 push p,u.lstx(uot) push p,u.lsty(uot) push p,u.lstz(uot) jrst lxyz.2 lxyz.1: push p,u.absx(uot) push p,u.absy(uot) push p,u.absz(uot) lxyz.2: pop p,z1 pop p,y1 pop p,x1 ret ;***** WRPDSP WRPDSP:: type <> move t1,s.warp tro t1,"0" outchr t1 ret ;***** ENETST ENETST:: camle t1,u.ener(suot) jrst ene.er exch t1,u.ener(suot) subb t1,u.ener(suot) call enedsp aos (sp) ret ene.er: sub t1,u.ener(suot) mspini msptyp call fltdsp msptyp < units required> mspout ret ;***** ENEDSP ENEDSP:: move suot,s.uot type <> move t1,u.ener(suot) idivi t1,^d1000 call nbrdsp type <8> ret ;***** SHLDSP SHLDSP:: move suot,s.uot type <> skipg u.shld(suot) jrst [type jrst shld.1] type shld.1: movm t1,u.shld(suot) idivi t1,^d1000 call nbrdsp type <8> ret ;***** NBRDSP NBRDSP:: movei t4," " jumpge t1,.+3 movei t4,"-" movm t1,t1 movei t3,3 jrst .+5 jumpg t1,.+4 push sp,t4 movei t4," " jrst .+4 idivi t1,^d10 tro t2,"0" push sp,t2 sojge t3,.-7 movei t3,3 pop sp,t2 outchr t2 sojge t3,.-2 ret ;***** NBRFIX NBRFIX:: movei t4," " jumpge t1,.+3 movei t4,"-" movm t1,t1 movei t3,3 jrst .+5 jumpg t1,.+4 push sp,t4 movei t4," " jrst .+4 idivi t1,^d10 tro t2,"0" push sp,t2 sojge t3,.-7 movei t3,3 pop sp,t2 dspchr t2 sojge t3,.-2 ret ;***** NBROUT NBROUT:: jumpge t3,nr.out dsptyp <-> movm t3,t3 nr.out: idivi t3,^d10 push sp,t4 skipe t3 call nr.out pop sp,t4 addi t4,"0" dspchr t4 ret MSPNBR:: jumpge t3,ms.out msptyp <-> movm t3,t3 ms.out: idivi t3,^d10 push sp,t4 skipe t3 call ms.out pop sp,t4 addi t4,"0" mspchr t4 ret ;***** FLTDSP FLTDSP:: idivi t1,^d1000 push sp,t2 setz t3, idivi t1,^d10 push sp,t2 aoj t3, jumpg t1,.-3 pop sp,t2 tro t2,"0" mspchr t2 sojg t3,.-3 msptyp <.> pop sp,t1 idivi t1,^d10 push sp,t2 aoj t3, caige t3,3 jrst .-4 pop sp,t2 tro t2,"0" mspchr t2 sojg t3,.-3 ret ;***** GETVWR GETVWR:: move t1,row soj t1, imuli t1,^d78 add t1,col adjbp t1,v.tabp ldb t1,t1 ret ;***** DSPVWR DSPVWR:: move ap,t1 trze ap,40 type <> hlrz t2,v.elem(ap) skipe t2 outstr v.mod(t2) hrrz t2,v.elem(ap) trne t2,200 jrst [type <> outchr t2 type <> ret] outchr t2 trze t1,40 type <> ret ;***** RCTEST RCTEST:: caige row,2 ret caile row,^d12 ret caige col,^d8 ret caig col,^d74 aos (sp) ret ;***** TARCLR TARCLR:: move row,t.row move col,t.col movei ap,7 movem ap,t.row movei ap,^d41 movem ap,t.col call tardsp ret ;***** STBASE STBASE:: movei t1,^d2048 call shptst jrst sb.nsh ;no ship in range sb.tst: move c,u.tab(uot) caile t2,^d1024 jrst [call sb.st skip movei t1,^d6000 pjrst tqins] tlne c,1b27 jrst sb.att caile t2,^d512 jrst [tlnn c,1b26 call detins jrst sb.hib] save t1,uot call attins rest t1,uot sb.att: call autpha sb.hib: movei t1,^d3000 pjrst tqins sb.nsh: move c,u.tab(uot) ;no ship in range tlz c,3b27 movem c,u.tab(uot) call sb.st ret movei t1,^d6000 pjrst tqins sb.st: move c,u.ener(uot) caml c,[^d5000K] jrst sb.et addi c,^d150K camle c,[^d5000K] move c,[^d5000K] movem c,u.ener(uot) aos (p) ret sb.et: move c,u.shld(uot) caml c,[^d5000K] ret addi c,^d150K camle c,[^d5000K] move c,[^d5000K] movem c,u.shld(uot) aos (p) ret ;***** PLANET ; ; planet routine. responsible for launching and retrieving interceptors. ; ; planet uot's are a multiple of 4, ie the last 3 bits are 0. the ; planet's three interceptors immediately follow the planet and have ; uot's equal to the planet uot plus 1, 2, or 3. ; ; if a planet uot is known, the interceptor uot's are also known. ; if an interceptor uot is known, the planet's uot can be found by ; changing the last 3 bits of the interceptor uot to 0. a number ; of routines depend on this relationship. PLANET:: movsi t1,1b29 iorm t1,u.tab(uot) movei t1,^d2048 call shptst jrst pl.nsh ;no ship in range move c,u.tab(uot) caile t2,^d1024 jrst [tlnn c,1b26 call detins pjrst pl.reb] save uot tlnn c,1b27 call attins rest uot move t1,u.tab(uot) tlne t1,7 jrst pl.lch tlne t1,70 jrst [movei t1,^d3000 pjrst tqadd] tlz t1,100 tlo t1,7 movem t1,u.tab(uot) movei t1,^d15000 pjrst tqadd pl.nsh: move t1,u.tab(uot) tlne t1,70 jrst pl.get tlon t1,1 jrst pl.nsx tlon t1,2 jrst pl.nsx tlon t1,4 jrst pl.nsx tlz t1,3b27 movem t1,u.tab(uot) pjrst pl.reb pl.nsx: movem t1,u.tab(uot) movei t1,^d10000 pjrst tqadd pl.get: move t2,uot movsi t3,1 tlze t1,10 jrst pl.gt1 aoj t2, movsi t3,2 tlze t1,20 jrst pl.gt1 aoj t2, movsi t3,4 tlz t1,40 pl.gt1: aoj t2, ior t1,t3 movem t1,u.tab(uot) move t3,u.tab(t2) tlo t3,1b18 movem t3,u.tab(t2) setzm time.q(t2) movei t1,^d5000 call tqadd hrlz t1,mask.a hrri t1,2 ;delete object event code movem t1,eadd.a movem t2,eadd.b setzm eadd.t pjrst lqins pl.lch: move t2,uot movsi t3,10 tlze t1,1 jrst pl.lc1 aoj t2, movsi t3,20 tlze t1,2 jrst pl.lc1 aoj t2, movsi t3,40 tlz t1,4 pl.lc1: aoj t2, ior t1,t3 movem t1,u.tab(uot) move t3,u.tab(t2) andi t1,7b31 trz t3,7b31 ior t3,t1 tlz t3,1b18 move t1,ui.e7 movem t1,u.ener(t2) move t1,ui.s7 movem t1,u.shld(t2) movem t3,u.tab(t2) move uot,t2 movei t1,^d500 call tqadd trz uot,3 movei t1,^d3000 call tqadd ret pl.reb: call pl.shp jrst pl.rb2 getime t1 camge t1,rebel(uot) ret movei c,100 movem c,ran.mx setzm ran.mn call random trne t1,1 pjrst rebins call rebtim movem t1,rebel(uot) pl.rb2: movei t1,^d3000 pjrst tqins pl.shp: move t1,u.tab(uot) andi t1,3b31 skipn t1 ret lsh t1,-5 aos (p) pl.sh1: move t2,u.absx(uot) fsbr t2,u.absx(t1) fmpr t2,t2 move c,u.absy(uot) fsbr c,u.absy(t1) fmpr c,c fadr t2,c move c,u.absz(uot) fsbr c,u.absz(t1) fmpr c,c fadr t2,c camg t2,[4000000] ;1024*1024 ret addi t1,2 caig t1,sh.mx jrst pl.sh1 sos (p) ret ;***** INTERC INTERC:: call int.mv call int.ta ret INT.MV: move t1,uot ;interceptor uot move t2,t1 trz t1,3 ;form planet uot andi t2,3 ;form coordinate key move t3,@[u.absz(t1) u.absx(t1) u.absx(t1)]-1(t2) move t4,@[u.absy(t1) u.absz(t1) u.absy(t1)]-1(t2) hlrz t1,u.tab(uot) andi t1,17 fadr t3,a.fact(t1) fadr t4,b.fact(t1) movem t3,@[u.absz(uot) u.absx(uot) u.absx(uot)]-1(t2) movem t4,@[u.absy(uot) u.absz(uot) u.absy(uot)]-1(t2) aoj t1, caile t1,17 setz t1, movs c,u.tab(uot) trz c,17 ior c,t1 movsm c,u.tab(uot) movei t1,^d2000 call tqadd hrlz c,mask.a hrri c,1 ;movement event code movem c,eadd.a movem uot,eadd.b setzm eadd.t pjrst lqins INT.TA: hlrz t1,u.tab(uot) andi t1,360 lsh t1,-4 cail t1,6 seto t1, aoj t1, lsh t1,4 movs t2,u.tab(uot) trz t2,360 ior t2,t1 movsm t2,u.tab(uot) trne t1,360 ret movei t1,^d1024 call shptst ret ;no ship in range call autpha ret ;***** DETINS DETINS:: move c,u.tab(uot) tlo c,1b26 movem c,u.tab(uot) trnn c,3b31 ret trne c,1b31 jrst [hrrz c,mask.f jrst .+2] hrrz c,mask.k ior c,uot hrli c,11 movsm c,eadd.a hrrzm t1,eadd.b setzm eadd.t pjrst lqins ;***** ATTINS ATTINS:: move c,u.tab(uot) tlo c,3b27 movem c,u.tab(uot) trnn c,3b31 ret trne c,1b31 jrst [hrrz c,mask.f jrst .+2] hrrz c,mask.k tro c,1b27 ior c,uot hrli c,11 movsm c,eadd.a hrrzm t1,eadd.b setzm eadd.t pjrst lqins REBTIM:: getime t1 addi t1,^d10000 move t2,u.tab(uot) andi t2,3b31 movei t3,pl.mx rtim1: skipge c,u.tab(t3) jrst rtim2 andi c,3b31 came c,t2 jrst rtim2 move c,u.tab(t3) andi c,17 cain c,2 jrst [addi t1,^d10000 jrst rtim2] caie c,3 cain c,4 addi t1,^d30000 rtim2: soj t3, cail t3,sb.mn jrst rtim1 ret REBINS:: move c,u.tab(uot) trne c,1b31 jrst [hrrz c,mask.f jrst .+2] hrrz c,mask.k hrli c,13 movsm c,eadd.a hrrzm uot,eadd.b setzm eadd.t move c,u.tab(uot) trz c,3b31 tro c,1b29 movem c,u.tab(uot) pjrst lqins ;***** SHPTST ; ; Test for nearest ship within a given range of an object. T1 = test ; range. UOT = object uot. Non-skip return and T1 < 0 if no ship ; is in range. Skip return and T1 = ship uot if a ship is in range. ; Range is in T2. If object is neutral all ships are tested, ; otherwise only enemy ships are tested. SHPTST:: imul t1,t1 ;square the distance fltr t4,t1 ;t4 is the distance to beat hrrz c,u.tab(uot) ;get the uot's u.tab word andi c,3b31 ;mask everything but the alliance field skipe c ;zero means neutral trc c,3b31 ;the complement is the enemy movem c,s.mask ;save either neutral (0) or enemy mask movei t1,117 ;test ships and interceptors setom f.uot ;temp storage if any ship passes the tests spt.lp: came t1,uot skipge t2,u.tab(t1) ;active ship? jrst spt.nx ;no - skip it trnn t2,3b31 ;neutral? jrst spt.nx ;yes - skip it move c,t2 ;going to look for a ship or an interceptor andi c,17 cail c,3 ;ship uids are 5 and 6 caile c,7 ;interceptor uid is 7 jrst spt.nx ;neither a ship nor an interceptor skipe s.mask ;if the mask isn't zero, jrst [xor t2,s.mask ;xor it with u.tab word; trne t2,3b31 ;if zero, the ship is an enemy, jrst spt.nx ;if not zero, it's a friend jrst spt.rn] ;it's an enemy spt.rn: move t3,u.absx(uot) ;compute range ** 2 = (x1 - x2) ** 2 fsbr t3,u.absx(t1) fmpr t3,t3 ;if any intermediate square is greater than camle t3,t4 ; the squared least distance jrst spt.nx ; the ship is not nearest or is out of range. move c,u.absy(uot) fsbr c,u.absy(t1) fmpr c,c camle c,t4 ;test the y distance jrst spt.nx fadr t3,c move c,u.absz(uot) fsbr c,u.absz(t1) fmpr c,c camle c,t4 ;test the z distance jrst spt.nx fadr t3,c camle t3,t4 ;test the total distance jrst spt.nx ;ship is not closest or is out of range movem t3,t4 ;store the new least distance movem t1,f.uot ;save the ship's uot spt.nx: sojge t1,spt.lp skipge t1,f.uot ;f.uot < 0 means no target found. ret movem t4,f.data movei c,f.loc save t1 call sqrt.## fixr t2,rs rest t1 aos (p) ret ;***** FLSHLD FLSHLD:: save p1,p2 move p1,flsh.p setz t4, call flins fll.1: skipn p2,(p1) jrst fll.2 hlrz p2,p2 trze p2,1b18 aoja row,.+3 trze p2,1b19 soj row, sub col,p2 hrrz p2,(p1) call flins sojg p2,.-1 aoja p1,fll.1 fll.2: setzm flsh.t(t4) rest p1,p2 ret flins: call rctest jrst fli.1 call getvwr move t3,col lsh t3,^d9 ior t3,row hrl t3,t1 movem t3,flsh.t(t4) aoj t4, fli.1: aoj col, ret ;***** FLSHBR FLSHBR:: save p1 setzb p1,v.row flb.1: skipn row,flsh.t(p1) jrst flb.2 move col,row lsh col,-^d9 andi row,777 andi col,777 call vnextp type < > aoja p1,flb.1 flb.2: rest p1 ret ;***** FLSHCH FLSHCH:: save p1 setzb p1,v.row flc.1: skipn row,flsh.t(p1) jrst flc.2 hlrz t1,row move col,row lsh col,-^d9 andi row,777 andi col,777 call vnextp call dspvwr aoja p1,flc.1 flc.2: rest p1 ret ;***** TRWAIT TRWAIT:: type <> getime ap add ap,t1 movem ap,t.time tr.wt: ife tops20,< seto ap, wake ap, skip hrrzi ap,^d250 hiber ap, skip hrrzi ap,^d250 hiber ap, skip > ifn tops20,< movei t1,^d250 disms > call qtest getime ap camge ap,t.time jrst tr.wt type <> ret ;***** PHAHIT PHAHIT:: skipg o.relx(uot) ret fix t1,o.rang(uot) caile t1,^d512 ret save t1 call conuot call conurc rest t1 movei c,flsh05 movem c,flsh.p call flshld type <(B> call flshbr type <> call flshch type <8> ret ;***** PHOHIT PHOHIT:: skipg o.relx(uot) ret fix t1,o.rang(uot) caile t1,^d1792 ret save t1 call conuot call conurc rest t1 movei c,flsh11 caile t1,^d512 movei c,flsh05 caile t1,^d768 movei c,flsh01 movem c,flsh.p call flshld type <(B> call flshbr type <> call flshch type <8> ret ;***** EXPLOD EXPLOD:: skipg o.relx(uot) ret fixr t1,o.rang(uot) caile t1,^d2048 ret save t1,uot call scndel skipe row,row.1 jrst [camn row,t.row call tarupd move row,row.1 setom v.flag call vwrchg jrst .+1] rest uot call conuot call conurc rest t1 idivi t1,^d512 cail t1,7 ret hrrz c,u.tab(uot) andi c,17 cain c,7 addi t1,4 movei c,@[flsh24 ;everything but interceptors flsh24 flsh16 flsh11 flsh16 ;interceptors flsh16 flsh11 flsh05](t1) movem c,flsh.p call flshld type <(1> call flshbr type <(B8> call flshch type <8> ret ;**** ZAPPED ZAPPED:: movsi c,1b18 iorm c,u.tab(suot) move uot,suot andi uot,1 setz c, zap.1: skipl u.tab(uot) aoj c, addi uot,2 caig uot,sh.mx jrst zap.1 type <> type <> type <> type <> type <> type <> type <> type <> type <> type <> type <> type <> type <(B> movei t1,[asciz /#3/] skipn c movei t1,[asciz /#3/] outstr (t1) outstr @o.name(suot) type < Destroyed!> movei t2,[asciz /#4/] skipn c movei t2,[asciz /#4/] outstr (t2) outstr @o.name(suot) type < Destroyed!> skipn c jrst [movei t1,[asciz /FEDERATION/] movei t2,[asciz /KLINGON EMPIRE/] trne uot,1 exch t1,t2 type <#3> outstr (t1) type < Defeated!> type <#4> outstr (t1) type < Defeated!> type <#3> outstr (t2) type < Victorious!> type <#4> outstr (t2) type < Victorious!> jrst .+1] type <> ife tops20,< seto t2 trmno. t2, skip move c,[xwd 2,t1] movei t1,2 trmop. c, skipa jrst .-2 > ifn tops20,< movei t1,.cttrm dobe > call stwait call wrapup gexit ;***** ENETRN ENETRN:: call enedsp call shldsp mspini msptyp mspout ret ;***** DSPMSG DSPMSG:: imuli uot,^d11 type <> mspini mspstr u.msg(uot) mspout ret DSPNAM:: move ap,u.tab(uot) andi ap,7 jrst @[dnm.st dnm.rs dnm.bs dnm.bs dnm.rs dnm.rs dnm.in]-1(ap) dnm.st: dsptyp ret dnm.in: dsptyp ret dnm.bs: dsptyp dnm.rs: dspstr @o.name(uot) ret MSPNAM:: move ap,u.tab(uot) andi ap,7 jrst @[mnm.st mnm.rs mnm.bs mnm.bs mnm.rs mnm.rs mnm.in]-1(ap) mnm.st: msptyp ret mnm.in: msptyp ret mnm.bs: msptyp mnm.rs: mspstr @o.name(uot) ret ;***** AUTPHA, AUTPHO ; ; weapons fire from a base, interceptor, or unmanned ship. UOT is ; uot of firing entity. T1 is uot of receiving entity. uses A.FIRE ; work area. AUTPHA fires 200 units phaser, AUTPHO fires 1 torpedo. AUTPHA:: movei c,^d200 movem c,a.fire pjrst authit AUTPHO:: movsi c,1b27 hrri c,^d200 movem c,a.fire pjrst authit AUTHIT:: hlrz c,a.fire ior c,mask.a hrli c,4 movsm c,eadd.a movem uot,eadd.b setzm eadd.t save t1 call lqins rest t1 movei c,2000 move t2,u.tab(t1) caig t1,7 tlnn t2,1b19 jrst [lsh c,@suot jrst .+2] lsh c,@t1 ior c,uot hrli c,5 ;hit request event code movsm c,eadd.a hllz c,a.fire iorm c,eadd.a hrlz c,a.fire hrr c,t1 movem c,eadd.b movei c,^d750 movem c,eadd.t move c,u.absx(t1) movem c,eadd.x move c,u.absy(t1) movem c,eadd.y move c,u.absz(t1) movem c,eadd.z pjrst lqins ;***** ENEADD ENEADD:: imuli t1,^d1000 skipg c,u.shld(uot) jrst eda.2 sub c,t1 jumpl c,eda.1 caig c,^d100000 movn c,c ;shields down movem c,u.shld(uot) ret eda.1: movn t1,c setzb c,u.shld(uot) eda.2: add t1,u.ener(uot) sub t1,c ;c is < 0 - this is an add camle t1,[^d5000000] move t1,[^d5000000] add t1,c ;c is < 0 - this is a subtract movem t1,u.ener(uot) ret ;***** ENEDEL ENEDEL:: imuli t1,^d1000 skipge ap,u.shld(uot) jrst edl.1 sub ap,t1 jumpl ap,edl.2 caig ap,^d100000 movn ap,ap movem ap,u.shld(uot) ret edl.1: movm ap,u.shld(uot) add t1,t1 sub ap,t1 jumpl ap,edl.3 movnm ap,u.shld(uot) ret edl.2: add ap,ap edl.3: movm t1,ap setzm u.shld(uot) exch t1,u.ener(uot) subm t1,u.ener(uot) ret ;***** PHRSET PHRSET:: call dstroy setom t.uot setzm t.bear setzm t.elev call contrc call tardsp ret ;***** DSTROY DSTROY:: move t1,u.tab(uot) tlo t1,1b18 movem t1,u.tab(uot) andi t1,7 cain t1,7 jrst [move t2,uot andi t2,3 movsi t1,4 lsh t1,@t2 move t2,uot trz t2,3 andcam t1,u.tab(t2) jrst .+1] cail uot,7 caile uot,120 ret setzm time.q(uot) ret ;***** SCANSR SCANSR:: setz t2, skipn scan.1(t2) ret hlrz t3,scan.1(t2) lsh t3,-^d9 came t3,uot aoja t2,.-5 hrrz row,scan.1(t2) move col,row trz row,-1000 lsh col,-^d9 aos (sp) ret ;***** GETMSG GETMSG:: move t1,m.ptr movem t1,m.wptr move t2,[ascii/ /] movsi t1,-^d10 movem t2,m.msg(t1) aobjn t1,.-1 move t2,[asciz/ /] movem t2,m.msg(t1) move uot,s.uot move t2,[point 7,o.init(uot)] ildb t2,t2 idpb t2,m.wptr movei t2,":" idpb t2,m.wptr movei t2," " idpb t2,m.wptr call gm.out gm.nxt: type <7> push sp,ap call vtget pop sp,ap skipe t1,c.inte jrst gm.spe cail ap,^d53 jrst gm.err aoj ap, move t2,c.char idpb t2,m.wptr outchr t2 jrst gm.nxt gm.spe: cain t1,^d13 jrst gm.exe cain t1,^d21 jrst gm.ctu cain t1,^d127 jrst gm.del cain t1,^d8 jrst gm.del caie t1,"" jrst gm.err move t2,c.char cain t2,"," jrst gm.era gm.err: type <> jrst gm.nxt gm.del: caig ap,3 jrst gm.err movei t2," " dpb t2,m.wptr type < > soj ap, move t1,ap adjbp t1,m.ptr movem t1,m.wptr jrst gm.nxt gm.ctu: push sp,ap movei ap,3 move t1,ap adjbp t1,m.ptr movem t1,m.wptr call gm.spc pop sp,ap adjbp ap,m.ptr setz t2, idpb t2,ap call gm.out move t1,ap adjbp t1,m.ptr movem t1,m.wptr jrst gm.nxt gm.era: move row,m.row movei col,5 call vtpos outstr spc.55 jrst .+5 gm.exe: cain ap,3 jrst gm.nxt call gm.spc aos (sp) type <7> move ap,[xwd m.msg,utxt.a+41] blt ap,utxt.a+53 move ap,[xwd m.msg,utxt.b+41] blt ap,utxt.b+53 ret gm.out: move row,m.row movei col,6 call vtpos outstr m.msg movei col,^d9 call vtpos movei ap,3 ret gm.spc: movei t2," " cail ap,^d53 jrst .+4 aoj ap, idpb t2,m.wptr jrst .-4 setz t2, idpb t2,m.wptr ret ;***** TQINS ; ; Activate a time.q entry if not already activated TQINS:: skipg time.q(uot) pjrst tqadd ret ;***** TQADD TQADD:: getime c add t1,c movem t1,time.q(uot) skipe c,q.time caml c,t1 movem t1,q.time ret ;***** QTEST QTEST:: push p,uot ;save uot getime c movem c,m.time call eqtest skipe q.time jrst [move ap,[xwd eadd.a,ewrk.a] blt ap,ewrk.z call tqtest move ap,[xwd ewrk.a,eadd.a] blt ap,eadd.z jrst .+1] pop p,uot ret ;***** TQTEST TQTEST:: move t1,m.time camg t1,q.time ret setzm q.time movei uot,pl.mx+1 tqt.1: sojl uot,r skipg t1,time.q(uot) jrst tqt.1 camge t1,m.time jrst [setzm time.q(uot) push p,uot call tqexec pop p,uot jrst tqt.1] skipe ap,q.time caml ap,t1 movem t1,q.time jrst tqt.1 ;***** TQEXEC TQEXEC:: move c,u.tab(uot) andi c,17 pjrst @[planet stbase stbase stship stship interc]-2(c) ret ;***** HQADD HQADD:: call qtest pjrst hqins ;***** LQADD LQADD:: call qtest pjrst lqins ;***** HQINS HQINS:: movei p1,hq.min movei p2,hq.max save uot call eqins rest uot ret ;***** LQINS LQINS:: movei p1,lq.min movei p2,lq.max save uot call eqins rest uot ret ;***** EQINS EQINS:: move c,mask.q andb c,eadd.a tlnn c,@mask.a ret eqi.1: move p3,p1 seto c, eqi.2: exch c,evnt.t(p3) skipn c jrst [movei c,evnt.a(p3) hrli c,eadd.a blt c,evnt.z(p3) aos c,m.time add c,eadd.t movem c,evnt.t(p3) ret] skipge evnt.t(p3) exch c,evnt.t(p3) addi p3,6 camg p3,p2 jrst eqi.2 save p1,p2 getime c movem c,m.time call eqtest rest p1,p2 jrst eqi.1 ;***** EQTEST EQTEST:: movei p1,hq.min movei p2,hq.max call eqscan movei p1,lq.min movei p2,lq.max call eqscan ret ;***** EQSCAN EQSCAN:: setz p3, eqs.1: skiple c,evnt.t(p1) camle c,m.time jrst eqs.2 move c,evnt.a(p1) tlnn c,@mask.c jrst eqs.2 movem p1,work.q(p3) aoj p3, eqs.2: addi p1,6 camg p1,p2 jrst eqs.1 eqs.3: move t1,p3 move t2,m.time aoj t2, seto t3, eqs.4: sojl t1,eqs.5 skipge c,work.q(t1) jrst eqs.4 camg t2,evnt.t(c) jrst eqs.4 move t3,t1 move t2,evnt.t(c) jrst eqs.4 eqs.5: skipge t3 ret move p1,work.q(t3) setom work.q(t3) call eqexec movs c,mask.c andcab c,evnt.a(p1) tlnn c,@mask.a setzm evnt.t(p1) jrst eqs.3 ;***** EQEXEC EQEXEC:: hrrz uot,evnt.b(p1) ;get the uot of the 'object' ship. hrrz t1,evnt.a(p1) ;get the event code. andi t1,77 ;mask the event code fields. caie t1,0 ;return if zero. pjrst @[movobj ;movement. delobj ;delete an object. dspmsg ;display ship-ship msg. hitdsp ;display a hit. hitreq ;process a hit. hitack ;acknowledge a hit. hitdst ;hit caused an object's destruction. enetrn ;transfer energy. detmsg ;notify detected or attacking. dalert ;notify needs assistance. rebmsg]-1(t1) ;notify planet has rebelled. ret ;none of the above. ;***** MOVOBJ MOVOBJ:: skipge u.tab(uot) ret call rbelod camn uot,t.uot call tarupd call scndel call scntst pjrst vwrtst ;***** DELOBJ DELOBJ:: ;; skipge u.tab(uot) ;; ret call scndel setzm row.2 pjrst vwrtst ;***** HITDSP HITDSP:: fix ap,o.rang(uot) caile ap,^d2048 ret call scansr ret move t2,ap move ap,evnt.a(p1) tlnn ap,1b27 pjrst phadsp pjrst phodsp phadsp: caig t2,^d1024 call rctest ret call vtpos type <> movei t1,^d10 type <(B (B> sojg t1,.-1 type <> call getvwr call dspvwr type <(B> type <8> ret phodsp: movei c,flsh03 caile t2,^d512 movei c,flsh01 movem c,flsh.p call flshld type <B> call flshbr type <> call flshch type <8> ret ;***** HITREQ ; ; Initiated by the PHASER, PHOTON, or AUTHIT routines. Determines ; whether an object has been hit. Two cases are handled: ; ; 1: Something hits us (uot = suot). ; 2: We hit a non-ship (uot not = suot). ; ; In both cases, only one ship processes a hit request (and therefore ; has exclusive control of the evnt data). Depending upon the outcome ; of this routine, the hit request is changed to a hit acknowledge ; (HITACK) or a hit destroy (HITDST), and the evnt.a ship mask is ; changed so that other ships can process it. HITREQ:: movei ap,6 ;hit acknowledge event code hrrm ap,evnt.a(p1) came uot,suot jrst hr.oth hr.us: hlrz ap,evnt.a(p1) andi ap,377 skipge u.tab(ap) ret call hittst ret hlrz t1,evnt.b(p1) call enedel call hitus movm ap,u.shld(uot) add ap,u.ener(uot) skipl ap jrst [call hitmsg pjrst hitchg] aos evnt.a(p1) call hitchg jrst zapped hr.oth: skipge u.tab(uot) ret hlrz t1,evnt.b(p1) call enedel movm ap,u.shld(uot) add ap,u.ener(uot) skipl ap jrst [call attack call hitack pjrst hitchg] call dstroy hlrz ap,evnt.a(p1) andi ap,377 camn ap,suot jrst [setom t.uot setzm t.bear setzm t.elev call contrc call tardsp jrst .+1] call hitdst aos evnt.a(p1) pjrst hitchg HITCHG:: move c,evnt.a(p1) tlo c,@mask.a and c,mask.q tlz c,@mask.c tlne c,@mask.a movem c,evnt.a(p1) ret ATTACK:: hrrz c,u.tab(uot) andi c,17 caie c,7 cain c,2 jrst att.pl caie c,3 cain c,4 jrst [call att.ms jrst att.ex] ret att.pl: save uot trz uot,3 call att.ms hlrz c,evnt.a(p1) andi c,377 move c,u.tab(c) trnn c,3b31 jrst [rest uot jrst att.ex] andi c,3b31 trc c,3b31 movem c,s.mask att.p1: move c,u.tab(uot) trz c,3b31 ior c,s.mask movem c,u.tab(uot) aoj uot, trne uot,3 jrst att.p1 rest uot att.ex: movei t1,^d2000 call tqins ret att.ms: movei c,1b18 move t1,u.tab(uot) tlon t1,3b28 iorm c,evnt.a(p1) movem t1,u.tab(uot) ret HITTST:: move t1,u.absx(uot) fsbr t1,evnt.x(p1) fmpr t1,t1 camle t1,[4096.0] ret move c,u.absy(uot) fsbr c,evnt.y(p1) fmpr c,c fadrm c,t1 camle t1,[4096.0] ret move c,u.absz(uot) fsbr c,evnt.z(p1) fmpr c,c fadrm ap,t1 camg t1,[4096.0] aos (p) ret HITUS:: type <> type <[?5h[?5l> type <[?5h[?5l> type <[?5h[?5l> type <[?5h[?5l> type <[?5h[?5l> call enedsp call shldsp ret HITMSG:: mspini hlrz t3,evnt.b(p1) call mspnbr msptyp < unit hit by > hlrz t1,evnt.a(p1) trnn t1,1b27 jrst [msptyp jrst .+2] msptyp mspout ret ;***** HITACK HITACK:: hlrz c,evnt.a(p1) trne c,1b27 jrst [call phohit jrst .+2] call phahit call attmsg ret ;***** HITDST HITDST:: call explod call dstmsg ret ATTMSG:: move c,evnt.a(p1) trnn c,1b18 ret move c,ally.u tdnn c,u.tab(uot) ret mspini save uot hlrz uot,evnt.a(p1) andi uot,377 call mspnam msptyp < attacking > rest uot call mspnam mspout ret DSTMSG:: hrrz c,u.tab(uot) andi c,17 cain c,7 ret mspini call mspnam msptyp < destroyed> mspout ret DETMSG:: mspini move c,evnt.a(p1) tlne c,1b27 jrst det.a det.d: call mspnam msptyp < detected by > save uot hlrz uot,evnt.a(p1) andi uot,377 call mspnam rest uot mspout ret det.a: save uot hlrz uot,evnt.a(p1) andi uot,377 call mspnam rest uot msptyp < attacking > call mspnam mspout ret REBMSG:: mspini msptyp mspstr @o.name(uot) mspout ret ;***** DALERT DALERT:: mspini mspstr @o.name(uot) hlrz c,evnt.b(p1) xct [msptyp < needs assistance> msptyp < on RED ALERT> msptyp < on YELLOW ALERT> msptyp < secure from alert>](c) mspout ret ;***** STSHIP ; ; these routines control the activities of unmanned ships. ship ; behavior is governed by a set of 'missions'. STSHIP:: call asetup call nrload hrrz t4,n.mssn(uot) jrst @[stsh.0 stsh.1 stsh.2 stsh.2 stsh.2 stsh.2](t4) stsh.0: call ai.ref ret jrst stsh.3 stsh.1: call ac.ref ret jrst stsh.3 stsh.2: call ai.ref ret call @[ac.esh ac.eba ac.cap ac.hlp]-2(t4) ret stsh.3: call ai.esh ret call ai.hlp ret call ai.eba ret call ai.cap ret pjrst au.sea ;***** ASETUP ; ; sets up us-them masks for this ship. ASETUP:: movei c,1 dmove t1,mask.f tdne c,uot exch t1,t2 dmovem t1,mska.u dmove t1,ally.f tdne c,uot exch t1,t2 dmovem t1,alya.u movm c,u.shld(uot) add c,u.ener(uot) movem c,n.ener movei t1,^d50 pjrst salloc ;***** NRLOAD ; ; builds a table of ranges from this ship for all non-star objects. ; saves the uot and range of the nearest object of a class (planet, ; fed base, kli base, etc) and of the nearest neu, fed, and kli ; planet. also catalogs objects within 1024 units (short range ; scan function). NRLOAD:: save p1,p2,p3 setom n.rang move c,[xwd n.rang,n.rang+1] blt c,n.rang+117 setom n.nuot move c,[xwd n.nuot,n.nuot+1] blt c,n.nuot+7 seto c, tlz c,1b18 movem c,n.nran move c,[xwd n.nran,n.nran+1] blt c,n.nran+7 setzm n.pcnt setzm n.scnt move t1,u.absx(uot) move t2,u.absy(uot) move t3,u.absz(uot) movei t4,117 nrl.1: skipl p2,u.tab(t4) camn t4,uot jrst nrl.3 move p1,t1 fsbr p1,u.absx(t4) fmpr p1,p1 movem p1,f.data move p1,t2 fsbr p1,u.absy(t4) fmpr p1,p1 fadrm p1,f.data move p1,t3 fsbr p1,u.absz(t4) fmpr p1,p1 fadrm p1,f.data movei c,f.loc save t1 call sqrt.## rest t1 fixr rs,rs movem rs,n.rang(t4) andi p2,17 caig rs,^d1024 call ncatal caie p2,2 jrst nrl.2 move p2,u.tab(t4) trne p2,@alya.u aos n.pcnt trnn p2,@mska.u jrst nrl.3 andi p2,3b31 lsh p2,-4 nrl.2: caml rs,n.nran(p2) jrst nrl.3 movem rs,n.nran(p2) movem t4,n.nuot(p2) nrl.3: sojge t4,nrl.1 move c,uot trne c,1 call nrswap rest p1,p2,p3 ret ;***** NCATAL ; ; the short range scan catalog routine. NCATAL:: caig t4,7 jrst [move c,alya.t tdnn c,u.tab(t4) ret aos n.scnt move c,u.absx(t4) movem c,u.lstx(t4) move c,u.absy(t4) movem c,u.lsty(t4) move c,u.absz(t4) movem c,u.lstz(t4) jrst ncat.1] caie p2,7 cain p2,1 ret skipg time.q(t4) call nqins ncat.1: move c,mska.u iorm c,u.tab(t4) ret ;***** NQINS NQINS:: move c,ally.n tdne c,u.tab(t4) ret getime c movem c,time.q(t4) skipe q.time camge c,q.time movem c,q.time ret ;***** NRSWAP ; ; swaps uots and ranges of near bases and ships. NRSWAP:: dmove t1,nrpl.u exch t1,t2 dmovem t1,nrpl.u dmove t1,nrsb.u exch t1,t2 dmovem t1,nrsb.u dmove t1,nrsh.u exch t1,t2 dmovem t1,nrsh.u dmove t1,nupl.u exch t1,t2 dmovem t1,nupl.u dmove t1,nusb.u exch t1,t2 dmovem t1,nusb.u dmove t1,nush.u exch t1,t2 dmovem t1,nush.u ret ;***** AU.SEA, MISSION 0 ; ; the basic mission, performed when no other mission applies. ; a tour at warp 7 of all bases and friendly planets. refuels ; at each stop. AU.SEA:: setzm n.mssn(uot) skipg t1,n.muot(uot) jrst au.se1 skipl c,u.tab(t1) trnn c,@alya.u jrst au.se1 jrst au.se2 au.se1: call aubase jrst au.se3 movem t1,n.muot(uot) au.se2: move c,n.rang(t1) caile c,^d512 pjrst a.mov7 move c,n.ener camge c,[^d5000K] pjrst a.reen call aunxtb jrst au.se3 movem t1,n.muot(uot) pjrst a.mov7 au.se3: movei t1,^d1000 pjrst tqins ;***** Ax.REF, MISSION 1 ; ; retreat to a base and refuel AI.REF:: move c,n.ener camge c,[^d2500K] call aubase retskp movem t1,n.muot(uot) movei c,1 ;REF mission code. movem c,n.mssn(uot) pjrst au.ref AC.REF:: move c,n.ener caml c,[^d5000K] pjrst askipr move t1,n.muot(uot) skipl c,u.tab(t1) trnn c,@alya.u jrst [call aubase pjrst askipr movem t1,n.muot(uot) jrst .+1] pjrst au.ref AU.REF:: hlrz c,n.mssn(uot) jumpg c,au.re2 au.re1: move c,n.rang(t1) caige c,^d512 jrst au.re9 jrst au.re8 au.re2: movei c,^d1024 camge c,nrpl.t caml c,nrpl.n jrst au.re5 caml c,nrsb.t jrst au.re5 skipg t2,n.scnt jrst au.re9 caile t1,sb.mx jrst au.re6 caile t2,1 jrst au.re4 move c,n.ener camge c,[^d2000K] jrst au.re9 movei c,0 hrlm c,n.mssn(uot) move t1,nush.t movei t2,^d400 pjrst a.phas au.re4: call aunxsb jrst au.re7 au.re5: caig t1,sb.mx jrst au.re8 au.re6: skipl t1,nusb.u jrst au.re7 move t1,n.muot(uot) call aunxtb skipa t1,n.muot(uot) au.re7: movem t1,n.muot(uot) au.re8: movei c,0 hrlm c,n.mssn(uot) caile t1,sb.mx skipe n.scnt pjrst a.mov8 pjrst a.mov7 au.re9: movei c,1 hrlm c,n.mssn(uot) pjrst a.reen ;***** Ax.ESH, MISSION 2 AI.ESH:: move c,nrsh.t caile c,^d1024 retskp move t1,nush.t movem t1,n.muot(uot) movei c,2 ;ESH mission code. movem c,n.mssn(uot) pjrst au.es2 AC.ESH:: move t1,n.muot(uot) move c,nrsh.t caig c,^d1024 jrst ac.es1 move c,n.rang(t1) caile c,^d1536 pjrst askipr hlrz c,n.mssn(uot) jumpe c,au.es3 skipg u.torp(uot) pjrst au.es3 pjrst au.es1 ac.es1: cain t1,nush.t jrst ac.es2 move t1,nush.t movem t1,n.muot(uot) pjrst au.es2 ac.es2: hlrz c,n.mssn(uot) jumpn c,au.es2 move c,n.rang(t1) caig c,^d256 pjrst au.es2 pjrst au.es3 AU.ES1:: movei c,0 hrlm c,n.mssn(uot) pjrst a.phot AU.ES2:: movei c,0 hrlm c,n.mssn(uot) movei t2,^d400 pjrst a.phas AU.ES3:: movei c,1 hrlm c,n.mssn(uot) pjrst a.mov7 ;***** Ax.EBA, MISSION 3 AI.EBA:: move c,n.pcnt caile c,8 skipg t1,nusb.t retskp movem t1,n.muot(uot) movei c,3 ;EBA mission code. movem c,n.mssn(uot) pjrst au.eba AC.EBA:: move t1,n.muot(uot) move c,n.pcnt caile c,8 skipge u.tab(t1) pjrst askipr movei c,^d1024 camle c,nrsh.t pjrst askipr camg c,nrpl.t camle c,nrpl.n pjrst askipr pjrst au.eba AU.EBA:: move c,n.rang(t1) cail c,^d2048 pjrst a.mov7 skiple u.torp(uot) pjrst a.phot cail c,^d1024 pjrst a.mov7 movei t2,^d400 pjrst a.phas ;***** Ax.CAP, MISSION 4 ; ; capture a planet. AI.CAP:: move t1,nupl.t move t2,nrpl.t camg t2,nrpl.n jrst ai.ca1 move t1,nupl.n move t2,nrpl.n ai.ca1: skipge t1 retskp movei c,4 ;CAP mission code. movem c,n.mssn(uot) movem t1,n.muot(uot) pjrst au.cap AC.CAP:: move c,nrsh.t caig c,^d1024 pjrst askipr hrrz t1,n.muot(uot) move t2,n.rang(t1) pjrst au.cap AU.CAP:: move c,u.tab(t1) trne c,@alya.u pjrst askipr cail t2,^d512 pjrst a.mov7 tlnn c,100 jrst au.ca3 au.ca1: aoj t1, trnn t1,3 jrst au.ca2 skipge u.tab(t1) jrst au.ca1 movei t2,^d500 pjrst a.phas au.ca2: subi t1,4 save uot move uot,t1 setz t1, call tqins rest uot movei t1,^d750 pjrst tqins au.ca3: setzm n.mssn(uot) setom n.muot(uot) move c,u.tab(t1) trz c,7b31 ior c,alya.u movem c,u.tab(t1) movem t1,^d1000 pjrst tqins ;***** Ax.HLP, MISSION 5 AI.HLP:: move t3,u.alrt(uot) and t3,mska.u skipn t3 retskp movei t1,7 movei t2,1b18 ai.hl1: came t1,uot tdnn t3,t2 jrst ai.hl2 skipl u.tab(t1) jrst ai.hl3 ai.hl2: lsh t2,-1 sojge t1,ai.hl1 retskp ai.hl3: movem t1,n.muot(uot) hrlm t2,n.muot(uot) movei c,5 ;HLP mission code movem c,n.mssn(uot) pjrst au.hlp AC.HLP:: hrrz t1,n.muot(uot) came t1,uot skipge u.tab(t1) jrst ac.hl1 hlrz t2,n.muot(uot) tdnn t2,u.alrt(uot) jrst ac.hl1 pjrst au.hlp ac.hl1: andcam t2,u.alrt(uot) pjrst askipr AU.HLP:: move c,n.rang(t1) caile c,^d256 pjrst a.mov7 skiple c,u.shld(t1) jrst au.hl9 movm c,c add c,u.ener(t1) camle c,[^d200K] jrst au.hl9 move c,mask.a hrli c,4 movsm c,eadd.a movem uot,eadd.b setzm eadd.t save t1,t2 call lqins rest t1,t2 move c,u.ener(t1) add c,[^d400K] movem c,u.ener(t1) move c,u.ener(uot) sub c,[^d400K] movem c,u.ener(uot) move c,t2 ior c,uot hrli c,10 movsm c,eadd.a movem t1,eadd.b move c,n.rang(t1) movem c,eadd.t save t2 call lqins rest t2 andcam t2,u.alrt(uot) setzm n.mssn(uot) setom n.muot(uot) movei t1,^d3000 pjrst tqins au.hl9: andcam t2,u.alrt(uot) pjrst askipr ;***** SALLOC ; ; allocates a percent of UOT's total energy to the shields. T1 ; contains the integer percent, eg 50 for 50 percent. SALLOC:: save t2,t3 move c,n.ener move t2,c imul t2,t1 idivi t2,^d100 sub c,t2 movem c,u.ener(uot) caig t2,^d100000 movn t2,t2 movem t2,u.shld(uot) rest t2,t3 ret ;***** AUNXSB AUNXSB:: save t2,t3,t4 move t2,uot andi t2,1 addi t2,sb.mn setz t3, seto t4, tlz t4,1b18 ans.1: came t2,t1 skipge u.tab(t2) jrst ans.2 camg t4,n.rang(t2) jrst ans.2 move t3,t2 move t4,n.rang(t2) ans.2: addi t2,2 caig t2,sb.mx jrst ans.1 skipe t3 move t1,t3 rest t2,t3,t4 ret ;***** AUBASE ; ; returns uot of nearest base in T1, range in T2. if no base exists, ; T1 < 0 and non-skip, otherwise a skip ret. AUBASE:: move t1,nupl.u move t2,nrpl.u camg t2,nrsb.u jrst .+3 move t1,nusb.u move t2,nrsb.u skipl t1 aos (p) ret ;***** AUNXTB AUNXTB:: movei t2,sb.mn move t3,t1 call aunxb jrst [sos t2,t1 movei t3,pl.mx call aunxb ret jrst .+1] move t1,t3 aos (p) ret aunxb: soj t3, camge t3,t2 ret skipl c,u.tab(t3) trnn c,@alya.u jrst aunxb andi c,17 cail c,2 caile c,4 jrst aunxb aos (p) ret ;***** A.REEN A.REEN:: move t2,t1 move t1,uot call reener movei t1,^d1500 pjrst tqins ;***** A.PHOT, A.PHAS A.PHOT:: sos u.torp(uot) movsi c,1b27 hrri c,^d200 movem c,a.fire skipa A.PHAS:: movem t2,a.fire hrrz c,a.fire imul c,c exch c,u.ener(uot) subm c,u.ener(uot) call authit movei t1,^d3000 pjrst tqins ;***** A.MOV7, A.MOV8, A.MOVE A.MOV7:: movei t2,7 pjrst a.move A.MOV8:: movei t2,8 pjrst a.move A.MOVE:: call autxyz move t1,n.rang(t1) call autmot skip movei t1,^d1000 pjrst tqins ;***** AUTMOT ; ; moves UOT toward or away from coor A.ABSn at warp factor T2. ; T2 > 0 moves toward, T2 < 0 moves away. adjusts T2 down if ; insufficient energy for move, after 50/50 reallocation. skip ; return if move okay. non-skip return if ship needs energy. ; T1 must contain range from UOT to coordinates. AUTMOT:: save t1,t2 movm t3,t2 move c,u.ener(uot) am.1: caml c,wf.ene(t3) jrst am.2 sojge t3,am.1 rest t1,t2 ret am.2: rest t1,t2 move c,wf.ene(t3) exch c,u.ener(uot) subm c,u.ener(uot) move c,wf.dis(t3) skipge t2 movn c,c move t2,c call autmov aos (p) ret ;***** AUTXYZ ; ; moves abs coordinates of object T1 to A.ABSn. AUTXYZ:: move c,u.absx(t1) movem c,a.absx move c,u.absy(t1) movem c,a.absy move c,u.absz(t1) movem c,a.absz ret ;***** AUTDIS (not referenced 1/8/81) ; ; computes T1 = range between UOT and coordinates A.ABSn. AUTDIS:: move c,u.absx(uot) fsbr c,a.absx fmpr c,c movem c,f.data move c,u.absy(uot) fsbr c,a.absy fmpr c,c fadrm c,f.data move c,u.absz(uot) fsbr c,a.absz fmpr c,c fadrm c,f.data movei c,f.loc call sqrt.## fixr t1,rs ret ;***** AUTMOV ; ; move object UOT toward (or away from) coordinates A.ABSX, A.ABSY, ; A.ABSZ at warp T2. T2 > 0 moves toward, T2 < 0 moves away. T1 ; must contain range from UOT to coordinates. AUTMOV:: skipg t1 ret save p1,p2,p3 fltr t3,t2 fltr c,t1 fdvr t3,c move t4,[1.0] fsbr t4,t3 fmprm t3,a.absx move p1,u.absx(uot) fmpr p1,t4 fadr p1,a.absx fmprm t3,a.absy move p2,u.absy(uot) fmpr p2,t4 fadr p2,a.absy fmprm t3,a.absz move p3,u.absz(uot) fmpr p3,t4 fadr p3,a.absz movem p1,u.absx(uot) movem p2,u.absy(uot) movem p3,u.absz(uot) rest p1,p2,p3 hrlz c,mask.a hrri c,1 movem c,eadd.a movem uot,eadd.b setzm eadd.t pjrst lqins ;***** ASKIPR ASKIPR:: setzm n.mssn(uot) setom n.muot(uot) RSKP:: aos (p) R:: ret ;***** SETUP SETUP:: setom u.side call intlok call gamchk setz t1, movei suot,sh.mx set.a: move c,u.tab(suot) tlne c,3b19 aoj t1, sojge suot,set.a cail t1,sh.ct jrst [typec <All ships in play, try again later> setzm i.lock gexit] type <> skipe gam.nr jrst [type outchr gam.nr crlf jrst .+2] typec call su.pla call su.ava crlf crlf type jrst set.g set.e: type <_> type <> ife tops20, ifn tops20,< movei t1,.priin cfibf > set.g: inchrw t1 caig t1," " jrst set.e+1 outchr t1 trz t1,1b30 movem t1,c.char movei suot,7 set.h: move t2,[point 7,o.init(suot)] ildb t2,t2 camn t2,c.char jrst set.n sojge suot,set.h jrst set.e set.n: move t2,u.tab(suot) tlne t2,3b19 jrst set.e skipl u.side jrst [hrrz c,suot andi c,1 came c,u.side jrst set.e jrst .+1] tlo t2,1b19 movem t2,u.tab(suot) getime c setzm time.q(suot) movem suot,s.uot call usrlod movei t2,2000 lsh t2,@suot movem t2,mask.c andcam t2,mask.o tso t2,mask.q movsm t2,mask.q move t2,mask.f move c,suot andi c,1 movem t2,mask.u(c) move t2,ally.f movem t2,ally.u(c) set.x: setzm i.lock ;release the interlock (set in the ret ; intlok routine) and ret. GAMCHK:: ife tops20, ifn tops20,< time move t2,t1 > movei uot,sh.mx+1 gchk.1: sojl uot,[setzm u.tty move c,[xwd u.tty,u.tty+1] blt c,u.tty+sh.mx pjrst select] skipl c,u.tab(uot) tlnn c,1b19 jrst gchk.1 move c,u.time(uot) sub c,t2 skipg c movn c,c camle c,[^d300000] jrst gchk.1 ife tops20, ifn tops20,< save t2 gjinf move c,t4 rest t2 > movei uot,sh.mx+1 gchk.2: sojl uot,r came c,u.tty(uot) jrst gchk.2 move c,uot andi c,1 movem c,u.side gchk.3: skipl u.tab(c) jrst gchk.4 addi c,2 caig c,sh.mx jrst gchk.3 movei t1,[asciz /Federation/] trne c,1 movei t1,[asciz /Klingon Empire/] type <The > outstr (t1) type < has been defeated!> setzm i.lock gexit gchk.4: move t1,u.wait(uot) ;get the wait time. sub t1,t2 ;subtract the current time. idivi t1,^d1000 ;convert to seconds. jumple t1,[setzm u.tty(uot) ;if not > 0, reset the tty nr ret] ; and ret. type <Re-entry in > ;must wait - type the wait message. idivi t1,^d60 ;display the time in mins and secs. push p,t2 ;routine displays minutes if minutes skipe t1 ; are > 0, otherwise only displays jrst [push p,t1 ; seconds. call timout type < minute> movei c,[asciz /s, /] pop p,t1 cain t1,1 movei c,[asciz /, /] outstr (c) jrst .+1] move t1,0(p) call timout type < second> pop p,t1 caie t1,1 type crlf setzm i.lock ife tops20, ;exit from the game. ifn tops20, inchrw c cain c,"Z" ret gexit timout: idivi t1,^d10 ;displays a number without leading save t2 ; zeroes. skipe t1 call timout rest t2 addi t2,"0" outchr t2 ret ;***** INTLOK ; ; prevents two players from starting up at the same time. if i.lock < 0 ; hibers for a second and tries again. when other player is finished ; i.lock will be = 0. this routine then sets i.lock < 0 to exclude ; other players and returns. INTLOK:: ife tops20, ifn tops20,