jac@yoko.rutgers.edu (Jonathan A. Chandross) (06/01/91)
Submitted-by: Phil Goetz (goetz@cs.buffalo.EDU) Posting-number: Volume 1, Source:53 Archive-name: util/parser/inmate/part03 Architecture: ANY_2 Version-number: 1.00 Warning: Change the line: .4 .AS -/^DBLOADINCARD/ IMBEDDED CTRL-D In the file "start" Such that the "^D" is replaced with an actual control-D. News won't post things with ^D's in them. Sorry about this; didn't discover it until I tried to post this portion. =io -* -SAVEIO9,S6,D2 -TIND .EQ $62,63 -IOBUF .EQ $B700 -WT .US /@WHICH?=/ -GN .US /@CALL IT:=/ -RGS LDA #1 - STA CMND - JSR FB2F - JSR FC58 - LDA #0 GAME @ - JMP RG READ GAME -HLOA LDA #1 READ - .HS 2C -HSAV LDA #2 WRITE - PHA - LDA #157 INSERT DISK - JSR PMSG - JSR WKEY WAIT FOR KEY - JSR FB2F - JSR FC58 -* READ DIR FROM T11 S1 - LDY #0 - STY BUF - STY TIND - INY - STY CMND - STY SECT - LDY /IOBUF - STY BUF+1 - STY TIND+1 - LDA #$11 - STA TRACK - JSR RWTS - BCC .1 - PLA - RTS -* DIR FORMAT, FOR EACH TRACK: -* (TIND),0-15:NAME -* GAME# A-L (1-12) -* EACH TAKES 1 TRACK -.1 LDA #1 - STA $50 GAME# -.2 PHA - ASL - ASL - ASL - ASL - STA TIND TIND=16*GAME# - PLA LDA $50 - CLC - ADC #"A-1 - JSR FDF0 PRINT A-L - LDA #". - JSR FDF0 - INC $24 - LDY #0 -.4 LDA (TIND),Y - BEQ .5 EONAME - JSR FDF0 - INY - CPY #16 - BCC .4 -.5 JSR FD8E - INC $50 - LDA $50 - CMP #13 M - BNE .2 - LDY /WT - LDA #WT - JSR PS -* FIND WHICH GAME -.6 JSR WKEY - STA $6AF PRINT TO SCREEN - CMP #"M - BCS .7 TOO LARGE -* @->0 L->$C - SBC #"@-1 (C=0) @=GAME LOADED TO RESTART -* .DO PROD -* BEQ .7 @ -* .FIN - BCS .8 JUST RIGHT -.7 JSR FBDD BELL - JMP .6 -.8 STA $50 - LDA $C010 - PLA - STA CMND - LSR - BCS .20 READ - LDA $50 TRACK - ASL - ASL - ASL - ASL GAME#(1-12)*16 - STA TIND - LDY /GN - LDA #GN - JSR PS CALL IT? - JSR INPUT BIT PRSQT MAY CAUSE BUGS - LDY #15 -.9 LDA $200,Y - STA (TIND),Y COPY NAME INTO DIR - DEY - BPL .9 - INC SECT DECd BY B793 - INC BUF+1 DECd BY B793 - JSR RWTS WRITE DIR - BCS CLS -.20 LDA $50 -RG CLC - ADC #$12 - STA TRACK - LDA #$F - STA SECT - LDA #AD - STA BUF - LDA /AD+$F00 - STA BUF+1 - LDA #$10 16 SECTORS - JSR RWG -CLS JMP FC58 -RWTS LDA #1 -RWG STA COUNT - LDA #0 - STA ERR -.1 LDA /IOB - LDY #IOB - PHP - SEI - JSR $BD00 - BCS .5 - PLP - CLC - .HS AC LDY $XXXX -.5 PLP - SEC - LDY SECT - DEY - BPL .7 - LDY #$F - DEC TRACK -.7 STY SECT - DEC BUF+1 - DEC COUNT - BNE .1 - BCC WRTS -.10 LDA #158 DISK ERROR - JSR PMSG - SEC -* WAIT FOR KEYPRESS -WKEY LDA $C010 -.1 LDA $C000 - BPL .1 WAIT FOR KEYPRESS -WRTS RTS -*-------------------------------- -COUNT .BS 1 -IOB .HS 01 -SLOT .HS 60 -DRIVE .HS 01 -VOL .HS 00 -TRACK .HS 00 -SECT .HS 00 - .DA DCT -BUF .BS 4 -CMND .HS 00 -ERR .HS 00006001 -DCT .HS 0001EFD8 =lex -* -SAVELEX35.1,S6,D1 -*-------------------------------- -* LEXICAL ANALYSIS -*-------------------------------- -EOL .EQ $FF SIGNALS END OF LETTER ENTRY -VP .EQ 1 VERB REQUIRING PLACE: JUMP -VI .EQ 2 VERB INTRANSITIVE -VT .EQ 3 VERB TRANSITIVE -PRT .EQ 4 VERB PART -PM .EQ 5 PREP OF MOTION -PN .EQ 6 PREP W/O MOTION -PLACE .EQ 7 OUTSIDE,NORTH -NUM .EQ 8 -ADJ .EQ 9 -POS .EQ 10 POSSESSIVE -PROPER .EQ 11 -PRN .EQ 12 SINGULAR PRONOUN -CN .EQ 13 COMMON NOUN -CNP .EQ 14 CREATED FROM CNs WITH S ON END -SYN1 .EQ 15 SYNONYM OF WORD# <256 -SYN2 .EQ 16 SYN TO WORD#s >255 -SYN3 .EQ 17 -CONJ .EQ 18 -EXC .EQ 19 EXCLUSIONARY: BUT,EXCEPT (FOR) -NEG .EQ 20 NEGATION: NOT -RP .EQ 21 RELATIVE PRONOUN: THAT,WHICH -PT .EQ 22 PREP OF TIME -PI .EQ 23 PREP OF INSTR: WITH,USING -TIME .EQ 24 DUSK,DAWN -TB .EQ 25 TIME BASIC: EARLY -CL .EQ 26 TRANSFORMED AWAY -VA .EQ 27 ACTION VERB -VO .EQ 28 OPINION -NS .EQ 29 SPOKEN NOUN -QW .EQ 30 WHY,WHERE,WHO,WHAT,HOW -QUES .EQ 31 -* GENERIC PARTS (IE ANY VERB) DONE IN CONVERSATION -* USING SETS (IE SET OF VERB TYPES) -TALK .EQ 32 USED ONLY AS CONVERSATION KEYWORD -CONT .EQ 33 CONTRACTION -UNKW .EQ 34 UNKNOWN -TRNS .EQ 35 DROPPED DURING TRANSFORMATION: TOP,OF -VZ .EQ 36 FAKE VERB FOR "GIVE/THROW DEST OBJ" TRANSFORM -*BE IS,ARE,ISN'T,ARN'T: TRANSFORMED -*-------------------------------- -QBEG .BS 1 CHAR# OF 1ST " -* THE FOLLOWING LINE IS NOT THE ENTRY POINT -* Y CONTAINS #CHARS-1 IN MATCHED WORD -* X POINTS TO CHAR BEYOND MATCH -MATCHD DEX DON'T MISS SPACE AT END OF WORD IN NEXTWORD - STX CURWORD SO "GET UP", ETC., CAN BE 1 WORD - TAX SET ZFLAG - BEQ M3 TYPE=0 MEANS SKIP/DELETE WORD - PHA - LDX WORDS - LDA WNUM - STA OLO,X ORIG. WORD# - LDA WNUM+1 - STA OHI,X - PLA - LDX #0 HIBYTE FOR GETWRD - CMP #SYN1 - BEQ .0 - INX - CMP #SYN2 - BEQ .0 - CMP #SYN3 - BNE .1 - INX -.0 JSR INY - LDA (MISC),Y SYN WORD - JSR GETWRD -.1 LDX WORDS - STA WTYPE,X - JSR GETNVNUM - JSR INY - LDA (MISC),Y - BMI .5 NO 2ND TYPE - STA WTYPE2,X - JSR GETNVNUM - JSR INY - LDA (MISC),Y - BMI .5 NO 3RD TYPE - STA WTYPE3,X - JSR GETNVNUM -.5 LDA WNUM - STA WLO,X - LDA WNUM+1 -M1 STA WHI,X JMPed TO BY GETNUM -M2 INC WORDS -M3 LDX CURWORD - JMP NEXTWORD -PARSE LDY #30*5+1 FOR LWORDS -.1 LDA WLO-1,Y SAVE LAST WLO,WHI,WVRB,WNOUN,&WTFIN - STA LWLO-1,Y FOR ELLIPSIS - LDA #0 - STA WLO-1,Y ERASE LEFTOVERS - DEY - BNE .1 - LDY #90 -.2 STA WTYPE-1,Y - DEY CAN'T DO IT ADURING MATCHD SINCE UNK DON'T MATCH - BNE .2 - STY ASTRIED ASSUME HASN'T BEEN TRIED YET -ELOP NOP CHANGED TO DEY FOR NOEL - STY ELTRIED NEITHER HAS ELLIPSIS -P2 JSR INPUT - LDA INSTRING - BNE .4 -* BLANK LINE -.3 LDA DQ - BEQ P2 NOT IN QUOTE - RTS NO CHAR RESPONSE -.4 JSR CLBUF CLEAN OUT INVALID CHARS - JSR FD8E - LDX #0 - STX WORDS -.5 LDA INSTRING,X - BEQ .3 - CMP #$A0 - BNE P1 - INX - BNE .5 - BEQ .3 -P0 LDA INSTRING,X - BNE .1 - JMP LEXEND COULD BEQ (BEQ LEXEND), BUT LOCAL LABELS INTERFERE -.1 CMP #$A0 - BNE P1 - INX - BNE P0 FLUSH LEADING BLANKS -P1 STX CURWORD - CMP #"" - BNE .5 - STX QBEG -.7 INX - LDA INSTRING,X - BEQ .6 - CMP #"" - BNE .7 -.6 LDA #QM - STA MISC - LDA /QM - STA MISC+1 - LDA #QNUM - STA WNUM - LDA /QNUM - STA WNUM+1 - LDA #CN - INX DEX AT MATCHD - LDY #0 - BEQ .13 MATCHD -.5 CMP #": "9"+1 - BCS .54 - JMP GETNUM -.54 SBC #"A - CMP #"Z-"A+1 - BCC .4 -.14 JMP DUNNO -.4 ASL - TAY - LDA TABFL,Y - STA MISC - LDA TABFL+1,Y - STA MISC+1 - DEC MISC+1 - LDA NUMTAB,Y WORD# - STA WNUM - LDA NUMTAB+1,Y - STA WNUM+1 - LDY #$FF -.1 INX - BEQ LEXEND FINISHED WITH STRING - JSR INY - LDA (MISC),Y - BMI .15 -.13 JMP MATCHD TYPE SIGNALS END OF LETTER -.15 CMP #EOL END OF LETTER - BEQ .14 BEQ DUNNO - CMP INSTRING,X - BEQ .1 MATCH, GO ON FOR NEXT CHAR -.2 JSR INY - LDA (MISC),Y SEARCH FOR END OF STRING - BMI .2 -.23 BEQ .25 IGNORE - CMP #SYN3+1 - BCS .25 - JSR INY PARTS <= SYN HAVE 1 PARAM -.25 JSR INY SEARCH FOR NEXT STRING - LDA (MISC),Y - BPL .23 - CMP #EOL - BEQ DUNNO NO MORE STRINGS FOR THAT LETTER - INC WNUM - BNE .3 - INC WNUM+1 -.3 LDX CURWORD START THIS WORD OVER - DEY - BNE .1 - DEC MISC+1 - BNE .1 -LEXEND JMP TRANSFORM -* CLEAN BUFFER OF INVALID CHARS -CLBUF LDX #0 -.1 LDA INSTRING,X - BEQ .4 EOS - CMP #"? - BNE .15 - LDA #$88 - STA QMARK - BNE .2 ERASE ? BUT MARK QMARK -.15 CMP #"A - BCS .3 LETTER - CMP #"9+1 - BCS .2 INVALID - CMP #"0 - BCS .3 NUMBER - CMP #"" - BEQ .3 - CMP #"' - BEQ .3 - CMP #$A1 - BCC .3 SPACE OR CONTROL CHAR OR 0 -.2 LDA #$A0 - STA INSTRING,X REPLACE INVALID WI SPACE -.3 INX - BNE .1 -.4 RTS -*-------------------------------- -NEXTWORD LDA INSTRING,X - BEQ LEXEND 0 FLAGS END OF INPUT - INX - BEQ LEXEND - CMP #$A0 SPACE - BNE NEXTWORD - JMP P0 -*-------------------------------- -DUNNO LDA ACUNK - BEQ .5 DON'T ACCEPT UNK - LDX WORDS - LDA #UNKW - STA WTYPE,X - LDA #0 - STA OLO,X DON'T CHANGE UNKNOWN WORD TO YOU/ME,AM/ARE, ETC. - STA OHI,X - JMP M2 -.5 LDY /.9 - LDA #.9 - JSR PS - JMP PARSE -.6 STY $24 - LDX CURWORD -.7 LDA INSTRING,X - CMP #$A0 - BEQ .8 - JSR FDF0 - INX - BNE .7 -.8 LDY $24 - RTS -.9 .US /I DON'T KNOW THE WORD "+/ - .DA .6 - .US /".@=/ -*-------------------------------- -GETNUM CMP #"1 - BCC DUNNO - LDA #0 - STA $44 - STA $45 - JSR .2 - LDA $44 NUM - LDX WORDS - STA WNOUN,X - LDA #NUM - STA WTYPE,X - LDA #0 - STA WTYPE2,X - STA WTYPE3,X - LDA #$FF AVOID CONFUSION - JMP M1 NEXTWORD -* DOS DECIMAL INPUT & TRANSLATE -* ON ENTRY TO .2:X=INPUT POINTER -.1 LDX .9 -.2 LDA INSTRING,X - CMP #$8D - BEQ .8 - CMP #$A0 - BEQ .8 - INX - STX .9 -.5 SEC - SBC #$B0 #"1 -> #1 - BMI .6 <0 - CMP #$A - BCS .7 >9 - ASL $44 - ROL $45 - ADC $44 - TAX - LDA #0 - ADC $45 - TAY - ASL $44 - ROL $45 - ASL $44 - ROL $45 - TXA - ADC $44 - STA $44 - TYA - ADC $45 - STA $45 - BCC .1 -.6 SEC -.7 RTS -.8 LDX $44 - LDA $45 - CLC - RTS -.9 .BS 1 TEMP X -*-------------------------------- -GETNVNUM CMP #PRT+1 VERB OR PART? - BCS .1 - JSR INY - LDA (MISC),Y - STA WVERB,X -.0 RTS -.1 CMP #SYN1 NOUN,ADJ,PM,PN,POS,PLACE? - BCS .0 - JSR INY - LDA (MISC),Y - STA WNOUN,X - STX TEMP - LDX CURWORD -.2 LDA INSTRING,X - BEQ .3 - INX - BEQ .3 - CMP #$A0 - BNE .2 - DEX - LDA INSTRING,X - CMP #"S LAST LETTER OF WORD - BNE .3 - LDX TEMP - LDA WTYPE,X - CMP #CN - BNE .25 - LDA #CNP PLURAL - STA WTYPE,X - RTS -.25 LDA WTYPE2,X - CMP #CN - BNE .3 CN MUST BE 1 OF 1ST 2 TYPES - LDA #CNP - STA WTYPE2,X -.3 LDX TEMP - RTS -*-------------------------------- -INY INY - BNE .1 - INC MISC+1 -.1 RTS -*-------------------------------- -* FIND LOCATION OF WORD# X,A -* INFINITE LOOP MAY RESULT IF W#=0 -GETWRD STA WNUM - STX WNUM+1 - LDY #26*2 # OF LETTERS *2 -.1 DEY - DEY - CLC SUB 1 MORE TO TST FOR =<, NOT < - LDA NUMTAB,Y LOBYTE - SBC WNUM LOBYTE TO FIND - EOR #$FF A<=(SEC:LDA WNUM:SBC NUMTAB,Y) DOESN'T CHANGE C - TAX - LDA NUMTAB+1,Y HIBYTE - SBC WNUM+1 - BCS .1 - LDA TABFL,Y - STA MISC - LDA TABFL+1,Y - STA MISC+1 - LDY #0 - TXA DIF TWIXT 1ST WORD# AND WORD# DESIRED - BEQ .3 -.2 JSR INY - LDA (MISC),Y SEARCH FOR END OF STRING - BMI .2 -.23 BEQ .25 IGNORE - CMP #SYN3+1 - BCS .25 - JSR INY PARTS <= SYN HAVE 1 PARAM -.25 JSR INY SEARCH FOR NEXT STRING - LDA (MISC),Y - BPL .23 - DEX - BNE .2 -.3 JSR INY SKIPS 1ST LETTER OF MATCH, BUT THAT'S OK - LDA (MISC),Y - BMI .3 -GETEND RTS =macros -* LISTS - .MA CRV LIST - LDA ]1 - JSR CRVAR - .EM - .MA CRL LIST,LEN CREATE LIST - >CRV ]1 - LDA ]2 LENGTH - JSR CRL - .EM - .MA FIN LIST,ELEMENT - LDA ]1 - LDX ]2 - JSR FINEL - .EM - .MA NXT LIST - LDA ]1 - JSR LLL - DEY Y<=#$FE - LDA (TEMP),Y PTR - TAY - LDA (TEMP),Y NEXT EL - PHA - INY INC PTR - TYA - LDY $#FE PTR - STA (TEMP),Y - PLA - .EM -* STACKS: PNTR POINTS TO NEXT FREE BYTE - .MA PHA STACK,PNTR - LDY ]2 - INC ]2 - STA ]1,Y - .EM - .MA PHB DATA,STACK,POINTER - LDA ]1 - >PHA ]2,]3 - .EM - .MA PLA STACK,PNT - DEC ]2 - LDY ]2 - LDA ]1,Y - .EM -* PUSH WORD: POINTER POINTS TO LOW BYTE, PUSHED BEFORE HIGH BYTE - .MA PSHW DATA,STACK,POINTER,MAX - LDY ]3 - .DO ]#=4 - CPY ]4 - BCC :1 - RTS - .FIN -:1 LDA ]1 - STA ]2,Y - LDA ]1+1 - STA ]2+1,Y - INY - INY - STY ]3 - .EM - .MA PLLW DEST,STACK,POINTER - LDY ]3 - DEY - DEY - LDA ]2,Y - STA ]1 - LDA ]2+1,Y - STA ]1+1 - STY ]3 - .EM =monitor2 -* -SAVE MONITOR2 -* MONITOR ROUTINES -BASIC STA $C082 - JMP $E000 -RESET STA $C082 - JMP $FA62 -FB2F STA $C081 - JSR $FB2F -WRAM PHA - LDA $C083 - LDA $C083 - PLA - RTS -FBB3 STA $C081 - LDA $FBB3 - JMP WRAM -FBDD STA $C081 - JSR $FBDD - JMP WRAM -FC1A STA $C081 - JSR $FC1A - JMP WRAM -FC22 STA $C081 - JSR $FC22 - JMP WRAM -FC58 STA $C081 - JSR $FC58 - JMP WRAM -FC9E STA $C081 - JSR $FC9E - JMP WRAM -FD8E STA $C081 - JSR $FD8E - JMP WRAM -FDDA STA $C081 - JSR $FDDA - JMP WRAM -FDF0 STA $C081 - JSR $FDED - JMP WRAM -FE2C STA $C081 - JSR $FE2C - JMP WRAM -NODOS STA $C081 - JSR $FE89 - JSR $FE93 - JMP WRAM -FF3F STA $C081 - JSR $FF3F - JMP WRAM -FF4A STA $C081 - JSR $FF4A - JMP WRAM =print22 -* -SAVEPRINT22 -* RESERVED FOR PRINT: -* $10 OBJ TO PRINT -* $11 TEMP STORAGE -* $1A,1B POINTER TO STRING -*-------------------------------- -* PRINT FROM TABLES -* A=MESSAGE# -* MTYP: RPL:0,2,4,6,8,10 ADJ:12 OBJ:14 LOC:16 MSG:18 MTN:20,22,24,26,28,30 -MTYP .BS 1 -* $A,B RESERVED FOR THIS ONLY -PINY INY - BNE .1 - INC $B -.1 RTS -ROTC .BS 1 RESERVE OFFICER TRAINING CORPS -ROT STY $B - DEC $B - STA ROTC - LDY #$FF -.1 DEC ROTC - BMI .3 - JSR PINY - JSR PINY DON'T NEED TO CHECK POINTER - JSR PINY OR 1ST 2 MSGS -.2 JSR PINY - LDA ($A),Y - CMP #$FF - BNE .2 - BEQ .1 -.3 JSR PINY - STY ROTC - LDA ($A),Y PNTR -.4 CLC - ADC #1 INC PNTR - STA ($A),Y - ADC ROTC A=Y+NEW POINTER - TAY - LDA ($A),Y MSG# TO PRINT - CMP #$FF GONE PAST END OF MSG LIST? - BNE .6 NO - LDY ROTC POINT TO PNTR - LDA #0 & START OVER WI 1ST MSG# - BEQ .4 -* GO BACK IN CASE STRTAB INCLUDES A STRTAB -.6 PHA - CPX #11 - BCC PRPL2 - PLA - CPX #18 - BEQ APMSG - CPX #20 - BCS PMTN - BCC PML -PMSG LDY ACLOC - CPY LOC - BEQ APMSG PMSG IF ACTOR & PLAYER IN SAME ROOM -PMRTS RTS -APMSG LDX #18 - CMP #RMSG MASTER MESSAGE WHICH ROTATES THRU STRINGS? - BCC PML NO - SBC #RMSG - LDY #RMSGS - STY $A - LDY /RMSGS -BNEROT BNE ROT -PRPL PHA - LDA #"" - JSR FDF0 -PRPL2 LDA CHRNUM - TAY - ASL A=A*2 - TAX - PLA - CMP .5,Y - BCC PML - SBC .5,Y - LDY .7,X - STY $A - LDY .7+1,X - BNE BNEROT ALWAYS -.5 .DA #EDRPL,#LIBRPL,#MRKRPL,#MRSRPL,#INTRPL,#PRORPL -.7 .DA EDRPLS,LIBRPLS,MRKRPLS,MRSRPLS,INTRPLS,PRORPLS -PMTN PHA - LDA CHRNUM - ASL - ADC #20 C=0 - TAX - PLA - CMP #RMTN - BCC PML - SBC #RMTN - LDY #RMTNS - STY $A - LDY /RMTNS - BNE BNEROT -PLOC LDX #16 -PML JSR POBJ+2 - LDA MTYP - CMP #20 - BCS PMRTS MTN: RTS - CMP #12 ADJ - BCS .1 NOT RPL - LDA #"" - JSR FDF0 -.1 JMP FD8E -PADJ LDX #12 - .HS 2C -POBJ LDX #14 - TAY 0? - BNE .0 - CPX #12 RPL? - BCS .0 NO -* PACK IS DESIGNED SO EACH SUCCESSIVE TABLE OF STRINGS -* IS STORED SEQUENTIALLY AFTER THE LAST. -* BUT THE SWAPPING TO DISK OF REPLIES MEANS THEY'RE NOT. -* SO REPLY #0 IN EACH TABLE HAS THE ADDRESS OF THE LAST REPLY -* OF THE LAST TABLE (I THINK). -* BUT EVERY REPLY #0 ACTUALLY STARTS AT TABTAB+$30 - LDA #FINAL - LDY /FINAL - BNE .3 -.0 LDY #0 - ASL A=A*2 - BCC .1 - INY BIT 7 =>BIT 8 -.1 STA EDGE - STY EDGE+1 - SEC - LDA TABTAB,X - SBC EDGE - STA EDGE - LDA TABTAB+1,X - SBC EDGE+1 - STA EDGE+1 - LDY #0 - LDA (EDGE),Y - PHA - INY - LDA (EDGE),Y - TAY - PLA -.3 STX MTYP - CPX #12 ADJ - BCC PS - CPX #16 LOC - BCC PRINT ADJ, OBJ DON'T START WI CAPITAL -*-------------------------------- -* PRINT STRING POINTED TO BY Y,A AND TERMINATED BY 00 -* BUG:IF CHARS PRINTED BY +,/, OR $ WRAP AROUND, BACKUP WILL BE WRONG -*-------------------------------- -PS LDX #2 - STX SHIFT START SENT WI CAPITAL -PRINT STA $1A - STY $1B - STA SSTART SAVE SO WE KNOW DURING WRAPAROUND TRACKBACK - STY SSTART+1 WHEN WE'VE COME TO THE BEGINNING OF THE STRING - LDA WTOP - STA LINCNT -* SOME ROUTINES, IE PRCONT, PRINT A LOT OF STRINGS -* NONE OF WHICH SHOULD START IN COLUMN 0. THEY SET C1=1. - LDY $24 - BNE P4 - LDY C1 0 OR 1 -P4 LDA #0 MARK STACK - PHA SO COUT WILL RETURN TO CALLER OF PRINT - PHA WHEN IT FINDS A = -P6 LDX #1 FOR LOWERCASE - LDA ($19,X) GET NEXT CHAR - CMP #"@ CR - BNE .6 - JMP PCR -.6 CMP #$A0 - BCC .60 DIGRAM - CMP #"Z+1 - BCS .57 WORD -.11 CMP #"+ JSR - BEQ .65 - CMP #"/ NUMBER - BNE .13 -.61 JSR PRDEC - JMP P54 -.13 CMP #"$ STRING - BNE .20 - JMP PSTR -.20 CMP #"* LOWERCASE - BNE .21 - STX SHIFT - JMP P54 -.21 CMP #"< A/AN/_ - BNE .22 - JSR PA - JMP P54 -.22 CMP #"> THE/_ - BNE .23 - JSR PTHE - JMP P54 -.23 JMP .14 -* DIGRAM -.60 STA $FF - TAX - LDA #0 SHOWS WRAPAROUND IF 1ST OR 2ND LETTER PRINTED - STA $19 0=1ST LETTER - LDA DIG1,X - JSR COUT - LDA $FF - TAX - INC $19 1=2ND LETTER - LDA DIG2,X -.14 JSR COUT - JMP P54 -* WORD -.57 TAX - LDA WRDTAB-"Z-1,X - TAX -.58 LDA WRDTXT,X - STX $19 ALSO NEED FOR WRAPAROUND - BMI .14 - CMP #$20 LEADING SPACE - BNE .59 - CPY #1 - BNE .59 - LDX LINCNT - CPX WTOP - BNE .55 NOT 1ST LINE; DON'T PRINT SPACE IN COLUMN 1 -.59 ORA #$80 - JSR COUT -.55 LDX $19 - INX - BNE .58 ALWAYS, AS LONG AS WORDS<257 BYTES -* JSR -.65 LDX #0 - JSR PINC - LDA ($1A,X) - STA .67+1 - JSR PINC - LDA ($1A,X) - STA .67+2 -.67 JSR 0 - JMP P54 -PCR JSR RETBLN - DEY 0 -P54 JSR PINC - JMP P6 -* PRINT ANOTHER STRING INSIDE THIS ONE -PSTR JSR PINC - LDX #0 - LDA ($1A,X) - PHA - JSR PINC - LDA ($1A,X) - PHA - JSR PSS - PLA - STA $1B - PLA - STA $1A - JSR P4 - JSR PLS - JMP P54 -PINC INC $1A - BNE .75 - INC $1B -.75 RTS -COUT CMP #"= EOL - BNE .5 -.2 PLA DON'T NEED TO RESTORE SAVED STACK POINTER - BNE .2 - PLA BECAUSE = IS NEVER 1ST LETTER IN DIGRAM - BNE .2 KEEP PULLING UNTIL 00 00 MARK COMES UP - CPY #$28 DON'T LET FDF0 PRINT OFFSCREEN - BCC .3 - JSR RETBLN -.3 STY $24 - LDA #1 - STA SHIFT - RTS -.5 LDX #2 - CMP #"% SETSHIFT - BNE .8 - STX SHIFT - RTS -.8 CMP #". - BEQ .9 - CMP #"! - BEQ .9 - CMP #"? - BNE .11 -.9 STX SHIFT -.11 CMP #"A - BCC .12 - DEC SHIFT - BPL .10 DON'T LOOP THRU ALL VALUES - INC SHIFT -.10 LDX LWC - BEQ .12 - LDX SHIFT - BNE .12 - ADC #$1F =>LOWERCASE -.12 CPY LSTCOL EOL = $27 - BCS .80 - STA ($28),Y - INY - RTS -.80 CMP #$A0 - BNE .81 - JMP RETBLN -.81 JSR .73 SHIFTED? - JMP .87 -.85 LDX #$FF - STX $19 SHOW WE'RE NOT IN THE MIDDLE OF ANYTHING - DEY -.87 LDX #0 - LDA ($1A,X) BYTE PRINTED - CMP #"Z+1 - BCC .30 -* WORD - TAX - SEC - LDA #$FE $FF=ENTIRE WORD WAS PRINTED - CMP $19 INDEX SAVED BY WORD PRINTER - LDA $19 - BCS .15 - LDA WRDTAB-"Z,X -* C=0 SO SBCs 1 MORE -.15 SBC WRDTAB-"Z-1,X DEY (SAVED-START) TIMES - TAX - BEQ .50 NO CHARS PRINTED -.20 DEX - BMI .25 WON'T LDA FROM OFFSCREEN 'CAUSE WON'T BMI 1ST TIME - DEY - STX $19 - JSR .70 CHECK FOR CAP - LDX $19 - JMP .20 -.25 JSR .70 ONLY 1ST LETTER IN WORD CAN BE SPACE - BNE .50 - JMP .95 -.30 CMP #$A0 - BCS .48 CHAR -* DIGRAM: ONLY 1ST LETTER CAN BE SPACE & ONLY IF DIGRAM<22 - LDX $19 - BEQ .45 1ST CHAR OF UNPRINTED DIGRAM - DEX - BEQ .46 2ND CHAR NOT PRINTED - PHA - JSR .70 CHECK CAP - PLA -.46 DEY 2 CHARS/BYTE -.45 CMP #22 - BCS .47 - INY - JSR BLANK - JSR RETBLN - DEY Y=0 SINCE 1ST CHAR OF DIGRAM IS BLANK - JMP P97 -.47 JSR .70 CHECK CAP - JMP .50 -.48 CPY LSTCOL - BCS .50 - JSR .70 - BEQ .90 -.50 LDA $1A - CMP SSTART - BNE .51 - LDA $1B - CMP SSTART+1 - BEQ .95 START OF STRING -.51 TAX - BNE .55 - DEC $1B -.55 DEC $1A MOVE BACK TO LAST CHARACTER - JMP .85 -* CHECK FOR SPACE OR COMMA -.70 LDA ($28),Y READ FROM SCREEN -.73 CMP #$A0 - BEQ .77 - CMP #", - BEQ .77 - LDX #0 DEFAULT:THIS LETTER NOT CAPITAL - CMP #"Z+1 - BCS .76 - CMP #"A - BCC .76 - LDX #2 -.76 STX SHIFT 1ST LETTER AFTER SPACE WAS CAPITAL - LDX #2 IN CASE A=Z+1 -.77 RTS NOTE ENDLESS LOOP IF NO SPACES OR COMMAS -.90 INY -.95 JSR BLANK - JSR RETBLN -P97 PLA - BNE P97 - PLA - BNE P97 - JMP P4 -RETBLN JSR FD8E - INC LINCNT - LDA LINCNT - CMP #23 TO BOTTOM OF SCREEN? - BNE .2 - JSR MORE - LDA WTOP - STA LINCNT -.2 LDA #$A0 - LDY #0 - STA ($28),Y ERASE SPACE IN COLUMN 0 - INY - RTS -MORE LDX #5 - LDY #17 - STY $24 -.1 TXA - PHA - LDA M4,X - JSR COUT - PLA - TAX - DEX - BPL .1 - STA $C010 -.4 BIT $C000 - BPL .4 WAIT FOR KEYPRESS - STA $C010 - LDY #0 - STY $24 -BLANK LDA #$A0 - BNE .2 ALWAYS -.1 STA ($28),Y FILL TO EOL WI BLANKS - INY -.2 CPY #$28 - BCC .1 - RTS -M4 .HS 2905120F0D28 -C1 .BS 1 -SSTART .BS 2 -SHIFT .BS 1 2=CAP NEXT LETTER -LSTCOL .HS 28 LAST COLUMN+1 WHICH PRINT WILL PRINT IN -LINCNT .BS 1 LINE PRINTING ON:USED TO DETECT SCREEN OVERFLOW -PPNT .BS 1 POINTER INTO PSTACK -PSTACK .BS 5 -PSTACK2 .BS 5 -DIG1 .AS -/ / - .AS -/ ''.?AAAAA/ - .AS -/AAAAAAAABBBBCCCC/ - .AS -/CDDDDEEEEEEEEEEE/ - .AS -/FFFGGGHHHHIIIIII/ - .AS -/IIIIIKKLLLLLLLMM/ - .AS -/MNNNNNNNOOOOOOOO/ - .AS -/OPPPRRRRRRRRRRSS/ - .AS -/SSSSSSTTTTTTTTUU/ - .AS -/UUUUUVWWWWWWYYYY/ -DIG2 .AS -/"=ABCDEFGHIKLMNO/ - .AS -/PRSTUWYST==BCDGI/ - .AS -/LMNPRSTYAEORAEHK/ - .AS -/O.EIO.ACDELMNRST/ - .AS -/EIOAEHAEIOCDEGLM/ - .AS -/NORSTESADEILOYAE/ - .AS -/I'DEGOSTFKMNORTU/ - .AS -/WAER.ADEIORSTY.A/ - .AS -/EHIOST.AEHIORT'A/ - .AS -/LNRSTEAEHINO.EOS/ -WRDTXT .EQ *+38 -WRDTAB .DA #0,#.2-.1,#.3-.1,#.4-.1,#.5-.1,#.6-.1,#.7-.1,#.8-.1,#.9-.1,#.10-.1,#.11-.1,#.12-.1,#.13-.1 - .DA #.14-.1,#.15-.1,#.16-.1,#.17-.1,#.18-.1,#.19-.1,#.20-.1,#.21-.1,#.22-.1,#.23-.1,#.24-.1,#.25-.1,#.26-.1,#.27-.1 - .DA #.28-.1,#.29-.1,#.30-.1,#.31-.1,#.32-.1,#.33-.1,#.34-.1,#.35-.1,#.36-.1,#.37-.1,#.38-.1 -.1 .AT / NORTH/ -.2 .AT / WEST/ -.3 .AT / SOUTH/ -.4 .AT / EAST/ -.5 .AT / UP/ -.6 .AT / DOWN/ -.7 .AT / AND / -.8 .AT / BOOK/ -.9 .AT / CAN'T / -.10 .AT / DON'T / -.11 .AT / IN / -.12 .AT / IS / -.13 .AT / IT/ -.14 .AT / NOT/ -.15 .AT / REMEMBER/ -.16 .AT / STAIR/ -.17 .AT / THAT/ -.18 .AT / THE / -.19 .AT / THE/ -.20 .AT / WITH/ -.21 .AT /YOU'RE/ -.22 .AT / YOU / -.23 .AT / YOU/ -.24 .AT / YOUR / -.25 .AT /DO / -.26 .AT /E TO / -.27 .AT /ED / -.28 .AT /HAVE / -.29 .AT /HERE/ -.30 .AT /IGHT/ -.31 .AT /ING / -.32 .AT /ING/ -.33 .AT /PERHAPS/ -.34 .AT /RE / -.35 .AT /THIS / -.36 .AT /TION/ -.37 .AT /YOU/ -.38 - STA $10 -* OBJ IN $10 -PA JSR GNT - BNE PAT NOT CN - LDA #"A - JSR COUT - LDX #$FF -.1 INX - LDA ANTAB,X - BEQ .2 A,NOT AN - CMP $10 - BNE .1 - LDA #"N - JSR COUT -.2 LDA #" " - JSR COUT -PAT STY $24 - LDA $1A - PHA - LDA $1B - PHA - LDA $10 - JSR POBJ - PLA - STA $1B - PLA - STA $1A - RTS -PTHE JSR GNT - EOR #6 - BEQ PAT PROPER NOUN -*PRINT THE - LDX #3 -.1 LDA .2,X - STX MISC - JSR COUT - LDX MISC - DEX - BPL .1 - BMI PAT -.2 .AS -/ EHT/ -GNT LDA $10 - STY $11 - JSR PNTOBJ - LDY #5 - LDA (MISC),Y - LDY $11 - AND #6 - RTS -ANTAB .DA #OFFI,#ALL,#ARR,#CAP,ID -* PRINT $50,51 IN DECIMAL -* HEX-TO-DEC BY LONG DIVISION -* FIND DIGITS IN REVERSE ORDER BY REPEATEDLY DIVIDING BY 10 -* IN ORDER TO SHIFT QUOTIENT BIT INTO $50 WHILE SHIFTING DIVIDEND OUT, -* WE ROTATE AFTER THE COMPARE. THUS WE MUST COMPARE TO 10/2 INSTEAD OF 10 -* THANKS TO BOB SANDER-CEDERLOF -PRDEC LDX #0 DIGIT COUNT -.62 LDA #16 BITS - STA $19 LOOP COUNTER - LDA #0 -.63 CMP #10/2 - BCC .64 - SBC #10/2 CARRY REMAINS SET TO SHIFT INTO QUOTIENT -.64 ROL $50 SHIFT IN RESULT WHILE SHIFTING OUT NUMBER - ROL $51 - ROL - DEC $19 - BNE .63 - PHA SAVE DIGIT - INX COUNT DIGIT - LDA $50 - ORA $51 ANYTHING LEFT? - BNE .62 NEXT DIGIT -.66 PLA - ORA #"0 - STY $24 - JSR FDF0 COUT WOULD CHANGE X - LDY $24 - DEX - BNE .66 - RTS -*-------------------------------- -PSS LDX PPNT - LDA $1A - STA PSTACK,X - LDA $1B - STA PSTACK2,X - INC PPNT - RTS -PLS DEC PPNT - LDX PPNT - LDA PSTACK,X - STA $1A - LDA PSTACK2,X - STA $1B - RTS =start -* -SAVE START3,S6,D1 -*-------------------------------- -* INITIALIZATION -*-------------------------------- -TEMP .EQ 2,3,4,5 -MISC .EQ 6,7 -EDGE .EQ 8,9 -WTOP .EQ $22 -WBOT .EQ $23 -NUMCHR .EQ 4 # CHARS (LIBR DOESN'T COUNT) -*-------------------------------- -* COPY $F800-FFFF INTO RAMCARD -INMATE LDA $C081 READ ROM - LDA $C081 WRITE RAM - LDY #0 - STY 0 - LDA #$F8 - STA 1 -.1 LDA (0),Y - STA (0),Y - INY - BNE .1 - INC 1 - BNE .1 - LDA #RESET REDIRECT RESET - STA $FFFC SO IT DOESN'T - LDA /RESET CRASH. - STA $FFFD -* READ INCARD INTO RAMCARD - LDA $C083 WRITE ENABLE - LDA $C083 RAMCARD - LDA $E000 CHECK FOR RAMCARD - EOR #$FF - STA $E000 - CMP $E000 - BEQ .2 CHANGED - JSR $FD8E - JSR $FD8E - LDA #16 - STA $24 - LDY /.15 - LDA #.15 - JSR PS - JMP BASIC -.15 .US /NEEDS 64K=/ -.2 LDY #0 -.3 LDA .4,Y - BEQ .5 - JSR $FDED THE ONLY CALL TO $FDED - INY - BNE .3 -.4 .AS -/^DBLOADINCARD/ IMBEDDED CTRL-D - .DA $8D -* LEAVE RAMCARD ALWAYS WRITE-ENABLED -*-------------------------------- -* READ $6A00-B6FF FROM TC S3 - T10 SF - .DO PROD -.5 LDY #1 -.6 LDA $B7E9,Y - STA SLOT,Y - DEY - BPL .6 - .ELSE -.5 LDA $B7E9 - STA SLOT - LDA #1 DRIVE 1 - STA DRIVE - .FIN - JSR NODOS - LDA #0 - STA $3F2 POINT RESET - LDA #$E0 - STA $3F3 - JSR $FB6F - LDA #1 READ - STA CMND - LDA #$10 - STA TRACK - LDA #$F - STA SECT - LDA #0 - STA VOL - STA BUF - LDA #$B6 - STA BUF+1 - LDA #$4D - JSR RWG READ BACKWARD FROM T10 SF -* JSR PROT - LDY #11 -.7 LDA KEYTAB,Y SET UP DEFAULT STARTING POINT FOR CONV. TABLES - STA KEYSTRT,Y - DEY - BPL .7 -*-------------------------------- -START LDA #0 - STA GAMOVR - LDY #2 -.0 STA BFCNT,Y BFCNT,BBEG,BEND (ONLY NECESSARY FOR RESTART) - DEY - BPL .0 - STA $C010 -* DETERMINE IF THIS APPLE TAKES LOWERCASE - JSR FBB3 GET SIGNATURE BYTE - CMP #6 ][e OR ][c - BNE .2 - LDA #$FF - STA LWC -.2 JSR FC58 - JSR FB2F VTAB 25 - LDA #0 - JSR APMSG - LDA #30 - STA MINUTE - LDA #7 STARTING HOUR - STA HOUR - STA MONTH - LDA #21 - STA DAY -* JSR CHECK -PROG JSR CHKEY - LDA TR - STA TREP -.0 JSR GTIME - JSR CHKEY - DEC TREP - BNE .0 - JSR TOURIST - JSR CHKEY - JSR SOCIAL - JSR CHKEY - JSR PLANS - JSR CHKEY - JSR IMP - BEQ .4 NO ENTERTAINMENT IF IMPRISONED - JSR GENT - JSR CHKEY -.4 JSR SPEC - JSR CHKEY - JSR DOIT DO DOs ON STACK - JSR CHKEY - LDA #ME - STA ACTOR - LDA LOC - STA ACLOC - JSR DISPLAY - JSR CHKEY - LDA GAMOVR - BEQ .2 - LDA SCORE - STA $50 - LDA #0 - STA $51 - LDA #26 - JSR PADJ GAME OVER - JSR YESNO - BNE .1 - JSR RGS READ GAME START - JMP START -.1 JSR FB2F TEXT - JMP BASIC -.2 LDA LOC - STA LSTLOC - LDA #$2C BIT - STA INPUT INPUT FROM KEYBOARD - LDA #0 - STA DQ NOT A QUOTE - STA QMARK - LDA PATBUS+2 - BNE .3 I'M BUSY - JSR PARSE -.3 LDA #0 - STA DQ CLARIFY THAT ALL ACTIONS NOT CALLED BY PARSE -* ARE TAKEN BY CHARS' OWN WILL - JMP PROG -LWC .BS 1 >=$80=LOWERCASE -GAMOVR .BS 1 -TREP .BS 1 -*-------------------------------- -* CHECK FOR TIME-TRIGGERED EVENTS -* TIMERS -GTIME LDX #NUMTIM*2-2 -.1 LDA TIMERS+1,X - BNE .2 - LDA TIMERS,X LO BYTE - BEQ .4 LEAVE AT 0 - DEC TIMERS,X - BNE .4 - LDA TIMERACT,X - LDY TIMERACT+1,X - JSR TIMEV - BPL .4 -.2 LDA TIMERS,X - BNE .3 - DEC TIMERS+1,X -.3 DEC TIMERS,X -.4 DEX - DEX - BPL .1 -* EVENTS AT SET TIME - LDX #NUMEV-1*2 (9-1)*2 -.5 TXA - LSR A=A/2 - TAY - LDA SETEVD,Y - BEQ .6 ANY DAY - CMP DAY - BNE .7 -.6 LDA SETEVHM,X - CMP HOUR - BNE .7 - LDA SETEVHM+1,X - CMP MINUTE - BNE .7 - LDA SETEVACT,X - LDY SETEVACT+1,X - JSR TIMEV -.7 DEX - DEX - BPL .5 -* ADVANCE TIME - INC MINUTE - LDA MINUTE - CMP #60 - BNE .8 - LDY #0 - STY MINUTE - INC HOUR - LDA HOUR - CMP #25 - BNE .8 -* INC DAY DON'T SINCE SLEEPING DOES - INY - STY HOUR -* LDA DAY -* CMP #32 -* BNE .8 -* INC MONTH -* STY DAY -.8 RTS -TIMEV STA VDAT+1 - STY VDAT+2 - TXA - PHA - JSR JSRSPC - PLA - TAX - RTS -*-------------------------------- -SPEC LDA GCNT TIMER - BEQ .3 - LDA GACT - LDY GDIR - JSR MOVE GACT MOVING GDIR -.3 LDY CROSS - BEQ SP5 - CPY #3 - BCC .4 - INC BROKE - JSR INLINE - .DA .5,#NULL,#CHMAP,#HALL2,#WEST,#STR1,#CHMAP,#HALL2,#SOUTH,#STR1,#CHMAP,#HALL4,#EAST,#STR1,#CHMAP,#STAIR4,#NORTH,#STR1,#CHMAP,#STAIR1,#UP,#STR1,#CHMAP,#STAIR3,#DOWN,#STR1,#AINC,GAMOVR,#UPSCR,13 -* STUFF OUT OF SEQUENCE -.8 .DA #15,#16,#17 TELEPORT MESSAGES -.98 .DA #STR1,#STR1,#STR1,#STR1,#STR1,#STR1 LOCS WRAPPED TO -.5 LDA #189 CONGRATS! - JSR APMSG -.0 >PLA ACC,ACP - PHA - CMP #PROF - BEQ .1 - CMP #PRIS1 - BNE .2 -.1 LDA #17 LEAVE - JSR UP2 UPSCR - LDA #190 WITH THE PROF! - JSR APMSG -.2 >PLA CRD,CDP - TAY - LDA .98,Y - TAY LOC WRAPPED TO - LDX #IN - PLA - JSR REPEDG - DEC CROSS - BNE .0 - LDY #3 ONLY 3 MESSAGES -.4 LDA .8-1,Y - JSR APMSG -SP5 LDA #0 - STA CROSS - JSR INLINE -* BURN OUT BATTERY IN LIT FLASH - .DA DRT,#ZERO,B1,#GOTO,.20,#$80,#ITIN,#BATT1,FLASH,#BITSET,FLASH,$40,#AJSR,.15,#$80,#ZERO,B1,#UPSCR,#12,#AZBIT,#BATT1,#$FF,$FFBF,#GOTO,.30 -.20 .DA #$80,#ZERO,B2,#GOTO,.40,#$80,#ITIN,#BATT2,FLASH,#BITSET,FLASH,$40,#AJSR,.25,#$80,#ZERO+$40,B2,#GOTO,.40,#ELSE,#UPSCR,#12,#AZBIT,#BATT2,#$FF,$FFBF -.30 .DA #ADEL,#FLASH,#ADJEC,#LIT,#AZBIT,#FLASH,#$FF,$FFBF -.40 .DA #$80,#BITSET,FAUC1,$20,#AREP,#WATER,#IN,#SINK1,#$80,#BITSET,FAUC2,$20,#AREP,#WATER,#IN,#SINK2,#$80,#BITSET,FAUC3,$20,#AREP,#WATER,#IN,#SINK3,#$80,#ITIN,#SUGAR,#DB,#UPSCR,15 -* LOWER BATTERY CHARGE BY TR -* REQUIRES B2=B1+1 -.15 LDY #0 - .HS 2C -.25 LDY #1 - SEC - LDA B1,Y - SBC TR - BCS .27 - LDA #0 DECd BELOW 0 -.27 STA B1,Y - RTS -*-------------------------------- -NORTH .EQ 0 -WEST .EQ 1 -SOUTH .EQ 2 -EAST .EQ 3 -UP .EQ 4 -DOWN .EQ 5 -TOURTO .EQ 6 -TJMP .EQ 7 -STOP .EQ 8 -STAY .EQ 9 IGNORE -TOURIST LDX #$FF -.0 INX - LDA .15,X - BEQ .2 NO MORE TOURISTS - STA ACTOR - JSR PNTOBJ X UNDIST - LDY #5 - LDA (MISC),Y - LSR - BCC .0 NOT TOURING - STX TX - LDA .16,X - STA VDAT+1 - LDA .17,X - STA VDAT+2 - LDA .20,X STORE POINTER TO TOURVERB - STA TO91 - STA TO86 - LDA .21,X - STA TO91+1 - STA TO86+1 - JSR GAL GET ACTOR LOC, LEAVE IN A - CMP #LP+1 - BCS .0 NO MOVEMENT IF NOT IN A PLACE (IE IN ME) - JSR SPCACT ACT BEFORE MOVE -.1 LDX TX - LDA TPL,X - STA .10+1 - LDA TPH,X - STA .10+2 - JSR .10 - CMP #DOWN+1 - BCS .3 NOT A DIR - JSR TM IN PLAN CW - BCC .7 SUCCESS - BCS .8 FAIL, NO INC -.2 RTS -.3 CMP #STOP - BNE .4 - JSR TO3 PLACED OUT OF LINE SO WE CAN USE LOCAL LABELS - JMP .7 -.4 CMP #TJMP - BNE .5 - JSR .9 - LDX TX - STA TPL,X - JSR .9 - STA TPH,X - BNE .1 ALWAYS -.5 CMP #TOURTO - BNE .7 - JSR .9 - TAY - STY ACLOC - LDA ACTOR - LDX #IN - JSR REPEDG - JMP .75 -.7 JSR GAL FOR SPCACT -.75 JSR .11 -.8 JSR SPCACT - LDX TX - LDA .10+1 UPDATE ROUTE POINTER - STA TPL,X - LDA .10+2 - STA TPH,X - JMP .0 ALWAYS -.9 JSR .11 -.10 LDA $FFF - RTS -.11 INC .10+1 - BNE .12 - INC .10+2 -.12 RTS -* TOURISTS -.15 .DA #BALL,GUARD -* SPCACT POINTERS -.16 .DA #.30,#.35 -.17 .DA /.30,/.35 -* TOURVERB POINTERS -.20 .DA #BS,#WS -.21 .DA /BS,/WS -* TOURIST DATA -.30 .DA 0 -* WATCH GOTO .35: NEEDS A 0 -.35 .DA #0,#INROOM+$40,#RUM,#GOTO,.35,#ELSE,#UPSCR,#1,#DO,#GUARD,#DRI,RUM,0,#0,#$80,#ISEDG,#RUM,#IN,VX,#BITSET+$40,#VX,$2000,0,#BITSET,#VX,4,#0,#DO,#GUARD,#OPE,VX,0,#0,#$80,#NULL,#DO,#GUARD,#GET,VX,0,0 DON'T AJSR DOIT -BS .US /BOUNCED=/ -WS .US /WALKED=/ -TO31 .DA #DOWN,#TJMP,TO31 -TO36 .DA #EAST,#EAST,#EAST,#EAST,#WEST,#WEST,#WEST,#WEST,#TJMP,TO36 -TX .BS 1 TEMP X -TO85 .US /< JUST $/ -TO86 .DA $FFF - .US / INTO THE ROOM.@=/ -* TO91 IS FILLED WI TOURVERB ADDR, TO92 WI DIRECTION WORD# -TO90 .US /< JUST $/ -TO91 .DA $FFF -TO92 .US /_ OUT@ OF THE ROOM.@=/ -TO3 LDA ACTOR - JSR PNTOBJ - LDY #5 - LDA (MISC),Y - AND #$FE - STA (MISC),Y - RTS -*-------------------------------- -GAL LDA ACTOR -GAL2 LDX #IN - JSR GETOBJ - PLA - STA ACLOC - RTS -*-------------------------------- -* INPUT STRING -* ON EXIT: X=LEN+1 -ACUNK .BS 1 1=ACCEPT UNKNOWN WORDS -RE .BS 1 RIGHT EDGE OF INPUT -INSTRING .EQ $200 -BUFFER .EQ $B700,B7FF CIRCULAR BUFFER -INPUT BIT PRSQT CHANGED TO JMP TO USE PRSQT - JSR FD8E - LDA #"> PROMPT - LDY #0 - STY ACUNK - STA ($28),Y - INY - LDX #1 - STX RE -.1 LDA ($28),Y - SEC - SBC #$40 FLASH - CMP #$80 - BCC .15 - SBC #$40 - CMP #$60 - BCC .15 - SBC #$60 LOWERCASE -> INVERSE -.15 STA ($28),Y -.2 JSR GETKEY - CMP #$82 CTRL-B - BNE .21 - JSR CB - JMP .2 -.21 CMP #$98 CTRL-X - BNE .23 - LDA #"\ - STA ($28),Y - JMP INPUT -.23 CMP #$8D - BEQ .7 - CMP #$88 BS - BNE .24 - JSR UNF - JMP .3 -.24 CMP #$95 -> - BNE .27 - CPX RE - BCS .2 ALREADY AT RE - JSR UNF - JSR INCH - JMP .65 -.27 CMP #$FF DELETE - BEQ .90 - CMP #$84 CTRL-D - BEQ .90 -.35 CMP #$A0 - BCC .2 IGNORE CTRLS -.5 JSR INS - STA ($28),Y - CMP #$E0 - BCC .55 - AND #$DF ->UPPERCASE -.55 STA INSTRING-1,X -.6 JSR INCH -.65 INX - BNE .1 -.7 LDX RE - LDA #$A0 - STA INSTRING-1,X - JSR UNF - LDA #0 - STA INSTRING,X - STA DIDQ MAY BE SET BY TSAY - RTS -* DELETE CHAR BEFORE CURSOR -.90 STX TEMP - STY TEMP+1 - LDA $25 - PHA - JSR UNF - DEX - BEQ .96 AT LEFT EDGE - JSR DECH -.91 LDA INSTRING,X - STA INSTRING-1,X - JSR INCH - LDA ($28),Y - JSR DECH - STA ($28),Y - JSR INCH -.92 INX - CPX RE - BCC .91 - DEC RE - LDY TEMP+1 -.96 LDX TEMP - PLA - STA $25 - JSR FC22 -.3 JSR DECH - DEX - BEQ .6 - JMP .1 -*-------------------------------- -INCH PHA - INY - CPY #$28 - BCC .5 - JSR FD8E - LDY #0 -.5 PLA - RTS -*-------------------------------- -DECH PHA - DEY - BPL .5 - JSR FC1A - LDY #$27 -.5 PLA - RTS -*-------------------------------- -* CONVERT FLASHING TO NORMAL -UNF LDA ($28),Y - CLC - ADC #$40 UNFLASH - CMP #$A0 - BCS .2 - ADC #$40 LETTER - CMP #$A0 - BCS .2 - ADC #$60 LOWERCASE -.2 STA ($28),Y - RTS -*-------------------------------- -* INSERT CHAR UNDER CURSOR -* START AT END & MOVE EACH CHAR UP 1 BYTE -INS PHA - STY TEMP - STX TEMP+1 - JSR UNF -* DON'T NEED TO SAVE $28,29 BECAUSE WE'LL GET BACK TO SAME SPOT - LDA RE - PHA - SEC - SBC TEMP+1 - TAX - BEQ .1 -.0 JSR INCH - DEX - BNE .0 -.1 PLA - TAX -.3 LDA ($28),Y - JSR INCH - STA ($28),Y - JSR DECH=transform -* -SAVETRANSFORM10.3 -*-------------------------------- -* PATTERN-MATCHING TRANSFORMS -* PATTERN MUST BEGIN WI WTYPE1 TO MATCH -*-------------------------------- -LENORG .EQ 0 WAS ONCE TNPNT -LENFIN .EQ 1 -TRANSFORM LDA #2 - STA TRL -T0 JSR CHKEY - LDY #0 - STY MISC INDEX -T1 LDX WTYPE,Y - LDA TRNSTAB,X POINTER INTO NEXT TYPE TRANSFORM - BNE .0 - JMP NM0 NO TRANSFORMS STARTING WI THIS TYPE -.0 PHA -.1 INX - LDA TRNSTAB,X POINTER INTO NEXT TYPE TRANSFORM - BEQ .1 FIND NEXT TRANS TYPE - STA CURWORD - PLA - TAX -T15 LDA TRNSTYP,X LEN OF ORIG PATTERN - STA LENORG - STA TEMP COUNTER - LDA TRNSVERB,X LEN OF FINAL PATTERN - STA LENFIN - TXA - CLC - ADC LENORG - ADC LENFIN - STA TEMP+1 START OF NEXT TRANSFORM - LDA TRNSNOUN,X PRIORITY? - CMP TRL - BCC NOMATCH TOO LOW - BCS T3 -T2 LDA TRNSTYP,X - CMP WTYPE,Y - BEQ T3 - CMP WTYPE2,Y - BEQ T3 - CMP WTYPE3,Y - BNE NOMATCH -T3 LDA TRNSWRDH,X - BNE .5 - LDA TRNSWRDL,X - CMP #11 - BCS .4 - STX MISC+1 - TAX - LDA WLO,Y - STA VARLO,X - LDA WHI,Y - STA VARHI,X - LDA WVERB,Y - STA VARVERB,X - LDA WNOUN,Y - STA VARNOUN,X - LDX MISC+1 - JMP NM1 -.4 LDA #0 -.5 CMP WHI,Y - BNE NOMATCH - LDA TRNSWRDL,X - CMP WLO,Y - BEQ NM1 -NOMATCH LDX TEMP+1 START OF NEXT TRANSFORM - LDY MISC - CPX CURWORD NEXT TRANSFORM TYPE - BCC T15 NEXT TRANS -NM0 INC MISC - INY - CPY WORDS - BEQ .1 - JMP T1 -.1 LDA #0 - STA WTYPE,Y MARK END OF WT1 & WT2 & WT3 - STA WTYPE2,Y SO A NP DOESN'T FLY OFF INTO NOWHERE - STA WTYPE3,Y - DEC TRL - BEQ .2 - JMP T0 GO BACK & DO MORE -.2 JMP ATN ALL DONE! -NM1 INX - CPY WORDS -BNM BCS NOMATCH - INY - DEC TEMP - BEQ TMATCH - JMP T2 -TMATCH STY WNUM WORD AFTER MATCH - STX MISC+1 - TYA - SEC - SBC LENORG - CLC - ADC LENFIN - TAX - CMP WNUM - BEQ MOVED LEN(FIN)=LEN(ORG) - BCS .2 LEN(FIN)>LEN(ORG) -* LEN(FIN) < LEN(ORG) -.1 JSR TMOVE - INX - INY - CPY WORDS - BCC .1 - BCS MOVED -* LEN(FIN) > LEN(ORG) -.2 SBC WNUM - CLC - ADC WORDS - TAX - LDY WORDS -.3 JSR TMOVE - DEX - DEY - CPY WNUM - BCS .3 -MOVED LDA WORDS - SEC - SBC LENORG - CLC - ADC LENFIN - STA WORDS - LDY MISC 1ST WORD IN MATCH - TYA - CLC - ADC LENFIN - STA TEMP - LDX MISC+1 TRNS DATA AFTER LENFIN -.1 CPY TEMP THIS CMP MUST BE AT BEGINNING OF LOOP -* TO CATCH TRANSFORMS WI FINAL LENGTH 0 - BEQ BNM DONE - LDA TRNSWRDH,X - BNE .3 NOT A VAR - LDA TRNSWRDL,X - CMP #11 - BCS .2 NOT A VAR - STX MISC+1 - TAX - LDA VARHI,X READ VAR - STA WHI,Y - LDA VARLO,X READ VAR - STA WLO,Y - LDA VARVERB,X - STA WVERB,Y - LDA VARNOUN,X - STA WNOUN,Y - LDX MISC+1 - BNE .4 ALWAYS -.2 LDA TRNSWRDH,X -.3 STA WHI,Y - LDA TRNSWRDL,X - STA WLO,Y - LDA TRNSVERB,X - STA WVERB,Y - LDA TRNSNOUN,X - STA WNOUN,Y -.4 LDA TRNSTYP,X - STA WTYPE,Y - LDA #0 - STA WTYPE2,Y - STA WTYPE3,Y - INX - INY - BNE .1 -TMOVE LDA WLO,Y - STA WLO,X - LDA WHI,Y - STA WHI,X - LDA WTYPE,Y - STA WTYPE,X - LDA WTYPE2,Y - STA WTYPE2,X - LDA WTYPE3,Y - STA WTYPE3,X - LDA WVERB,Y - STA WVERB,X - LDA WNOUN,Y - STA WNOUN,X - RTS -* TRL: 2, THEN 1. TRANSFORM CAN BE MADE IF IT'S TRL# >= TRL. -TRL .BS 1 TRANS LOOP # -* NTH TRNSTAB ENTRY POINTS TO 1ST TRNFRM WHERE 1ST TYPE IN STRING = N -* 00 MEANS NO TRANSFORMS BEGINNING WI THAT TYPE -* LAST BYTE IN TRNSTAB POINTS TO 1ST BYTE AFTER TRANSFORM DATA -TRNSTAB .EQ *-1 - .HS 0001070000000000000000001B000000000000004500000000495500005B000063007B7ED9 -* TRNSTYP: LEN(ORG) ORG ORG/F F -* TRNSWRD: ORIG ORG ORG/F F -* TRNSVERB:LEN(FIN) BLANK BL/F F -* TRNSNOUN: TRL# BL BL/F F -* WORD #S 0000-000F ARE VARS. WHEN A VAR IS GIVEN IN TRNSWRD(ORG), -* THE WRD#, VERB, AND NOUN ARE COPIED INTO VARLO,VARHI,VARVERB,& VARNOUN. -* WHEN THE SAME VAR IS IN TRNSWRD(FIN),THOSE VALUES ARE READ -* INTO THE FINAL PATTERN. -TRNSTYP .EQ *-1 -* VI - .DA #2,#PM,#VT - .DA #2,#PRT,#VT -* VT - .DA #3,#VT,#TRNS,#VT - .DA #4,#NUM,#VT,#TRNS,#VT - .DA #2,#CN,#CN - .DA #2,#CN,#VT,#CN - .DA #2,#CN,#VT,#CN -* PM -* .DA #3,#TRNS,#TRNS,#PM -* CN - .DA #2,#CN,#CN - .DA #3,#TRNS,#CN,#CN - .DA #3,#CN,#CN,#CN - .DA #2,#CN,#CN - .DA #2,#CN,#CN - .DA #2,#CN,#CN - .DA #2,#CN,#CN - .DA #2,#CN,#CN - .DA #2,#CN,#CN - .DA #2,#CN,#CN - .DA #3,#PM,#ADJ,#CN - .DA #2,#CN,#CN - .DA #2,#CN,#CN -* RP - .DA #3,#VA,#PN,#PN -* CL - .DA #2,#CN,#CN - .DA #2,#CN,#CN - .DA #2,#CN,#CN - .DA #2,#CN,#CN -* VA - .DA #2,#PI,#VT - .DA #2,#PM,#VT -* QUES - .DA #3,#VA,#PN,#VP,#PN - .DA #2,#VA,#VT -* CONT - .DA #1,#VA,#NEG - .DA #1,#QUES,#NEG - .DA #1,#QUES,#NEG - .DA #1,#VA,#NEG - .DA #1,#NS,#VA - .DA #1,#QUES,#NEG - .DA #1,#VA,#NEG - .DA #1,#NS,#VA -* TRNS - .DA #2,#TRNS - .DA #1 -* VZ: FAKE VERB TYPE (GIVE, THROW) USED SO BELOW TRANSFORM GETS THEM -* FOLLOWING 9: VT NP1 NP2 -> VT NP2 TO NP1 - .DA #3,#CN,#CN,#VT,#CN,#PM,#CN - .DA #4,#CN,#ADJ,#CN,#VT,#ADJ,#CN,#PM,#CN - .DA #4,#CN,#NUM,#CN,#VT,#NUM,#CN,#PM,#CN - .DA #4,#CN,#POS,#CN,#VT,#POS,#CN,#PM,#CN - .DA #4,#ADJ,#CN,#CN,#VT,#CN,#PM,#ADJ,#CN - .DA #4,#NUM,#CN,#CN,#VT,#CN,#PM,#NUM,#CN - .DA #4,#POS,#CN,#CN,#VT,#CN,#PM,#POS,#CN - .DA #4,#TRNS,#CN,#CN,#VT,#CN,#PM,#CN - .DA #5,#CN,#ADJ,#ADJ,#CN,#VT,#ADJ,#ADJ,#CN,#PM,#CN - .DA #5,#ADJ,#CN,#ADJ,#CN,#VT,#ADJ,#CN,#PM,#ADJ,#CN -TRNSWRDL .EQ *-1 - .DA #281,#25,#149 LOOK AT -> EXAM - .DA #281,#188,#180 LOOK FOR -> FIND - .DA #77,#361,#341,#361 CARRY PHOTO OF -> PHOTO - .DA #77,#11,#361,#341,#361 CARR A PHOTO OF -> PHOTO -* (NOTE: BAD IF PHOTO IS OBJ: "TAKE PHOTO OF MARK" AMBIGUOUS) - .DA #292,#56,#56 LIGHT BULB -> BULB - .DA #401,#310,#390,#310 REMOVE MAG -> PRY MAG - .DA #401,#423,#524,#423 REMOVE SCREW -> UNSCREW SCREW -* .DA #_,#_,#_,#_ ON TOP OF -> ON - .DA #454,#34,#454 SOAP BAR -> SOAP - .DA #34,#341,#454,#454 BAR OF SOAP -> SOAP - .DA #430,#311,#430,#430 DR MARK SHEF -> SHEF - .DA #430,#430,#430 DR SHEFF -> SHEF - .DA #311,#430,#430 MARK SHEFF -> SHEFF - .DA #482,#368,#368 TAPE PLAYER -> PLAYER - .DA #325,#325,#325 MRS KIRBY -> MRS - .DA #177,#66,#66 FILE CABIN -> CABIN - .DA #381,#381,#381 PROF HALD -> PROF - .DA #74,#74,#74 ID CARD -> CARD - .DA #46,#346,#89,#46 BOOK ON CIVIL WAR -> BOOK - .DA #528,#221,#221 VENT GRILL -> GRILL - .DA #108,#50,#50 GLASS BOTTLE -> BOTTLE - .DA #0,#38,#1,#1 RP BE PN -> PN - .DA #84,#103,#103 CHECK COUNT -> LCOUNT - .DA #125,#537,#537 DIGITAL WATCH -> WATCH - .DA #562,#34,#34 WOODEN BAR -> BAR - .DA #506,#66,#66 TOOL CAB -> CAB - .DA #98,#526,#186 COME WITH -> FOLLOW - .DA #294,#502,#237 LISTEN TO -> HEAR - .DA #545,#38,#0,#281,#0 WHAT BE PN -> LOOK PN - .DA #548,#38,#180 WHERE BE -> FIND - .DA #21,#38,#338 AREN'T - .DA #70,#315,#338 CANNOT -> MAY NOT - .DA #133,#129,#338 DON'T - .DA #233,#232,#338 HASN'T - .DA #258,#257,#38 I'M - .DA #434,#315,#338 SHOULDN'T -> MAY NOT - .DA #561,#554,#338 WON'T - .DA #575,#574,#38 YOU'RE - .DA #341,#489 OF THE -> _ - .DA #489 THE -> _ - .DA #0,#1,#2,#0,#2,#502,#1 VZ NP1 NP2 -> VZ NP2 TO NP1 - .DA #0,#1,#2,#3,#0,#2,#3,#502,#1 - .DA #0,#1,#2,#3,#0,#2,#3,#502,#1 - .DA #0,#1,#2,#3,#0,#2,#3,#502,#1 - .DA #0,#1,#2,#3,#0,#3,#502,#1,#2 - .DA #0,#1,#2,#3,#0,#3,#502,#1,#2 - .DA #0,#1,#2,#3,#0,#3,#502,#1,#2 - .DA #0,#489,#1,#3,#0,#3,#502,#1 - .DA #0,#1,#2,#3,#4,#0,#2,#3,#4,#502,#1 - .DA #0,#1,#2,#3,#4,#0,#3,#4,#502,#1,#2 -TRNSWRDH .EQ *-1 - .DA #1,0 VI - .DA #1,0 - .DA #0,#1,#1,#1 VT - .DA 0,#1,#1,#1 - .DA #1,0 - .DA /401,/310,/390,/310 - .DA /401,/423,/524,/423 -* .DA #1,#1,#1,#1 PM - .DA 1,#1 CN - .DA #0,#1,#1,#1 - .DA #1,#1,#1,#1 - .DA #1,#1,#1 - .DA #1,#1,#1 - .DA #1,#1,#1 - .DA #1,#1,#1 - .DA 0,#0 - .DA #1,#1,#1 - .DA 0,#0 - .DA #0,/346,0 - .DA /528,/221,/221 - .DA /108,/50,/50 - .DA 0,0 RP - .DA 0,#0 CL - .DA #0,#2,#2 - .DA #2,0 - .DA /506,/66,/66 - .DA #0,/526,#0 VA - .DA #1,/502,/237 - .DA #2,0,1 QUES - .DA 2,#0 - .DA 0,#1 CONT - .DA #0,#1,#1 - .DA 0,#1 - .DA 0,#1 - .DA #1,1 - .DA #1,#1,#1 - .DA #2,#2,#1 - .DA #2,2 - .DA #1,#1 TRNS - .DA #1 - .DA 0,0,#0,1 VZ - .DA 0,0,0,#0,1 - .DA 0,0,0,#0,1 - .DA 0,0,0,#0,1 - .DA 0,0,0,/502,0 - .DA 0,0,0,/502,0 - .DA 0,0,0,/502,0 - .DA #0,/489,0,0,/502,#0 - .DA 0,0,0,0,#0,/502,#0 - .DA 0,0,0,0,/502,0 -TRNSVERB .EQ *-1 - .DA 1,#EXA VI - .DA 1,#FIN - .DA #1,0,#PHO VT - .DA 1,0,#PHO - .DA #1,0 - .DA 2,PRY,2,UNS -* .DA 1,0 PM - .DA #1,0 CN - .DA 1,0 - .DA 1,0 - .DA #1,0 - .DA #1,0 - .DA #1,0 - .DA #1,0 - .DA #1,0 - .DA #1,0 - .DA #1,0 - .DA 1,0 - .DA #1,0 - .DA #1,0 - .DA 1,0 RP - .DA #1,0 CL - .DA #1,0 - .DA #1,0 - .DA #1,0 - .DA 1,#FOL VA - .DA 1,#HEA - .DA #2,0,LOO QUES - .DA 1,#FIN - .DA #2,0 CONT - .DA #2,0 - .DA #2,0 - .DA #2,0 - .DA #2,0 - .DA #2,0 - .DA #2,0 - .DA #2,0 - .DA 0 TRNS - .DA #0 - .DA #4,0,0,0,#5,0,0,0,0,#5,0,0,0,0,#5,0,0,0,0 VZ - .DA #5,0,0,0,0,#5,0,0,0,0,#5,0,0,0,0 - .DA 4,0,0,0 - .DA #6,0,0,0,0,0,#6,0,0,0,0,0 -TRNSNOUN .EQ *-1 - .DA #2,0,#2,0 VI - .DA 2,0,#2,0,0 VT - .DA 2,#BULB1 - .DA 2,#0,#MAG,2,#0,#SCREWS1 -* .DA #2,0,#UNDER PM - .DA 2,#SOAP1 CN - .DA #2,0,#SOAP1 - .DA 2,#0,#MARK - .DA 2,#MARK - .DA 2,#MARK - .DA 2,#RECOR - .DA 2,#MRS - .DA 2,#CAB - .DA 2,#PROF - .DA 2,#ID - .DA 2,#0,#BOOK4 - .DA 2,#GRILL1 - .DA 2,#BOTT - .DA 2,0 RP - .DA 2,#LCOUNT CL - .DA 2,#WATCH - .DA 2,#BAR - .DA 2,#CAB - .DA 1,#0 VA - .DA #2,0 - .DA #1,0,0 QUES - .DA #1,0 - .DA #2,0 CONT - .DA #2,0 - .DA #2,0 - .DA #2,0 - .DA #2,0 - .DA #2,0 - .DA #2,0 - .DA #2,0 - .DA 2 TRNS - .DA #2 - .DA 1,0,#0,TO,#1,0,0,0,TO,#1,0,0,0,TO,#1,0,0,0,TO VZ - .DA 1,0,0,#TO,0 - .DA 1,0,0,#TO,0 - .DA 1,0,0,#TO,0 - .DA 1,0,0,TO - .DA #1,0,0,0,0,TO - .DA 1,0,0,0,#TO,0 -VARLO .BS 11 -VARHI .BS 11 -VARVERB .BS 11 -VARNOUN .BS 11 + END OF ARCHIVE