LEX 'DSPLEX' Filename ID #17 MSG 0 No messages POLL POLHND Pollhandler ****** Addresses for LCD BEEPDC EQU #0584C BEEPP EQU #02AAB tON EQU #000E0 DISP EQU #01C0E STLCD EQU #2E104 SNAPSU EQU #015A7 SNAPRS EQU #01571 DSPRST EQU #02443 CKSREQ EQU #00721 SLEEP EQU #006C2 POPBUF EQU #010EE LCDC EQU #2E3FE ****** Addresses for SET/CLR/DOT EXPEXC EQU #0F186 FNRTN4 EQU #0F238 POP1N EQU #0BD8D MPOP2N EQU #0BD54 MFWRN EQU #093BC NXTSTM EQU #08A48 FIXDC EQU #05493 NUMCK EQU #0369D COMCK1 EQU #036D1 RESPTR EQU #03172 POP1-2 EQU #0EE5D FLTDH EQU #1B223 ERRO4 EQU #02E5C ****** Addresses for BOLD/BLINK/SMALL/NORMAL/MIRROR/INVERT BLNK EQU #2E3FF DSP EQU #2E350 STOPDC EQU #05303 STDRVI EQU #2E200 STDRVM EQU #2E300 ********************* **** Entry points and characterization nibble ENTRY BOL CHAR #D ENTRY BLI CHAR #D ENTRY CLR CHAR #D ENTRY DOT CHAR #F ENTRY INV CHAR #D ENTRY LCD CHAR #D ENTRY MIR CHAR #D ENTRY NOR CHAR #D ENTRY SET CHAR #D ENTRY SMA CHAR #D **** Keywords and token number KEY 'BLD' TOKEN 1 KEY 'BLINK' TOKEN 2 KEY 'CLR' TOKEN 3 KEY 'DOT' TOKEN 4 KEY 'INVERT' TOKEN 5 KEY 'LCD' TOKEN 6 KEY 'MIRROR' TOKEN 7 KEY 'NRMAL' TOKEN 8 KEY 'SET' TOKEN 9 KEY 'SMALL' TOKEN 10 ENDTXT Text table end ************************** STITLE Poll for VER$ POLHND ?B=0 B VER$ poll GOYES UPOLL NOPOLL RTNSXM else return UPOLL C=R3 D1=C Write A=R2 D1=D1- (Texten)-(Textst)-2 out CD1EX ?A>C A GOYES NOPOLL D1=C R3=C Textst LCASC ' DSP:B' The version text Texten DAT1=C (Texten)-(Textst)-2 GOTO NOPOLL ********************** STITLE SET & CLR-code REL(5) DECOM Decompile routine REL(5) PARSE Parse routine ********************* SET GOSUB RCL Fetch pos C=C!A B Set dot SET1 DAT0=C B Write dot to display GOTO nxtstm Return to mainframe ********************* REL(5) DECOM decompile REL(5) PARSE parse CLR GOSUB RCL Fetch pos CDEX B LCHEX FF C=C-D B C=C&A B GOTO SET1 Clears dot ********************* DECOM GOVLNG FIXDC Same as for FIX PARSE GOSBVL NUMCK Check for a number GOSBVL COMCK1 Check for a comma GONC ERG Error if no comma GOSBVL NUMCK Check for 2nd number GOVLNG RESPTR Return to parse ERG GOVLNG ERRO4 'Missing parameter' ********************* * Fetch dot pos given column & row pos RCL ******* GOSBVL EXPEXC Evaluate expression GOSBVL POP1-2 Fetch X to A-reg & Y to C-reg RCLF R0=C Save Y in R0 GOSBVL FLTDH Convert X to hex GONC ERR1 Error if wrong type C=R0 C=Y ACEX W C=X A=Y R0=C Save X in R0 GOSBVL FLTDH Convert Y to hex ERR1 GONC ERR Error if wrong type C=0 A LCHEX 7 ?A>C A X>7? GOYES ERR ASRC Save Y in A[S] C=R0 C=X ACEX A A=X C=0 A LCHEX 83 ?A>C A X>131? GOYES ERR LC(5) STLCD Addr to start of display memory D=C A Save addr in D C=0 A A=A+A A X=X+X LCHEX 5A ?A<=C A X<=90? GOYES RCL1 LCHEX A0 D=D+C A Addr=Addr+160 RCL1 LCHEX BA ?A<=C A X<=186? GOYES RCL2 LCHEX A0 D=D+C A Addr=Addr+160 RCL2 CDEX A C=Addr A=A+C A A=X+Addr CDEX A D=Addr D0=A D0=Addr of the right byte C=0 W LCHEX 80 C=1000 0000 RCL3 ?A=0 S Y=0? GOYES RCL4 CSRB Shift C right 1 bit A=A-1 S Y=Y-1 GOTO RCL3 Loop back to RCL3 RCL4 A=DAT0 B A=The right byte RTN C[B] points to the right bit * ERR C=RSTK Pop rtn stack C=0 W P= 0 LCHEX 51 C=Errn 81 (Invalid Param) P= #D GOSBVL MFWRN Issue warning GOTO nxtstm Return to main loop * * * STITLE DOT-code NIBHEX 88823 3 numeric param, one optional DOT AD0EX Save R1=A D0 AD0EX in R1 ST=0 1 CFLAG 1 P=C #F P=actual number of parms ?P= 2 2 param (X,Y)? GOYES TWO ST=1 1 else SFLAG 1 GOSBVL POP1N Fetch 3rd param (S/C) GOC ERROR Error if wrong type R3=A Save S/C in R3 D1=D1+ 16 Incr. stack pointer TWO GOSBVL MPOP2N Fetch X & Y GOSUB RCLF Get dot position R2=C Save bit pointer in R2 R0=A Save byte ptr in R0 C=C&A B C= dot value (0/1) ST=0 0 CFLAG 0 ?C=0 B Bit clear? GOYES YES ST=1 0 else SFLAG 0 YES ?ST=0 1 FLAG 1 clear? (2 parms) GOYES FRTN A=R3 A=S/C value B=A W B= S/C value A=R0 A=byte C=R2 C=bit pointer ?B=0 W Clear dot? GOYES CLRF C=C!A B Else set dot ENDF DAT0=C B Write out dot FRTN A=R1 A=original D0 (PC) D0=A Restore D0 C=0 W C=0 ?ST=0 0 Dot clear? GOYES STOP P= #E C=C+1 P C=1 STOP GOVLNG FNRTN4 Return C-value to main loop CLRF CDEX B Clear P= 0 LCHEX FF C=C-D B C=C&A B GOTO ENDF * ERROR GOTO ERG Goto error ******************** STITLE BLINK, BOLD & MIRROR-code REL(5) DECOMS REL(5) PARSES BLI D1=(5) BLNK Point to the display control nibble LCHEX 3 DAT1=C 1 Write out '3' to nibble GOTO nxtstm ********** REL(5) DECOMS REL(5) PARSES BOL LCHEX 8001400360041008 Bold constant GOTO STORE Write out C and return ********** REL(5) DECOMS REL(5) PARSES MIR D1=(5) DSP Display row driver P= #F A=DAT1 16 Fetch 16 nibles to A and C C=DAT1 16 ASLC Shift A left one byte ASLC * LOOP ACEX P Exchange A & C at P P=P-1 ACEX P Again P=P-1 P=P-1 P=P-1 ?P# #F GOYES LOOP * ASRC Shift A right one byte ASRC P= #D * LOP ACEX P do it all over again P=P-1 ACEX P P=P-1 P=P-1 P=P-1 ?P# #D GOYES LOP GOTO STORE *********************** STITLE NORMAL & SMALL-code REL(5) DECOMS REL(5) PARSES NOR LCHEX 8001400220041008 GOTO STORE * REL(5) DECOMS REL(5) PARSES SMA LCHEX 0000800360041008 Normal constant STORE D1=(5) DSP Point to row driver DAT1=C 16 Write out C and return nxtstm GOVLNG NXTSTM return to main loop DECOMS GOVLNG STOPDC STOP decompile PARSES RTNCC STOP parse (no param) *************** STITLE INVERSE-code REL(5) DECOMS REL(5) PARSES INV D0=(5) STLCD Point to display driver II P= 5 Invert 5*16 (40 columns) GOSUB LOOPT nibbles C=DAT0 #C + C=-C-1 W 12 (=>46 columns) DAT0=C #C nibbles D0=(5) STDRVI Point to disp driver I P= 6 Invert 6*16 (48 columns) GOSUB LOOPT nibbles D0=(5) STDRVM Point to master driver P= 4 Invert 4*16 (32 columns) GOSUB LOOPT C=DAT0 #C C=-C-1 W DAT0=C #C GOTO nxtstm * LOOPT C=DAT0 W Fetch 16 nibbles C=-C-1 W C=NOT C DAT0=C W Write back D0=D0+ 16 P=P-1 ?P= 0 RTNYES GOTO LOOPT ************************ STITLE LCD-code REL(5) LCDd Decompiler REL(5) LCDp Parser LCD A=DAT0 B Fetch following token LC(2) tON ?A=C B ON? GOYES LCDON C=C+1 B ?A#C B OFF? GOYES LCDSET No, just LCD D1=(5) BLNK Point to display control nibble LCHEX 0 GOTO LCD1 write out 0 & return LCDON D1=(5) BLNK LCHEX 1 Load C with 1 (LCD ON) LCD1 DAT1=C 1 Write out C GOTO nxtstm return * LCDSET C=RSTK Pop return adress GOSBVL SNAPSU Save CPU-reg + rtnaddr GOSUB POP Jump to get start addr of text * (Start addr=rtnaddr) NIBASC 'Set cont' NIBASC 'rast [+ ' NIBASC '- END]' NIBHEX D0A0FF End of text POP C=RSTK Fetch start adress of text D1=C Put in D1 GOSBVL DISP Write out text * SLP GOSBVL SLEEP Go to light sleep GOC SREQ Jump is a service request * woke us up GOSBVL POPBUF Else fetch keycode C=0 A P= 0 LCHEX 2A ?C=B A '-'? GOYES MINUS LCHEX 26 ?C=B A 'ENDLINE'? GOYES ENDT LCHEX 38 ?C=B A '+'? GOYES PLUS GOTO SLP Else go to sleep again SREQ GOSBVL CKSREQ Check service request GOTO SLP PLUS D0=(5) LCDC Point to contrast nibble C=DAT0 S Fetch nibble C=C+1 S Increment GONC SLCDC Jump if no overflow C=C-1 S Restore SLCDC DAT0=C S Write out nibble GOTO SLP MINUS D0=(5) LCDC C=DAT0 S C=C-1 S GONC SLCDC C=0 S Restore GOTO SLCDC ENDT GOSBVL DSPRST Clear display GOSBVL SNAPRS Restore CPU RSTK=C and return address GOTO nxtstm LCDd GOVLNG BEEPDC Same as BEEP LCDp GOVLNG BEEPP Same as BEEP END