Ú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
TITLE 'PLAN80A TINY BASIC V3Q' ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ;X X ;X X ;X PLAN-80A V.3.Q 27.09.88 X ;X X ;X T I N Y B A S I C X ;X X ;X X ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ;************************************************* ; ; ZAKLADNI ADRESY ; UZIRAM EQU 0006H ; ZACATEK UZIVATELSKE RAM RAMEND EQU 0004H ; ADR. OBSAHUJICI KONEC RAM BASIC EQU 0E000H ; POCATECNI ADRESA TINY BASICU TCLOSE EQU 0F028H ; UZAVRI SOUBOR JOIN0 EQU 0F004H ; INICIUJ MAGNETOFON ADRTPR EQU 0F000H ; POCATECNI ADRESA PROGRAMU MAGNETOFONU ; ; SPOJOVACI ADRESY NA MONITOR ; CI EQU 0F803H ; VSTUP Z KONZOLY (A) COM EQU 0F809H ; VYSTUP NA KONZOLU (C) RI EQU 0F806H ; VSTUP ZE SNIMACE (MAGNETOFONU) (A) PO EQU 0F80CH ; VYSTUP NA DEROVAC (MAGNETOFON) (C) LO EQU 0F80FH ; VYSTUP NA TISKARNU (C) CSTS EQU 0F812H ; STAV KONZOLY (A) MEMCHK EQU 0F81BH ; KONEC UZIVATELSKE RAM (B,A) NEXTM EQU 0F839H ; TEPLY START MONITORU SPACE EQU 0F83CH ; ZOBRAZ MEZERU DADR EQU 0F830H ; VYPIS (HL) JAKO ASCII DBYTE EQU 0F833H ; VYPIS (A) JAKO ASCII ASHEX EQU 0F82DH ; ASCII NA HEX NIBBLE ADRKUR EQU 0F845H ; ADRESA KURZORU (HL) TIMER EQU 0F84BH ; PODPROGRAM CEKANI <BC> MS ; ; DEFINICE KONSTANT ; CR EQU 0DH ; CR LF EQU 0AH ; LF CTRLC EQU 03H ; CTRL C CTRLX EQU 18H ; CTRL X CTRLD EQU 04H ; CTRL D CTRLY EQU 19H ; CTRL Y CTRLS EQU 13H ; CTRL S DOWN EQU 18H ; SIPKA DOLU LEFT EQU 08H ; SIPKA VLEVO RIGHT EQU 04H ; SIPKA VPRAVO RUB EQU 7FH ; VYMAZ (DEL) SUBS EQU 1AH ; SUB BS EQU 08H ; ZPETNY POSUV KILO EQU 512 ; KONSTANTA PRO RAM < 1 KBYTE FF EQU 0CH ; NOVA STRANKA BELL EQU 07H ; ZVONEK ESC EQU 1BH ; CTRL [ HOME EQU 1DH ; LEVY HORNI ROH OBRAZOVKY DL EQU 1EH ; VYMAZ RADKY DSCR EQU 1FH ; VYMAZ OBRAZOVKY SUBS EQU 1AH ; CTRL Z LINECO EQU 35H ; CITAC LINEK KEYTPR EQU 55H ; PRIZNAK MAGNETOFONU ; ;************************************************* ; .PHASE BASIC ; BASPET: JMP START ; STUDENY START BASIC JMP RSTART ; TEPLY START BASIC ; INTSTA: INX SP ; START PO BREAKU - RST 7 INX SP ; OBNOVENI SP JMP RSTART ; TOP: LHLD TXTUNF INX H RET ; LENGHT: LHLD LEGT DCX H RET ; BEND: CALL ENDCHK JMP RSTART ; ; START ; START: DI LHLD RAMEND ; KONEC PROGRAMOVE RAM V <HL> DCX H DCX H SPHL ; NASTAV SP CALL DISP ; CO:=CO XRA A ; A:=0 STA MODE ; FORMAT ZNAKU:= OBYCEJNY LXI D,MSG1 CALL PRTSTG ; OHLASENI BASICU LXI H,TXTBGN SHLD TXTUNF ; INICIACE UKAZATELE KONCE PROGRAMU CALL USREND ; V <HL> KONEC UZIVATELSKE OBLASTI RAM JMP RAM1 ; NASTAV RAM V BASICU START1: SHLD TXTEND ; ; RSTART - PRIHRATY START ; RSTART: CALL CRLF RSTAR1: LHLD RAMEND DCX H DCX H ; V <HL> (KONEC PROGRAMOVE RAM -2) SPHL ; NASTAV SP MVI A,0C3H ; OBSLUHA RST 7 TO RAM STA RST7RA LXI H,INTSTA SHLD RST7RA+1 LXI D,OK ; DE:=ADR TEXTU 'READY' SUB A ; A:=0 STA MODE CMA ; A:=0FFH STA MASKIN CALL PRTSTG ; 'READY' NA OBRAZOVKU LXI H,ST2+1 SHLD CURRNT ST2: LXI H,0 SHLD LOPVAR ; POINTER PRO 'FOR':=0 SHLD STKGOS ST3: MVI B,5CH ; 5CH JAKO PROMT NA ZACATKU RADKU CALL GETLN ; PREVEZMI RADEK BASIC Z KLAVESNICE ST5: PUSH D ; V <DE> ADRESA POSL. ZNAKU + 1 CALL DBUFF ; V <DE> ADRESA BUFFERU CALL TSTNUM ; VSTUP CISLA DO <HL>, V <DE> ADR. DAL. ZN. CALL IGNB ; VYNECH MEZERY MOV A,H ORA L ; JE CISLO NULOVE POP B ; V <BC> ADRESA POSL. ZNAKU + 1 JZ DIRECT ; PRI NULOVEM CISLE PROVED IHNED DCX D MOV A,H STAX D DCX D MOV A,L STAX D ; ZAPIS CISLO RADKU BINARNE EDIST: PUSH B PUSH D MOV A,C SUB E PUSH PSW ; V <A> POCET ZNAKU CALL FNDLN ; NAJDI ADRESU RADKU <HL> PUSH D JNZ ST4 ; TAKOVY RADEK JESTE NENI - SKOC PUSH D CALL FNDNXT ; NAJDI ADRESU DALSIHO RADKU POP B LHLD TXTUNF ; V <HL> ADRESA KONCE PROGRAMU CALL MVUP ; STARY RADEK ZNIC MOV H,B MOV L,C SHLD TXTUNF ; NOVY KONEC PROGRAMU ST4: POP B LHLD TXTUNF POP PSW ; V <A> POCET ZNAKU PUSH H CPI 3 ; PRAZDNY RADEK ? JZ RSTART ; ANO - RESTART ADD L MOV L,A MVI A,0 ADC H MOV H,A ; NOVY KONEC PROGRAMU V <HL> CALL DTXTE ; MAXIMALNI ADRESA V <DE> CALL COMP ; PRETECENI ? JNC QSORRY ; ANO - CHYBA SHLD TXTUNF ; NOVY KONEC PROGRAMU V <HL> POP D ; ADRESA RADKU V <DE> CALL MVDOWN ; VLOZ RADEK POP D POP H CALL MVUP JMP ST3 ; ; ZJISTENI KONCE UZIVATELSKE OBLASTI PAMETI RAM ; USREND: PUSH B CALL MEMCHK MOV H,B MOV L,A DCX H POP B RET ; MSG1: DB ' TINY BASIC V3Q',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 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 'PUT',0 DW PUT DB 'CLOSE',0 DW CLOSE DB 'INIT',0 DW INIT DB 'PLOT',0 DW PLOT DB 'DRAW',0 DW DRAW DB 'MOVE',0 DW MOVE DB 'CURS',0 DW CURS DB 'EDIT',0 DW EDIT 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 ; UVOZOVKA ' DW QUOTE DB 'TOP',0 DW TOP DB 'AREM',0 DW AREM DB 'LEN',0 DW LENGHT DB 'GET',0 DW GET 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> ; <HL> < <DE> ... CARRY ; <HL> = <DE> ... ZERO ; COMP: MOV A,H CMP D RNZ MOV A,L CMP E RET ; ; IGNB VYNECHANI MAEZER PODLE <DE> ; IGNB: LDAX D CPI ' ' 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+3. JE-LI SHODNY POKRACUJE ; SE NA CALL+5, JINAK NA ADRESE CALL+N+2. ; N JE NA ADRESE CALL...+4 ; 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 ; NA BINARNI CISLO V <HL>, V <DE> ADRESA DALSIHO ZNAKU. ; TSTNUM: LXI H,0 MOV B,H CALL IGNB ; VYNECH MEZERY TN1: CPI '0' ; NULA ? 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?',CR OK: DB 'READY',CR WHAT: DB 'WHAT?',CR SORRY: DB 'SORRY',CR ; ; 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 ; NORMALNI ZNAK 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 CR 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 ; JDE O ":" ? DB ':' DB 9 CALL CRLF ; ANO - VICENASOBNY PRIKAZ CALL DISP JMP RUNSML PR1: CALL TSTC ; JDE O CR ? DB CR DB 9 CALL CRLF ; ANO - KONEC PRIKAZU PR6: CALL DISP JMP RUNNXL PR0: CALL TSTC ; JDE O "*" ? DB '*' DB 14 CALL EXPR ; ANO - VSTUP PARAMETRU ZOBRAZENI MOV A,L RRC RRC ANI 0C0H STA MODE ; NASTAV REZIM ZOBRAZENI (0-NORM, 1-INVER) JMP PR3 CALL TSTC ; JDE O "#" ? DB '#' DB 7 CALL EXPR ; ANO - VSTUP PARAMETU IND. PROMENNE MOV C,L JMP PR3 CALL QTSTG JMP PR8 PR3: CALL TSTC ; JDE O "," ? DB ',' DB 6 CALL FIN ; ANO - DALSI ARGUMENT JMP PR0 CALL CRLF CALL DISP CALL FINI PR8: CALL EXPR ; ZOBRAZ CISLO 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,LF 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,LF 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,54 NULD20: MVI M,0 ; ZAPLN PROSTOR PRO PROMENNE 0 INX H DCX D MOV A,D ORA E JNZ 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 ; VYTISKNI NA OBRAZOVKU ':' ; A PREVZEMI Z KLAVESNICE RADEK CALL DBUFF ; DE:=ADR. ZACATKU RADKU S REAKCI ; NA INPUT LDAX D ; A:=PRVNI ZNAK REAKCE CPI ESC ; IF <>ESC THEN JNZ NOBRK ; VYHODNOCENI VYRAZU POP D ; ELSE OBNOV DE XCHG ; HL:=DE MOV M,E ; ULOZ INX H MOV M,D POP H ; HL:=CURRNT SHLD CURRNT ; ULOZ JMP BREAK1 ; BREAK NOBRK: CALL EXPR ; VYHODNOCENI VYRAZU 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 CR 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 ; ; ; ; GENERATOR NAHODNICH CISEL ; ; PRO PRACI POUZIVA PARAMETR RANPNT. PRINCIPEM CINNOSTI ; JE GENERACE TOHOTO PARAMETRU NACITANIM OBLASTI PAMETI, ; V NIZ JE NAHRAN INTERPRET. NAHODNA HODNOTA JE ZBITKEM ; PO DELENI PARAMETRU RANPNT UDANOU MAXIMALNI HODNOTOU. ; RND: CALL PARN ; HL:=MAX. HODNOTA MOV A,H ORA A JM QHOW ; IF ZAPORNA ERROR ORA L PUSH D INX H PUSH H JNZ RA2 ; IF 0 --> INICIUJ LXI H,BASPET SHLD RANPNT RA2: LHLD RANPNT ; PARAMETR LXI D,MONIT CALL COMP ; PARAMETR MIMO INTERPRET ? JC RA1 LXI H,BASPET ; ANO - INICIUJ RA1: MOV E,M INX H MOV D,M SHLD RANPNT ; NOVY PARAMETR POP H ; MAX. HODNOTA DO <DE> XCHG ; PSEUDONAHODNE CISLO DO <HL> PUSH B CALL DIVIDE ; <HL>/<DE> ... ZBITEK V <HL> POP B POP D 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 <HL>/<DE> --> <BC>, ZBITEK V <HL> ; 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 ; ZMENA ZNAMENKA ORA L RZ ; CISLO JE NULA ! MOV A,H PUSH PSW CMA MOV H,A ; INVERZE HIGH BYTE MOV A,L CMA MOV L,A ; INVERZE LOW BYTE INX H ; PRICTENI 1 POP PSW XRA H JP QHOW ; PRETECENI MOV A,B XRI 80H ; INVERZE D7 V <B> 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 LF 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 CR DB 4 POP PSW JMP RUNNXL RET ; ; ENDCHK ; ENDCHK: CALL IGNB CPI CR RZ QWHAT: PUSH D AWHAT: LXI D,WHAT ERROR: SUB A STA MODE ; NORMALNI ZOBRAZENI 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,03FH CALL OUTC SUB A CALL PRTSTG JMP RSTART QSORRY: PUSH D ASORRY: LXI D,SORRY JMP ERROR ; ; ; ; GETLN ; ; ULOZ RADEK DO BUFFERU, V <DE> ADRESA POSLRNIHO ZNAKU + 1 ; GETLN: MOV A,B ; VYTISKNI (B) - VESMES 5CH CALL OUTC CALL DBUFF ; DE:=UKAZATEL NA ZACATEK ; VYROVNAVACI PAMETI RADKU GL1: CALL CI ; A:= ZNAK Z KLAVESNICE CPI ESC JZ GL1 ; IGNORUJ ZNAK ESC CPI RUB ; IF RUB OUT THEN JZ GL3 ; OPRAV POSLEDNI ZNAK CPI BS ; IF BACK SPACE THEN JZ GL3 ; OPRAV POSLEDNI ZNAK CPI CTRLX ; IF CTRL X THEN JZ GL4 ; ZRUS RADEK CALL OUTC ; ECHO ZNAK NA OBRAZOVKU STAX D ; ULOZ ZNAK DO VYROVNAVACI PAMETI ; RADKU INX D ; INKREMENTUJ UKAZATEL VYROVNAVACI ; PAMETI RADKU CPI CR ; IF POSLEDNI ZNAK (CR) THEN RZ ; NAVRAT MOV A,E ; ELSE A:=NIZSI BYTE UKAZATELE ; VYROVNAVACI PAMETI RADKU CXBUFE: PUSH H ; USCHOVEJ HL LHLD BUFEND ; HL:=ADR. KONEC VYROVNAVACI ; PAMETI RADKU CMP L ; IF UKAZATEL VYROVNAVACI PAMETI <> ; ADR. KONCE RADKU THEN POP H ; OBNOV HL JNZ GL1 ; PREVEZMI DALSI ZNAK Z KLAVESNICE ; ELSE OPRAVUJ POSLEDNI ZNAK A CEKEJ ; NA (CR) ; OPRAV POSLEDNI ZNAK GL3: MOV A,E ; A:=NIZSI BYTE UKAZATELE VYROVNAVACI ; PAMETI RADKU CXBUFA: PUSH H ; USCHOVEJ HL LHLD BUFFER ; HL:=ADR. ZACATKU VYROVNAVACI PAMETI ; RADKU CMP L ; IF UKAZATEL NA ZACATKU VYROV. PAMETI POP H ; THEN OBNOV HL JZ GL4 ; NASTAV ZACATEK RADKU CALL GL5 ; ELSE ZRUS POSLEDNI ZNAK JMP GL1 ; PREVEZMI DALSI ZNAK Z KLAVESNICE ; ZRUS RADEK GL4: CALL CRLF ; VYTISKNI NA OBRAZOVKU (CR),(LF) MVI B,5CH ; VYTISKNI 5CH JMP GETLN ; PREVEZMI Z KLAVESNICE NOVY RADEK ; OPRAV POSLEDNI ZNAK GL5: DCX D ; DEKREMENTUJ UKAZATEL VYROVNAVACI ; PAMETI RADKU NA POSLEDNI ; PLATNY ZNAK MVI A,8 ; A:=BACK SPACE CALL OUTC ; POSUN KURZORU O 1 MISTO VLEVO MVI A,' ' ; A:=MEZERA CALL OUTC ; VYTISKNI NA MISTO NEPLATNEHO ZNAKU ; MEZERU MVI A,8 ; POSUN KURZORU ZPET NA MEZERU JMP OUTC ; NAVRAT RETURNEM Z OUTC ; ; ; ; FNDLN ; ; NAJDI ADRESU RADKU S CISLEM <HL> A ULOZ JI DO <DE> ; NASTAV PRIZNAK FF-Z PRI ROVNOSTI. FF-C PRI NEEXISTENCI ; 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 ; ; NAJDI KONEC RADKU, DO <HL> ULOZ ADRESU DALSIHO RADKU ; FNDNXT: INX D FL2: INX D FNDSKP: LDAX D CPI CR JNZ FL2 INX D JMP FNDLP ; ; PRTSTG ; PRTSTG: MOV B,A PS1: LDAX D INX D CMP B RZ CALL OUTC CPI CR JNZ PS1 RET ; ; QTSTG ; QTSTG: CALL TSTC DB '"' DB 0FH MVI A,'"' QT1: CALL PRTSTG CPI CR 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 ; PREVOD BIN --> DEC 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 LF POP D RZ ADI 30H CALL OUTC JMP PN6 ; ; ; ; PRTLN ; ; ZOBRAZ RADEK VCETNE CISLA, V <DE> ADRESA LOW CISLA RADKU ; 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 ; ; POSUN PAMETI OD <DE> PO <HL> NA <BC> (DOPREDU) ; MVUP: CALL COMP RZ LDAX D STAX B INX D INX B JMP MVUP ; ; ; ; MVDOWN ; ; POSUN PAMET Z <DE> PO <BC> NA <HL> (POZPATKU) ; 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: PUSH D ; USCHOVEJ DE LHLD RAMEND LXI D,0FFC4H ; DVOJKOVY DOPLNEK (64-5) DAD D ; HL:=KONEC STACKU +5 POP D ; OBNOV DE CALL CHGSGN ; ZMEN ZNAMENKO <HL> POP B DAD SP ; PREKROCENI ZASOBNIKU? JNC QSORRY ; ANO - CHYBA LHLD LOPVAR MOV A,H ORA L JZ PU1 ; JDE O CYKLUS ? LHLD LOPPT PUSH H LHLD LOPLN PUSH H LHLD LOPLMT PUSH H LHLD LOPINC PUSH H LHLD LOPVAR PU1: PUSH H ; ULOZ PARAMETRY PROMENNE PUSH B RET ; ; CRLF , OUTC ; CRLF: MVI A,CR OUTC: PUSH PSW CPI CR JZ LINEF CALL CO H2: POP PSW RET LINEF: CALL CROUT JMP H2 CROUT: MVI A,CR CALL CO MVI A,LF JMP CO ; ; NULOVANI DISPLEJE ; CLS: PUSH B MVI A,FF CALL CO MVI A,HOME CALL CO MVI A,DSCR CALL CO POP B 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 ; 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 ; VSTUP PARAMETRU DO <HL> RAM1: XCHG ; SCHOVEJ <HL> DO <DE> LXI H,TXTE ; MINIMALNI ADRESA KONCE PROGRAMU CALL COMP JNC ASORRY ; CHYBA V PODTECENI MOZNE PROGRAMOVE RAM CALL USREND ; MAXIMALNI ADRESA KONCE PROGRAMU CALL COMP JC ASORRY ; CHYBA V PRETECENI MOZNE PROGRAMOVE RAM XCHG ; OBNOV <HL> SHLD BUFEND ; NASTAVENI KONCE BUFFERU LXI D,0FFC0H ; DNOJKOVY DOPLNEK 64 DAD D ; PRO BUFFER VYHRAZENO 64 BYTE SHLD BUFFER ; NASTAVENI UKAZATELE ZACATKU BUFFERU 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 ; ; ; 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 DADR CALL FINI ; ; ; ; WRIT2 ; 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: LXI H,0 CALL CSTS RZ CALL CI MOV L,A RET ; ; HEX ; HEX: PUSH B LXI H,0 CALL TSTC DB '(' DB 1DH HNXTH: LDAX D CPI CR JZ QWHAT CALL ASHEX 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: CALL CSTS ; IF KLAVESA VESTISKNUTA ORA A ; THEN POKRACUJ RZ CALL CI CPI CTRLC ; IF <> CTRL-C THEN RNZ ; POKRACUJ JMP BREAK ; ELSE BREAK ; STOP: CALL ENDCHK BREAK: LHLD CURRNT BREAK1: XCHG CALL CRLF MVI A,'*' CALL OUTC CALL PRTLN JMP RSTART ; ; ; ; ZMENA VYSTUPU ; PRNTST: LXI H,LO1 SETCO: SHLD CO+1 RET DISP: MVI A,0C3H STA CO LXI H,OUTDIS JMP SETCO LO1: PUSH B ; USCHOVEJ POCITADLO MOV C,A CALL LO POP B ; OBNOV POCITADLO RET OUTDIS: PUSH B ; USCHOVEJ POCITADLO MOV C,A CALL ECOM POP B ; OBNOV POCITADLO RET ; ECOM: PUSH PSW LDA MODE ORA A JZ ECOM0 ; ZOBRAZ INVERZNE ? MOV A,C CPI 20H JC ECOM0 ; RIDICI ZNAKY NORMALNE MVI A,80H ORA C MOV C,A ECOM0: CALL COM POP PSW RET ; ; ; SKOK DO MONITORU MONIT: JMP NEXTM ; TEPLY START MONITORU ; ; ; ;********************************************* ; ; DOPLNUJICI CAST PRO PLAN80A ; ;********************************************* ; ; ; WAIT ; WAIT: CALL EXPR PUSH B ; USCHOVEJ BC MOV C,L MOV B,H CALL TIMER ; CEKEJ <HL> MILISEKUND POP B ; OBNOV BC CALL FINI ; ; ; ; BEEP ; BEEP: CALL EXPR PUSH B ;USCHOVEJ PRACOVNI REGISTRY PUSH D MOV A,H ORA A JM QHOW ; IF ZAPORNA ERROR ORA L JZ QHOW ; IF 0 ERROR XCHG ; <DE> POCET PIPNUTI DELKY 0.1 S BEEP0: MVI A,07H CALL CO LXI B,100 CALL TIMER ; CEKEJ 100 MILISEKUND DCX D MOV A,D ORA E ; VSECHNA PIPNUTI PROVEDENA ? JNZ BEEP0 ; NE - ZNOVU POP D ; OBNOV REGISTRY POP B CALL FINI ; ; ; ; ; PLOT ; ; PRIKAZ KRESLENI PLOT X,Y ; PLOT: CALL EXPR ; VSTUP 1. PARAMETRU ... X PUSH B PUSH H MOV A,L CPI 144 ; X MAX? JNC QHOW CALL TSTC DB ',' DB PLTF-$ CALL EXPR ; VSTUP 2. PARAMETRU ... Y MOV A,L STA YKUR CPI 64 ; Y MAX? JNC QHOW MOV A,L STA XKUR MOV H,L POP B MOV L,C CALL PIXL ; VYKRESLI BOD NA <L>=X, <H>=Y POP B CALL FINI PLTF: JMP QWHAT ; ; ; ; PIXL ; ; PODPROGRAM ZOBRAZENI PIXLU GRAFIKY <H>=Y, <L>=X ; PIXL: PUSH PSW PUSH B PUSH D PUSH H MOV A,H ; Y - SOURADNICE ORA A RAR ; Y/2 MOV L,A MVI H,0 DAD H DAD H DAD H DAD H DAD H DAD H ; Y/2 * 64 XCHG LHLD RAMEND INX H ; ADRESA PRVNIHO ZNAKU DISPLAYE DAD D ; Y/2 * 64 + ADRDIS XCHG POP H PUSH H MOV A,L ; X - SOURADNICE CALL DIVTRI ; X/3 MOV L,C MVI H,0 DAD D ; Y/2*64 + ADRDIS + X/3 ... ADRESA ZNAKU MOV A,M ANI 60H CPI 60H ; JDE O GRAFICKY SYMBOL ? JZ PIXL0 MVI M,20H ; NE - VYMAZ ZNAKU PIXL0: XTHL ; V <HL> SOURADNICE MOV A,H ; Y - SOURADNICE ANI 01H ; Y MOD 2 MOV B,A MVI A,1 SUB B ; 1 - (Y MOD 2) MOV B,A ADD A ADD B ; (1 - (Y MOD 2)) * 3 MOV B,A MOV A,L ; X - SOURADNICE POP H ; V <HL> ADRESA ZNAKU PUSH H CALL DIVTRI ; X MOD 3 ADD B ; (1 - (Y MOD 2))*3 + (X MOD 3) CPI 5 ; JDE O NEPOKRITY PIXL ? JZ NEPOK ; ANO - SKOK ; POK: MOV B,A MVI A,80H POK0: RLC DCR B JP POK0 ; GENERUJ MASKU POKRITEHO PIXLU MOV B,A MOV A,M ORA A JM POK1 ; JE NASTAVEN D7=1 ? MOV A,B ORA M ANI 1FH ORI 60H MOV M,A ; NASTAVENI PIXLU 0 - 4 BEZ PIXLU 5 JMP PIXL1 POK1: ANI 1FH CMA ORA B CMA ORI 0E0H MOV M,A ; NASTAVENI PIXLU 0 - 4 PRI PIXLU 5 JMP PIXL1 ; NEPOK: MOV A,M ORA A JM PIXL1 ; PIXL 5 JIZ NASTAVEN ANI 1FH CMA MOV M,A ; NASTAVENI PIXLU 5 ; PIXL1: POP H POP D POP B POP PSW RET ; DIVTRI: MVI C,0FFH DIVT0: INR C SUI 3 JNC DIVT0 ADI 3 RET ; ; ; ; DRAW - PRIKAZ SPOJENI DVOU BODU PRIMKOU ; XKUR,YKUR ... STARY BOD ; PARAMETRY ... NOVY BOD ; DRAW: CALL EXPR PUSH B PUSH H MOV A,L CPI 144 ; XNEW MAX? JNC QHOW CALL TSTC DB ',' DB DRAF-$ CALL EXPR MOV A,L CPI 64 ; YNEW MAX? JNC QHOW MOV H,L POP B MOV L,C ; <H> = YNEW, <L> = XNEW CALL INTERP ; POMOCI INTERPOLATORU KRESLI POP B CALL FINI ; XKUR = XNEW, YKUR = YNEW DRAF: JMP QWHAT ; ; ; INTERPOL - PODPROGRAM INTERPOLATOTU Z PMD-85 ; <H> = YNEW, <L> = XNEW ; INTERP: PUSH PSW PUSH B PUSH D PUSH H ; LDA XKUR CMP L ; SVISLI SMER? JZ INPO9 ; ANO - SKOK JC INPO11 ; XOLD < XNEW ... SKOK ; ; XOLD > XNEW ; SUB L MOV E,A ; XOLD - XNEW MVI C,0FFH ; SMER INTERPOLACE INPO1: LDA YKUR ; YOLD CMP H ; VODOROVNY SMER? JZ INPO10 ; ANO - SKOK JC INPO12 ; YOLD < YNEW ... SKOK ; ; YOLD > YNEW ; SUB H MOV D,A ; YOLD - YNEW MVI B,0FFH ; SMER INTERPOLACE INPO2: MOV A,E STA DELTAX ; ROZDIL X SOURADNIC MOV A,D STA DELTAY ; ROZDIL Y SOURADNIC CMP E ; DELTAX < DELTAY? JC INPO13 ; ANO - SKOK ; ; DELTAX > DELTAY ; MOV H,E MOV E,D ;DELTAY MOV D,H ;DELTAX ANA A RAR MOV H,A ; DELTAY / 2 ; ; VLASTNI INTERPOLACE ; INPO3: MVI L,0 ; CITAC INPO4: MOV A,L CMP E ; KOMEC? JZ INPO14 ; ANO - NAVRAT Z PODPROGRAMU INR L ; INKR. CITAC MOV A,H ADD D MOV H,A ; DELTAX + DELTAY/2 JC INPO8 ; >255 ... SKOK CMP E ; =>DELTAY ? JZ INPOEX ; ROVNO ... SKOK JNC INPOEX ; VETSI ... SKOK LDA DELTAX CMP E ; POSUN VE SMERU X? JNZ INPO5 ; NE - SKOK LDA XKUR ; XOLD ADD C STA XKUR ; PROVET POSUN X INPO5: LDA DELTAY CMP E ; POSUN VE SMERU Y? JNZ INPO7 ; NE - SKOK ; INPO6: LDA YKUR ; YOLD ADD B STA YKUR ; PROVED POSUN Y INPO7: PUSH H PUSH PSW LHLD XKUR MOV A,H CPI 64 JNC INPO15 MOV A,L CPI 144 JNC INPO15 CALL PIXL ; ZOBRAZ BOD [XKUR,YKUR] INPO15: POP PSW POP H JMP INPO4 ; DALSI BOD ; ; DELTAX + DELTA/2 > 255 ; INPO8: MOV A,E CMA ADD H MOV H,A ; BY JUMP HERE IS: LDA 6793 DB 3AH ; BY JUMP HERE IS: SUB E ; ; DELTAX + DELTAY/2 => DELTAY ; INPOEX: SUB E MOV H,A LDA XKUR ; XOLD ADD C STA XKUR ; XOLD JMP INPO6 ; ; XOLD = XNEW ; INPO9: XRA A MOV E,A MOV C,A JMP INPO1 ; ; YOLD = YNEW ; INPO10: XRA A MOV D,A MOV B,A JMP INPO2 ; ; XOJD < XNEW ; INPO11: MOV E,A MOV A,L SUB E MOV E,A MVI C,1 JMP INPO1 ; ; YOLD < YNEW ; INPO12: MOV D,A MOV A,H SUB D MOV D,A MVI B,1 JMP INPO2 ; ; DELTAX < DELTAY ; INPO13: ANA A MOV A,E RAR MOV H,A JMP INPO3 ; ; UKONCENI INTERPOLACE ; INPO14: POP H POP D POP B POP PSW RET ; ; ; ; MOVE - PRIKAZ POSUNU GRAFICKEHO KURZORU ; MOVE: CALL EXPR PUSH B PUSH H MOV A,L CPI 144 ; X MAX? JNC QHOW CALL TSTC DB ',' DB MOVF-$ CALL EXPR MOV A,L CPI 64 ; Y MAX? JNC QHOW MOV H,L POP B MOV L,C SHLD XKUR ; X --> XKUR, Y --> YKUR POP B CALL FINI MOVF: JMP QWHAT ; ; ; ; CURS ; ==== ; ; PRIKAZ PRO NASTAVENI KURZORU. ; CURS: CALL EXPR PUSH B PUSH H MOV A,L CPI 48 JNC QHOW CALL TSTC DB ',' DB CURF - $ CALL EXPR MOV A,L CPI 20H JNC QHOW PUSH D LXI D,LINECO LHLD RAMEND INX H DAD D POP D MOV M,A INX H POP B MOV M,C POP B CALL FINI CURF: JMP QWHAT ; ; ; ; EDIT ; ; PRIKAZ PRO EDITACI JEDNOHO RADKU PROGRAMU. ; ; POSUN KURZORU VLRVO: BS, CTRL-S, SIPKA VLEVO ; POSUN KURZORU VPRAVO: CTRL-D, SIPKA VPRAVO ; VYMAZ ZNAKU VPRAVO OD KURZORU: CTRL-X,DEL ; UKONCENI EDITACE: CR ; PRERUSENI PRIKAZU: ESC,CS,CTRL-[ ; VLOZENI ZNAKU VLEVO OD KURZORU: JINE ZNAKY > 20H ; EDIT: CALL TSTNUM ; PREVOD ASCII Z BUFFERU NA BIN V <HL> CALL IGNB ; VYNECH MEZERY CPI CR JNZ QWHAT ; CHYBA PRIKAZU CALL FNDLN ; NAJDI ADRESU RADKU <DE> JC QHOW ; NENI TAKOVY ANI VETSI RADEK ; ; PRESUN RADEK Z PROGRAMU DO BUFFERU ; PUSH D CALL FNDNXT XCHG ; V <HL> ADRESA NASL. RADKU CALL DBUFF PUSH D POP B ; V <BC> ADRESA BUFFERU POP D ; V <DE> ADRESA EDITOVANEHO RADKU CALL MVUP ; PRESUN EDIT. RADEK DO BUFFERU MVI A,2 STA EDKUR ; POC. HODNOTA KURZORU MVI A,'_' CALL VSUN ; ; ZOBRAZ RADEK ; EDIT0: MVI A,HOME CALL CO ; NA ZACETAK OBRAZOVKY MVI A,DSCR CALL CO ; VYMAZ OBRAZOVKY CALL DBUFF CALL PRTLN ; ZOBRAZ RADEK Z BUFFERU ; ; VSTUP PRIKAZU ; EDIT2: CALL CI CPI LEFT ; SIPKA VLEVO JZ VLEVO CPI CTRLS ; STRL S JZ VLEVO CPI RIGHT ; SIPKA VLEVO JZ VPRAVO CPI CTRLD ; CTRL D JZ VPRAVO CPI DOWN ; SIPKA DOLU JZ VYMAZ CPI CTRLX ; CTRL X JZ VYMAZ CPI RUB ; DEL JZ VYMAZ CPI ESC ; ESC (CTRL [) JZ RSTART CPI CR ; CR JNZ VLOZ ; ; UKONCENI EDITACE ; CALL VYHOD PUSH D POP B ; V <BC> ADRESA POSL. ZNAKU + 1 CALL DBUFF ; V <DE> ADRESA BUFFERU LDAX D MOV L,A INX D LDAX D MOV H,A DCX D ; V <HL> CISLO RADKU MVI A,HOME CALL CO MVI A,DSCR CALL CO JMP EDIST ; VLOZ EDITOVANY RADEK DO PROGRAMU ; ; VSUN ZNAK ; VLOZ: CPI 20H JC EDIT0 CALL VSUN LDA EDKUR INR A STA EDKUR JMP EDIT0 ; VSUN: PUSH PSW LHLD BUFFER MVI B,0 LDA EDKUR MOV C,A DAD B ; V <HL> ADRESA KURZORU POP PSW VSU0: MOV C,M MOV M,A MOV A,C CPI CR INX H JNZ VSU0 ; VLOZ ZNAK MOV M,A ; VLOZ CR INX D RET ; ; POSUN KURZORU VLEVO ; VLEVO: LDA EDKUR CPI 3 JC EDIT0 PUSH PSW CALL VYHOD POP PSW DCR A STA EDKUR MVI A,'_' CALL VSUN JMP EDIT0 ; ; POSUN KURZOR VPRAVO ; VPRAVO: LHLD BUFFER LDA EDKUR MOV C,A MVI B,0 DAD B ; V <HL> ADRESA KURZORU INX H INX H ; ZAHRN I ZNAK CR NA KONCI RADKU CALL COMP ; NA KONCI RADKU? JNC EDIT0 ; ANO - DAL NEPOSOUVEJ VPRA0: CALL VYHOD LDA EDKUR INR A STA EDKUR MVI A,'_' CALL VSUN JMP EDIT0 ; ; VYMAZ ZNAKU ; VYMAZ: LHLD BUFFER LDA EDKUR MOV C,A MVI B,0 DAD B ; V <HL> ADRESA KURZORU CALL COMP INX H INX H INX H INX H ; ZAHRN I ZNAK CR MA KONCI RADKU JNC EDIT0 ; KONEC RADKU - SKOK LDA EDKUR INR A STA EDKUR CALL VYHOD LDA EDKUR DCR A STA EDKUR JMP EDIT0 ; VYHOD: LHLD BUFFER LDA EDKUR MOV C,A MVI B,0 DAD B ; V <HL> ADRESA KURZORU VYH0: INX H MOV A,M DCX H MOV M,A INX H CPI CR JNZ VYH0 DCX D RET ; ; ; ; LOAD ; ; SNIMAC A DEROVAC (=>MODEM+MAGNETOFON) ; LOAD: LXI D,TXTBGN LOA1: CALL RI CPI 00H JZ LOA1 CPI '$' JNZ LOA1 CALL RI MOV L,A CALL RI MOV H,A DAD D ; KONCOVA ADRESA SHLD TXTUNF XCHG LOA0: CALL RI MOV M,A INX H CALL COMP JNZ LOA0 PUSH D PUSH B CALL JOIN0 POP B POP D JMP RSTART ; ; ; ; SAVE ; SAVE: MVI C,'$' CALL PO LHLD TXTUNF XCHG ; V <DE> KONEC PROGRAMU LXI H,TXTBGN ; V <HL> ZACATEK PROGRAMU MOV A,E SUB L MOV C,A MOV A,D SBB H MOV B,A CALL PO ; POCET BYTU LOW MOV C,B CALL PO ; POCET BYTU HIGH SAVE1: CALL COMP JZ SAVE2 MOV C,M CALL PO INX H JMP SAVE1 SAVE2: MVI C,SUBS CALL PO PUSH D PUSH B CALL TCLOSE POP B POP D JMP RSTART ; ; ; ; GET ; GET: CALL RI MOV L,A CALL RI MOV H,A RET ; ; ; ; PUT ; PUT: CALL PARN PUSH B MOV C,L CALL PO MOV C,H CALL PO POP B CALL FINI JMP QWHAT ; ; ; ; CLOSE ; CLOSE: CALL CHKTPR ; JE PRIPOJEN MAGNETOFON ? PUSH D PUSH B CALL TCLOSE POP B POP D CALL FINI JMP QWHAT ; ; ; ; INIT ; INIT: CALL CHKTPR ; JE PRIPOJEN MAGNETOFON ? PUSH D PUSH B CALL JOIN0 POP B POP D CALL FINI JMP QWHAT ; ; ; CHKTPR - TEST PRITOMNOSTI MAGNETOFONU ; CHKTPR: LDA ADRTPR CPI KEYTPR JNZ QWHAT RET ; .DEPHASE ; ;********************************************* ; ; DEFINICE RAM ; ;********************************************* ; .PHASE UZIRAM ; LEGT: DS 2 IOBUFA: DS 1 IOBUFB: DS 1 IOBUFC: DS 1 LISTC: DS 1 CO: DS 3 ; SKUTECNA ADR. CO OR LO MASKIN: DS 1 ; MASKA PRO FUNKCI 'INM' CURRNT: DS 2 ; PRAVE ZPRACOVAVANY RADEK PROGRAM STKGOS: DS 2 ; POINTER PRO GOSUB VARNXT: DS 2 STKINP: DS 2 LOPVAR: DS 2 ; POINTER PRO FOR LOPINC: DS 2 LOPLMT: DS 2 LOPLN: DS 2 LOPPT: DS 2 RANPNT: DS 2 ; PARAMETR PRO RANDOM ARMM: DS 2 MODE: DS 1 ; REZIM ZOBRAZENI (0-PRIMO, 1-INVERZNE) TXTEND: DS 2 ; MAXIMALNI ADR. PRO BASIC PROGRAMU BUFFER: DS 2 ; POINTER NA RADKONY BUFFER BUFEND: DS 2 ; POINTER NA KONEC RADKOVEHO BUFFERU XKUR: DS 1 ; X SOURADNICE GRAF. KURZORU YKUR: DS 1 ; Y SOURADNICE GRAF. KURZORU DELTAX: DS 1 ; POMOCNA PROMENA INTRPOLATORU DELTAY: DS 1 ; POMOCNA PROMENA INTRPOLATORU EDKUR: DS 1 ; KURZOR EDITORU .DEPHASE ; ; OBSLUHA TVRDEHO BREAKU - RST 7 ; .PHASE 38H ; RST7RA: DS 3 ; TXTUNF: DS 2 ; POINTER NA KONEC PROGRAMU BASIC DS 40 VARBGN: DS 54 ; PROSTOR PRO PROMENE V BASICU TXTBGN: DS 32 ; MINIMALNI PROSTOR PRO PROGRAM V BASICU TXTE: DS 1 ; KONEC MINIMALNIHO PROGRAMU ; .DEPHASE ; 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