ÚVOD | Novinky | 8 Bitů | Příslušenství | Drobnosti | TTL | Kontakt
SAPI-1 | ONDRA | PMI-80 | PMD-85 | klony PMD-85 | klony SM50/40 | PETR | PLAN-80A | IQ151 | TNS | FK-1 | HVĚZDA | SP 830 | PCS 1-QR6000
ZPS | Technické prostředky | Programové vybavení | Dokumentace
;JPR-1 MIKRO BASIC ; ;***************************************** ; ; J P R - 1 M I K R O B A S I C 3 . 1 ; ;**************************************** ; ; TITLE 'JPR-1 MIKRO BASIC' ; ORG 0 ; JMP START TOP: LHLD TXTUNF INX H RET JMP BRST LENGHT: LHLD LEGT DCX H RET JMP BRST+9 BEND: CALL ENDCHK JMP RSTART ; ;START ; START: LXI SP,STACK CALL DISP CALL NULDIS XRA A STA MODE STA PORT24 LXI D,MSG1 CALL PRTSTG LXI H,TOP SHLD RANPNT LXI H,TXTBGN SHLD TXTUNF LXI H,BUFA SHLD BUFFER LXI H,BUFE SHLD BUFEND LXI H,TXTE START1: SHLD TXTEND ; ;RSTART HORKY START ; RSTART: CALL CRLF RSTAR1: LXI SP,STACK LXI D,OK SUB A STA MODE CMA STA MASKIN CALL PRTSTG LXI H,ST2+1 SHLD CURRNT ST2: LXI H,0 SHLD LOPVAR SHLD STKGOS ST3: MVI B,'>' CALL GETLN ST5: PUSH D CALL DBUFF CALL TSTNUM CALL IGNB MOV A,H ORA L POP B JZ DIRECT DCX D MOV A,H STAX D DCX D MOV A,L STAX D PUSH B PUSH D MOV A,C SUB E PUSH PSW CALL FNDLN PUSH D JNZ ST4 PUSH D CALL FNDNXT POP B LHLD TXTUNF CALL MVUP MOV H,B MOV L,C SHLD TXTUNF ST4: POP B LHLD TXTUNF POP PSW PUSH H CPI 3 JZ RSTART ADD L MOV L,A MVI A,0 ADC H MOV H,A CALL DTXTE CALL COMP JNC QSORRY SHLD TXTUNF POP D CALL MVDOWN POP D POP H CALL MVUP JMP ST3 ; MSG1: DB 'MIKRO BASIC',0 ; ;TABULKA KLICOVICH SLOV ; TAB1: DB 'LIST',0 DW LIST DB 'LLIST',0 DW LLIST DB 'RUN',0 DW RUN DB 'NEW',0 DW NEW DB 'REWIND',0 DW REWIND TXMON: DB 'MONITOR',0 DW MONIT DB 'RAM',0 DW RAM DB 'LOAD',0 DW LOAD DB 'SAVE',0 DW SAVE TAB2: DB 'NEXT',0 DW NEXT DB 'LET',0 DW LET DB 'CLS',0 DW CLS DB 'CLEAR',0 DW CLEAR DB 'HARD',0 DW HARD DB 'DISPL',0 DW DISPL DB 'IF',0 DW IFF DB 'GOTO',0 DW GOTO DB 'GOSUB',0 DW GOSUB DB 'RETURN',0 DW RETURN DB 'REM',0 DW REM DB 'FOR',0 DW FOR DB 'INPUT',0 DW INPUT DB 'PRINT',0 DW PRINT DB 'LPRINT',0 DW LPRINT DB 'END',0 DW BEND DB 'STOP',0 DW STOP DB 'CALL',0 DW BCALL DB 'OUTCHAR',0 DW OUTCHR DB 'OUT',0 DW BOUT DB 'O$',0 DW O DB 'I$',0 DW I DB 'WAIT',0 DW WAIT DB 'BEEP',0 DW BEEP DB 'POKE',0 DW POKE DB 'MASK',0 DW MASK DB 'TAB',0 DW TAB DB 'BYTE',0 DW BYTE DB 'WORD',0 DW WORD DB 0 DW DEFLT TAB4: DB 'RND',0 DW RND DB 'ABS',0 DW ABS DB 'SIZE',0 DW SIZE DB 'PEEK',0 DW PEEK DB 'INCHAR',0 DW INCHAR DB 'HEX',0 DW HEX DB 'INM',0 DW INM DB 'IN',0 DW BIN DB 27H,0 DW QUOTE DB 'TOP',0 DW TOP DB 'AREM',0 DW AREM DB 'LEN',0 DW LENGHT DB 0 DW XP40 TAB5: DB 'TO',0 DW FR1 DB 0 DW QWHAT TAB6: DB 'STEP',0 DW FR2 DB 0 DW FR3 TAB8: DB '>=',0 DW XP11 DB '#',0 DW XP12 DB '>',0 DW XP13 DB '=',0 DW XP15 DB '<=',0 DW XP14 DB '<',0 DW XP16 DB 0 DW XP17 ; ;COMP POROVNANI HL A DE, Z=1 ; COMP: MOV A,H CMP D RNZ MOV A,L CMP E RET ; ;IGNB VYNECHANI MAEZER PODLE DE ; IGNB: LDAX D CPI 20H RNZ INX D JMP IGNB ; ;FINI ; FINI: POP PSW CALL FIN JMP QWHAT ; ;INDEXOVANA PROMENA ; TSTV: CALL IGNB SUI 40H RC JNZ TV1 INX D CALL PARN DAD H JC QHOW PUSH D XCHG CALL SIZE CALL COMP JC ASORRY LHLD TXTEND CALL SUBDE POP D RET ; ;VYPOCET ADRESY ULOZENI PROMENE ; TV1: CPI 1BH CMC RC INX D LXI H,VARBGN RLC ADD L MOV L,A MVI A,0 ADC H MOV H,A RET ; ;TSTC POROVNANI TEXTU PODLE DE SE ZNAKEM ;KTERY JE ZA CALL... JE-LI SHODNY POKRA- ;CUJE SE NA CALL...+2 JINAK NA ADRESE ;O N VYSSI.N JE NA ADRESE CALL..+2 ; TSTC: XTHL CALL IGNB CMP M INX H JZ TC2 PUSH B MOV C,M MVI B,0 DAD B POP B DCX D TC2: INX D INX H XTHL RET ; ;TSTNUM PREVOD ASCII CISLA Z BUFFERU PODLE ;DE NA BINARNI CISLO V HL ; TSTNUM: LXI H,0 MOV B,H CALL IGNB TN1: CPI '0' RC CPI 3AH RNC MVI A,0F0H ANA H JNZ QHOW INR B PUSH B MOV B,H MOV C,L DAD H DAD H DAD B DAD H LDAX D INX D ANI 0FH ADD L MOV L,A MVI A,0 ADC H MOV H,A POP B LDAX D JP TN1 ; ;QHOW OTAZKA HOW ; QHOW: PUSH D AHOW: LXI D,HOW JMP ERROR ; ;TEXTY OTAZEK ; HOW: DB 'HOW?',0DH OK: DB 'READY',0DH WHAT: DB 'WHAT?',0DH SORRY: DB 'SORRY',0DH ; ;NEW ; NEW: CALL ENDCHK LXI H,TXTBGN SHLD TXTUNF ; ;RUN ; RUN: CALL ENDCHK LXI D,TXTBGN RUNNXL: LXI H,0 CALL FNDLP JC RSTART RUNTSL: XCHG SHLD CURRNT XCHG INX D INX D RUNSML: XRA A STA MODE CALL CONT LXI H,TAB2-1 JMP EXEC ; ;GOTO ; GOTO: CALL EXPR PUSH D CALL ENDCHK CALL FNDLN JNZ AHOW POP PSW JMP RUNTSL ; ;HARD ; HARD: CALL PRNTST CALL FINI ; ;DISPL ; DISPL: CALL DISP CALL FINI ; ;LIST ; LLIST: CALL PRNTST LIST: CALL TSTNUM MVI A,0FFH STA LISTC CALL IGNB CPI 0DH JNZ LS4 LS0: CALL FNDLN LS1: JC LS6 LDA LISTC CPI 0FFH JZ LS5 DCR A JZ RSTART LS5: STA LISTC LS3: CALL PRTLN CALL FNDLP JMP LS1 LS4: CPI '+' JNZ LS0 INX D CALL IGNB PUSH H CALL TSTNUM MOV A,L INR A INR A STA LISTC POP H JMP LS0 LS6: CALL DISP JMP RSTAR1 ; ;PRINT ; LPRINT: CALL PRNTST PRINT: MVI C,8 CALL TSTC DB ':' DB 9 CALL CRLF CALL DISP JMP RUNSML CALL TSTC DB 0DH DB 9 CALL CRLF PR6: CALL DISP JMP RUNNXL PR0: CALL TSTC DB '*' DB 14 CALL EXPR MOV A,L RRC RRC ANI 0C0H STA MODE JMP PR3 CALL TSTC DB '#' DB 7 CALL EXPR MOV C,L JMP PR3 CALL QTSTG JMP PR8 PR3: CALL TSTC DB ',' DB 6 CALL FIN JMP PR0 CALL CRLF CALL DISP CALL FINI PR8: CALL EXPR PUSH B CALL PRTNUM POP B JMP PR3 ; ;GOSUB ; GOSUB: CALL PUSHA CALL EXPR PUSH D CALL FNDLN JNZ AHOW LHLD CURRNT PUSH H LHLD STKGOS PUSH H LXI H,0 SHLD LOPVAR DAD SP SHLD STKGOS JMP RUNTSL ; ;RETURN ; RETURN: CALL ENDCHK LHLD STKGOS MOV A,H ORA L JZ QWHAT SPHL POP H SHLD STKGOS POP H SHLD CURRNT POP D CALL POPA CALL FINI ; ;FOR ; FOR: CALL PUSHA CALL SETVAL DCX H SHLD LOPVAR LXI H,TAB5-1 JMP EXEC ; FR1: CALL EXPR SHLD LOPLMT LXI H,TAB6-1 JMP EXEC ; FR2: CALL EXPR JMP FR4 ; FR3: LXI H,1 FR4: SHLD LOPINC LHLD CURRNT SHLD LOPLN XCHG SHLD LOPPT LXI B,0AH LHLD LOPVAR XCHG MOV H,B MOV L,B DAD SP DB 3EH FR7: DAD B MOV A,M INX H ORA M JZ FR8 MOV A,M DCX H CMP D JNZ FR7 MOV A,M CMP E JNZ FR7 XCHG LXI H,0 DAD SP MOV B,H MOV C,L LXI H,0AH DAD D CALL MVDOWN SPHL FR8: LHLD LOPPT XCHG CALL FINI ; ;NEXT ; NEXT: CALL TSTV JC QWHAT SHLD VARNXT NX0: PUSH D XCHG LHLD LOPVAR MOV A,H ORA L JZ AWHAT CALL COMP JZ NX3 POP D CALL POPA LHLD VARNXT JMP NX0 NX3: MOV E,M INX H MOV D,M LHLD LOPINC PUSH H MOV A,H XRA D MOV A,D DAD D JM NX4 XRA H JM NX5 NX4: XCHG LHLD LOPVAR MOV M,E INX H MOV M,D LHLD LOPLMT POP PSW ORA A JP NX1 XCHG NX1: CALL CKHLDE POP D JC NX2 LHLD LOPLN SHLD CURRNT LHLD LOPPT XCHG CALL FINI NX5: POP H POP D NX2: CALL POPA CALL FINI ; ;REM ; REM: XCHG SHLD ARMM XCHG LXI H,0 JMP IFFR ; ;AREM ; AREM: LHLD ARMM RET ; ; ;CLEAR ; CLEAR: LXI H,VARBGN PUSH D LXI D,27*2 MVI C,0 CALL NULD20 POP D CALL FINI ; ;IF ; IFF: CALL EXPR IFFR: MOV A,H ORA L JNZ RUNSML CALL FNDSKP JNC RUNTSL JMP RSTART ; ;CHYBA VSTUPU ; INPERR: LHLD STKINP SPHL POP H SHLD CURRNT POP D POP D ; ;INPUT ; INPUT: IP1: PUSH D CALL QTSTG JMP IP2 CALL TSTV JC IP4 JMP IP3 IP2: PUSH D CALL TSTV JC QWHAT LDAX D MOV C,A SUB A STAX D POP D CALL PRTSTG MOV A,C DCX D STAX D IP3: PUSH D XCHG LHLD CURRNT PUSH H LXI H,IP1 SHLD CURRNT LXI H,0 DAD SP SHLD STKINP PUSH D MVI B,':' CALL GETLN CALL DBUFF CALL EXPR POP D XCHG MOV M,E INX H MOV M,D POP H SHLD CURRNT CALL CONT POP D IP4: POP PSW CALL TSTC DB ',' DB 3 JMP IP1 CALL FINI DEFLT: LDAX D CPI 0DH JZ LT1 ; ;LET ; LET: CALL SETVAL CALL TSTC DB ',' DB 3 JMP LET LT1: CALL FINI ; ;EXPR VYHODNOCENI VYRAZU ; EXPR: CALL EXPR2 PUSH H EXPR1: LXI H,TAB8-1 JMP EXEC XP11: CALL XP18 RC MOV L,A RET XP12: CALL XP18 RZ MOV L,A RET XP13: CALL XP18 RZ RC MOV L,A RET XP14: CALL XP18 MOV L,A RZ RC MOV L,H RET XP15: CALL XP18 RNZ MOV L,A RET XP16: CALL XP18 RNC MOV L,A RET XP17: POP H RET XP18: MOV A,C POP H POP B PUSH H PUSH B MOV C,A CALL EXPR2 XCHG XTHL CALL CKHLDE POP D LXI H,0 MVI A,1 RET EXPR2: CALL TSTC DB '-' DB 6 LXI H,0 JMP XP26 CALL TSTC DB '+' DB 0 CALL EXPR3 XP23: CALL TSTC DB '+' DB 15H PUSH H CALL EXPR3 XP24: XCHG XTHL MOV A,H XRA D MOV A,D DAD D POP D JM XP23 XRA H JP XP23 JMP QHOW CALL TSTC DB '-' DB 92H XP26: PUSH H CALL EXPR3 CALL CHGSGN JMP XP24 EXPR3: CALL EXPR4 XP31: CALL TSTC DB '*' DB 2DH PUSH H CALL EXPR4 MVI B,0 CALL CHKSGN XTHL CALL CHKSGN XCHG XTHL MOV A,H ORA A JZ XP32 MOV A,D ORA D XCHG JNZ AHOW XP32: MOV A,L LXI H,0 ORA A JZ XP35 XP33: DAD D JC AHOW DCR A JNZ XP33 JMP XP35 CALL TSTC DB '/' DB 4EH PUSH H CALL EXPR4 MVI B,0 CALL CHKSGN XTHL CALL CHKSGN XCHG XTHL XCHG MOV A,D ORA E JZ AHOW PUSH B CALL DIVIDE MOV H,B MOV L,C POP B XP35: POP D MOV A,H ORA A JM QHOW MOV A,B ORA A CM CHGSGN JMP XP31 EXPR4: LXI H,TAB4-1 JMP EXEC XP40: CALL TSTV JC XP41 MOV A,M INX H MOV H,M MOV L,A RET XP41: CALL TSTNUM MOV A,B ORA A RNZ PARN: CALL TSTC DB '(' DB 09 CALL EXPR CALL TSTC DB ')' DB 1 RET JMP QWHAT ; ;RND ; RND: CALL PARN MOV A,H ORA A JM QHOW ORA L JZ QHOW PUSH D PUSH H LHLD RANPNT LXI D,CONTE CALL COMP JC RA1 LXI H,COMP RA1: MOV E,M INX H MOV D,M SHLD RANPNT POP H XCHG PUSH B CALL DIVIDE POP B POP D INX H RET ; ;ABS ; ABS: CALL PARN DCX D CALL CHKSGN INX D RET ; ;SIZE ; SIZE: LHLD TXTUNF PUSH D XCHG LHLD TXTEND CALL SUBDE POP D RET ; ;DIVIE ; DIVIDE: PUSH H MOV L,H MVI H,0 CALL DV1 MOV B,C MOV A,L POP H MOV H,A DV1: MVI C,0FFH DV2: INR C CALL SUBDE JNC DV2 DAD D RET SUBDE: MOV A,L SUB E MOV L,A MOV A,H SBB D MOV H,A RET ; CHKSGN: MOV A,H ORA A RP CHGSGN: MOV A,H ORA L RZ MOV A,H PUSH PSW CMA MOV H,A MOV A,L CMA MOV L,A INX H POP PSW XRA H JP QHOW MOV A,B XRI 80H MOV B,A RET ; CKHLDE: MOV A,H XRA D JP CK1 XCHG CK1: JMP COMP ; ;SETVAL ; SETVAL: CALL TSTV JC QWHAT PUSH H CALL TSTC DB '=' DB 0AH CALL EXPR MOV B,H MOV C,L POP H MOV M,C INX H MOV M,B RET JMP QWHAT ; ;FIN ; FIN: CALL TSTC DB ':' DB 4 POP PSW JMP RUNSML CALL TSTC DB 0DH DB 4 POP PSW JMP RUNNXL RET ; ;ENDCHK ; ENDCHK: CALL IGNB CPI 0DH RZ QWHAT: PUSH D AWHAT: LXI D,WHAT ERROR: SUB A STA MODE CALL PRTSTG CALL DISP POP D LDAX D PUSH PSW SUB A STAX D LHLD CURRNT PUSH H MOV A,M INX H ORA M POP D JZ RSTART MOV A,M ORA A JM INPERR CALL PRTLN DCX D POP PSW STAX D MVI A,3FH CALL OUTC SUB A CALL PRTSTG JMP RSTART QSORRY: PUSH D ASORRY: LXI D,SORRY JMP ERROR ; ;GETLN ; GETLN: MOV A,B CALL OUTC CALL DBUFF GL1: CALL CI CPI 8 JZ GL3 CPI 7FH JZ GL4 CALL OUTC STAX D INX D CPI 0DH RZ MOV A,E CXBUFE: PUSH H LHLD BUFEND CMP L POP H JNZ GL1 GL3: MOV A,E CXBUFA: PUSH H LHLD BUFFER CMP L POP H JZ GL4 CALL GL5 JMP GL1 GL4: CALL CRLF MVI B,'>' JMP GETLN GL5: DCX D MVI A,8 CALL OUTC MVI A,' ' CALL OUTC MVI A,8 JMP OUTC ; ;FNDLN ; FNDLN: MOV A,H ORA A JM QHOW LXI D,TXTBGN FNDLP: PUSH H LHLD TXTUNF DCX H CALL COMP POP H RC LDAX D SUB L MOV B,A INX D LDAX D SBB H JC FL2 DCX D ORA B RET ; ;FNDNXT ; FNDNXT: INX D FL2: INX D FNDSKP: LDAX D CPI 0DH JNZ FL2 INX D JMP FNDLP ; ;PRTSTG ; PRTSTG: MOV B,A PS1: LDAX D INX D CMP B RZ CALL OUTC CPI 0DH JNZ PS1 RET ; ;QTSTG ; QTSTG: CALL TSTC DB '"' DB 0FH MVI A,'"' QT1: CALL PRTSTG CPI 0DH POP H JZ PR6 QT2: INX H INX H INX H PCHL RET ; ;PRTNUM ; PRTNUM: MVI B,0 CALL CHKSGN JP PN1 MVI B,2DH DCR C PN1: PUSH D LXI D,0AH PUSH D DCR C PUSH B PN2: CALL DIVIDE MOV A,B ORA C JZ PN3 XTHL DCR L PUSH H MOV H,B MOV L,C JMP PN2 PN3: POP B PN4: DCR C MOV A,C ORA A JM PN5 MVI A,20H CALL OUTC JMP PN4 PN5: MOV A,B ORA A CNZ OUTC MOV E,L PN6: MOV A,E CPI 0AH POP D RZ ADI 30H CALL OUTC JMP PN6 ; ;PRTLN ; PRTLN: LDAX D MOV L,A INX D LDAX D MOV H,A INX D MVI C,4 CALL PRTNUM MVI A,20H CALL OUTC SUB A CALL PRTSTG RET ; ;MVUP ; MVUP: CALL COMP RZ LDAX D STAX B INX D INX B JMP MVUP ; ;MVDOWN ; MVDOWN: MOV A,B SUB D JNZ MD1 MOV A,C SUB E RZ MD1: DCX D DCX H LDAX D MOV M,A JMP MVDOWN ; ;POPA ; POPA: POP B POP H SHLD LOPVAR MOV A,H ORA L JZ PP1 POP H SHLD LOPINC POP H SHLD LOPLMT POP H SHLD LOPLN POP H SHLD LOPPT PP1: PUSH B RET ; ;PUSHA ; PUSHA: LXI H,STKLMT CALL CHGSGN POP B DAD SP JNC QSORRY LHLD LOPVAR MOV A,H ORA L JZ PU1 LHLD LOPPT PUSH H LHLD LOPLN PUSH H LHLD LOPLMT PUSH H LHLD LOPINC PUSH H LHLD LOPVAR PU1: PUSH H PUSH B RET ; ;CRLF , OUTC ; CRLF: MVI A,0DH OUTC: PUSH PSW CPI 0DH JZ LINEF CALL CO H2: POP PSW RET LINEF: CALL CROUT JMP H2 CROUT: MVI A,0DH CALL CO MVI A,0AH JMP CO ; ;NULOVANI DISPLEJE ; CLS: CALL NULDIS CALL FINI ; ;DIRECT MODUL ; DIRECT: LXI H,TAB1-1 EXEC: CALL IGNB PUSH D EX1: LDAX D INX D CPI '.' JZ EX3 INX H CMP M JZ EX1 MVI A,0 DCX D CMP M JZ EX5 EX2: INX H CMP M JNZ EX2 INX H INX H POP D JMP EXEC EX3: MVI A,0 EX4: INX H CMP M JNZ EX4 EX5: INX H MOV A,M INX H MOV H,M MOV L,A POP PSW PCHL ; ;DBUFF ; DBUFF: PUSH H LHLD BUFFER MOV D,H MOV E,L POP H RET DTXTE: PUSH H LHLD TXTEND MOV D,H MOV E,L POP H RET ; ;MASKA ; MASK: CALL EXPR MOV A,L STA MASKIN CALL FINI ; ;RAM ; RAM: CALL EXPR XCHG LXI H,TXTE XCHG CALL COMP JC ASORRY MOV A,H ORA A JM ASORRY MOV A,M CMA MOV M,A MOV B,M CMP B JNZ ASORRY SHLD BUFEND MOV A,L SUI 64 MOV L,A MOV A,H SBI 0 MOV H,A SHLD BUFFER DCX H DCX H JMP START1 ; ;CALL ; BCALL: CALL EXPR PUSH D LXI B,HERE PUSH B PCHL HERE: POP D CALL FINI ; ;OUT ; BOUT: CALL EXPR PUSH H CALL TSTC DB ',' DB 1AH CALL EXPR MOV B,L MVI A,0D3H STA IOBUFA POP H MOV A,L STA IOBUFB MVI A,0C9H STA IOBUFC MOV A,B CALL IOBUFA CALL FINI JMP QWHAT ; ;WAIT ; WAIT: CALL EXPR PUSH D WAIT1: MVI H,100 CALL WAIT2 DCR L JNZ WAIT1 POP D CALL FINI ; ;BEEP ; BEEP: CALL EXPR PUSH D BEEP1: XCHG CALL PIPO10 POP D CALL FINI WAIT2: MVI D,64H WAIT3: DCR D JNZ WAIT3 DCR H RZ JMP WAIT2 ; ;TAB ; TAB: CALL PARN A1: MOV A,H ORA L CZ FINI DCX H MVI A,20H CALL CO JMP A1 ; ;IN , INM ; BIN: CALL INEM MOV L,A RET INM: CALL INEM MOV L,A LDA MASKIN ANA L MOV L,A RET INEM: CALL PARN PUSH H MVI A,0DBH STA IOBUFA POP H MOV A,L STA IOBUFB MVI A,0C9H STA IOBUFC CALL IOBUFA MVI H,0 RET ; ;O$ ; O: CALL EXPR PUSH D XCHG XRA A CALL PRTSTG ZZZ4: POP D CALL FINI ; ;I$ ; I: CALL EXPR PUSH D XCHG LHLD TXTUNF XCHG CALL COMP JC ASORRY CALL DBUFF CALL GL1 MOV B,H MOV C,L XCHG DCX H CALL DBUFF PUSH D CALL MVUP XRA A STAX B POP D INX H CALL SUBDE XCHG LXI H,LEGT MOV M,E INX H MOV M,D JMP ZZZ4 ; ;PEEK ; PEEK: CALL PARN MOV L,M MVI H,0 RET ; ;POKE ; POKE: CALL EXPR PUSH H CALL TSTC DB ',' DB 9 CALL EXPR MOV A,L POP H MOV M,A CALL FINI JMP QWHAT ; ;BYTE ; BYTE: CALL PARN MOV A,L CALL WRIT2 CALL FINI ; ;WORD ; WORD: CALL PARN CALL PRHL CALL FINI ; WRIT2: PUSH PSW RRC RRC RRC RRC CALL IST POP PSW IST: ANI 0FH ADI 90H DAA ACI 40H DAA JMP OUTC ; ;QUOTE ; QUOTE: LDAX D INX D MOV L,A MVI H,0 CALL TSTC DB 27H DB 1 RET JMP QWHAT ; ;OUTCHAR ; OUTCHR: CALL EXPR MOV A,L CALL CO CALL FINI ; ;INCHAR ; INCHAR: CALL CI MVI H,0 MOV L,A RET ; ;HEX ; HEX: PUSH B LXI H,0 CALL TSTC DB '(' DB 1DH HNXTH: LDAX D CPI 0DH JZ QWHAT CALL NIBBLE JC QWHAT DAD H DAD H DAD H DAD H MVI B,0 MOV C,A DAD B INX D CALL TSTC DB ')' DB 3 JMP POPRET JMP HNXTH JMP QWHAT POPRET: POP B RET ; ;TEST TLACITKA BREAK ; CONT: LDA 2800H RLC RC JMP BREAK STOP: CALL ENDCHK BREAK: LHLD CURRNT XCHG CALL CRLF MVI A,'*' CALL OUTC CALL PRTLN JMP RSTART ; ;******************************************* ; ; KAZETOVY MAGNETOFON , TISKARNA ; ;***************************************** LOAD: MVI A,38H OUT 10H MVI A,0FFH OUT 11H LOAD40: IN 12H MVI B,0 LOAD30: IN 11H ANI 80H JNZ LOAD40 LOAD10: MOV A,B CPI 0FFH JZ LOAD20 CALL SEC1 MVI B,0FFH JMP LOAD30 LOAD20: MVI A,'*' CALL CO CALL PIN CPI 'B' JNZ LOAD40 MVI B,0 CALL PIN LOAD5: CALL CO CALL PIN CPI 0DH JNZ LOAD5 CALL PIN MOV E,A CALL PIN MOV D,A LXI H,TXTBGN LOAD4: CALL COMP JZ LOAD3 CALL PIN MOV M,A INX H JMP LOAD4 LOAD3: MOV C,B CALL PIN CMP C JNZ TPERR SHLD TXTUNF JMP SAVE3 SEC1: MVI L,20 DB 11H SEC3: MVI L,110 SEC31: MVI H,100 CALL WAIT2 DCR L JNZ SEC31 RET ; ; ; TOUT: PUSH PSW ADD B MOV B,A POP PSW OUT 12H TOUT1: IN 11H ANI 40H JZ TOUT1 RET ; ; ; PIN: IN 11H ANI 80H JZ PIN IN 12H PUSH PSW ADD B MOV B,A POP PSW RET ; ;SAVE ; SAVE: CALL LABEL LHLD TXTUNF MOV A,L CALL TOUT MOV A,H CALL TOUT XCHG LXI H,TXTBGN SAVE1: CALL COMP JZ SAVE2 MOV A,M CALL TOUT INX H JMP SAVE1 SAVE2: MOV A,B CALL TOUT CALL SEC1 SAVE3: MVI A,10H OUT 10H JMP RSTART ; ;TAPE ERROR ; TPERR: CALL CRLF LXI D,TPER SUB A CALL PRTSTG JMP RSTART TPER: DB 'ERROR',0 ; ;VSTUP LABELU ; LABEL: LXI D,TLAB SUB A CALL PRTSTG MVI B,'=' CALL GETLN MVI A,30H OUT 10H MVI A,0FFH OUT 11H CALL SEC3 MVI A,'B' CALL TOUT CALL DBUFF MVI B,0 LAB1: LDAX D PUSH PSW CALL TOUT POP PSW CPI 0DH RZ INX D JMP LAB1 TLAB: DB 'NAME ',0 ; ;PREVIJENI KAZETY ; REWIND: MVI A,38H OUT 10H REW10: CALL CI JMP SAVE3 ; ;VYSTYP NA TISKARNU ; COP: CALL OUTDIS PUSH H LXI H,2C00H MOV M,A PUSH PSW DCX H MVI M,1 INX H ZZZ1: MOV A,M ANI 40H JZ ZZZ1 DCX H MVI M,3 INX H ZZZ2: MOV A,M ANI 40H JNZ ZZZ2 DCX H MVI M,1 POP PSW POP H RET ; ;ZMENA VYSTUPU ; PRNTST: LXI H,COP ZZZ3: SHLD CO+1 RET ; DISP: MVI A,0C3H STA CO LXI H,OUTDIS JMP ZZZ3 ; ;MIKRO BASIC JPR-1 ;******************************************** ; ; DISPLEJ JPR-1 ; ;******************************************** ; ;ZRUSENI UKAZATELE ; OUTDIS: PUSH PSW PUSH H PUSH D PUSH B MOV C,A CALL SESTAV LDA MODE MOV B,A MOV A,M ANI 0C0H CPI 80H JNZ OUTD1 MOV A,B ORA A JNZ OUTD1 MOV A,M ANI 7FH MOV M,A ; ;CR, LF, BS A ULOZENI ZNAKU ; OUTD1: MOV A,C CPI 0DH JZ CRDS CPI 08H JZ BACK CPI 0AH JZ LFDS ANI 3FH MOV E,A MOV A,B ORA E MOV M,A ANI 0C0H CPI 0C0H CZ IPOZ CALL IPOZ ; ;NAVRAT ; ; ;OBNOVENI UKAZATELE ; OUTD10: LDA MODE ORA A JNZ ZZZ13 CALL SESTAV MOV A,M ORI 80H MOV M,A ZZZ13: POP B POP D POP H POP PSW RET ; ;CURSOR ZPET ; BACK: LDA POZICE DCR A CPI 0FFH JZ BACK10 STA POZICE JMP OUTD10 BACK10: LDA RADEK DCR A CPI 0FFH JZ NULD30 STA RADEK MVI A,39 STA POZICE JMP OUTD10 ; ;INKREMENT POZICE NA RADKU ; IPOZ: LDA POZICE INR A STA POZICE CPI 40 RC XRA A STA POZICE ; ;INKREMENT RADKU ; IRAD: LDA RADEK INR A CPI 24 JZ ROLDIS JMP ZZZ5 ; ;NULOVANI DISPLEJE ; NULDIS: PUSH PSW PUSH H PUSH D PUSH B NULD30: LXI H,3800H LXI D,2048 CALL NULD10 CALL HOME JMP OUTD10 ; NULD10: MVI C,20H NULD20: MOV M,C INX H DCX D MOV A,D ORA E JNZ NULD20 RET ; ;CR ; CRDS: XRA A STA POZICE JMP OUTD10 ; ;LF ; LFDS: CALL IRAD JMP OUTD10 ; ;ROLOVANI DISPLEJE ; ROLDIS: LXI H,3800H LXI D,3840H MVI C,23 MOVS: CALL MOVR PUSH B LXI B,18H DAD B XCHG DAD B XCHG POP B DCR C JNZ MOVS LXI H,3DC0H LXI D,64 JMP NULD10 MOVR: MVI B,28H MOVZ: LDAX D MOV M,A INX D INX H DCR B JNZ MOVZ RET ; ;SESTAVENI ADRESY CURSORY DO H,L ; SESTAV: MVI H,0 LDA RADEK MOV L,A MVI B,6 SES10: DAD H DCR B JNZ SES10 LDA POZICE ORA L MOV L,A MOV A,H ORI 38H MOV H,A RET ; ;HOME ; HOME: XRA A STA POZICE ZZZ5: STA RADEK RET ;MIKRO BASIC JPR-1 ;******************************************** ; ; KLAVESNICE JPR-1 ; ;******************************************** ; ;ZACATEK ; CI: PUSH B PUSH D PUSH H ZZZ9: CALL ZZZ6 CPI ' ' ;SPACE JC ZZZ7 CPI 60H JNC ZZZ7 ZZZ8: POP H POP D POP B RET ; ZZZ7: CPI 127 ; DEL JZ ZZZ8 CPI 0DH ; CR JZ ZZZ8 CPI 8 ; BS JZ ZZZ8 CPI 'A'+20H JC ZZZ9 CPI 'Z'+20H+1 JNC ZZZ9 SUI 20H JMP ZZZ8 ; ZZZ6: LXI H,27FFH MVI M,2 ZZZ10: MOV A,M RRC JC ZZZ10 INX H MOV A,M CMA ANI 127 PUSH PSW DCX H MVI M,3 ZZZ11: MOV A,M RRC JNC ZZZ11 MVI M,2 POP PSW RET ; ZZZ12: JNZ PIPO10 MVI A,2 STA 2400H RET ; ORG 0E4AH ; ; PIPNUTI ; PIP: PUSH B LDA PORT24 MVI A,0 STA 2400H MVI C,42H PIP20: DCR C JNZ PIP20 ANI 0B0H STA 0 MVI C,50H PIP30: DCR C JNZ PIP30 POP B RET ; ; ZAPIPANI ; PIPO: LXI D,40H PIPO10: CALL PIP DCX D MOV A,D ORA E JMP ZZZ12 RET ; ;*************************************** ; ; MIKRO MONITOR JPR-1 ; ;*************************************** ; PRHL: MOV A,H CALL WRIT2 MOV A,L JMP WRIT2 ; ;VSTUP HEXA ADRESY ; MEXPR: LXI H,0 MEXO: CALL CI MOV C,A CALL CO MEX1: CALL NIBBLE JC MEX2 DAD H DAD H DAD H DAD H ORA L MOV L,A JMP MEXO NIBBLE: SUI '0' RC CPI 'G'-'0' CMC RC CPI 10 CMC RNC SUI 'A'-'9'-1 CPI 10 RET MEX2: MOV A,C CPI 0DH JZ ECHU CPI 20H RZ EROR: MVI A,'?' CALL CO JMP MLOOP ECHU: PUSH PSW MVI A,0AH CALL CO POP PSW MOV C,A RET ;VYPOCET DELKY INSTRUKCE ; LENG: MVI B,0 PUSH H POP D MOV A,M CPI 0C3H JZ B3 CPI 0CDH JZ B3 ANI 0EFH CPI 22H JZ B3 CPI 2AH JZ B3 ANI 0CFH CPI 1 JZ B3 ANI 0C7H CPI 0C2H JZ B3 CPI 0C4H JZ B3 MOV A,M ANI 0F7H CPI 0D3H JZ B2 ANI 0E7H ANI 0C7H CPI 6 JZ B2 CPI 0C6H JZ B2 JMP B1 B3: INR B B2: INR B B1: INR B XCHG RET ; ;ZACATEK MONITORU ; MONIT1: CALL NULDIS MONIT: LXI SP,STACK MLOOP: CALL CROUT LXI D,TXMON SUB A CALL PRTSTG CALL CROUT MVI A,'*' CALL CO CALL CI CALL CO CPI 'D' JZ ENTER CPI 'S' JZ SUEX CPI 'G' JZ GOEX CPI 'B' JZ START CPI 'R' JZ RSTART JMP EROR ; SUEX: LXI H,MLOOP PUSH H GOEX: CALL MEXPR PCHL ; ENTER: CALL MEXPR ; LOOP: CALL CROUT ; LOOPA: CALL PRHL CALL LENG PUSH B PUSH H LOOP1: MVI A,' ' CALL CO MOV A,M CALL WRIT2 INX H DCR B JNZ LOOP1 POP D POP B MVI A,4 SUB B MOV B,A RLC ANI 0FH ADD B MOV B,A LPP: MVI A,' ' CALL CO DCR B JNZ LPP ; ;VYPIS ASCII ; MVI A,':' CALL CO LDAX D ANI 7FH CPI 20H JC CONTM CPI 7FH JNZ CONT1 CONTM: MVI A,' ' CONT1: CALL CO MVI A,':' CALL CO LOOP2: CALL CI MOV C,A CALL CO CPI 08 JZ BACKGO CPI ' ' JZ LPPA CPI 0DH JZ LOOP CPI '.' JZ MLOOP CPI '"' JZ TEXT PUSH H LXI H,0 CALL MEX1 MOV B,A MOV A,L STAX D INX D MOV A,B POP H CPI ' ' JZ LOOP2 CPI 0DH JNZ EROR XCHG JMP LOOPA ; ; BACKGO: DCX D XCHG JMP LOOP ; LPPA: XCHG INX H JMP LOOP ; TEXT: CALL CI CALL CO CPI '"' JZ CONTE MOV C,A STAX D LDAX D CMP C JNZ EROR INX D JMP TEXT ; CONTE: CALL CI CPI ' ' JZ LOOP2 XCHG JMP LOOP ; DB 31H ;VERZE 03-01 ; ;********************************************* ; ; DEFINICE RAM ; ;********************************************* ; ORG 2000H ; PORT24: DS 1 LEGT: DS 2 IOBUFA: DS 1 IOBUFB: DS 1 IOBUFC: DS 1 LISTC: DS 1 CO: DS 3 MASKIN: DS 1 CURRNT: DS 2 STKGOS: DS 2 VARNXT: DS 2 STKINP: DS 2 LOPVAR: DS 2 LOPINC: DS 2 LOPLMT: DS 2 LOPLN: DS 2 LOPPT: DS 2 RANPNT: DS 2 ARMM: DS 2 RADEK: DS 1 POZICE: DS 1 MODE: DS 1 TXTUNF: DS 2 DS 40 STKLMT: DS 2 DS 97 STACK: DS 2 VARBGN: DS 54 TXTEND: DS 2 BUFFER: DS 2 BUFEND: DS 2 TXTBGN: DS 2 DS 698 TXTE: DS 2 BUFA: DS 64 BUFE: DS 1 BRST: DS 18 ; END
ÚVOD | Novinky | 8 Bitů | Příslušenství | Drobnosti | TTL | Kontakt
SAPI-1 | ONDRA | PMI-80 | PMD-85 | klony PMD-85 | klony SM50/40 | PETR | PLAN-80A | IQ151 | TNS | FK-1 | HVĚZDA | SP 830 | PCS 1-QR6000
ZPS | Technické prostředky | Programové vybavení | Dokumentace