Ú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


8 bity / SAPI-1 / Programové vybavení / V4.x / ASM MONITOR


Výpis programu MONITOR V4.0F


;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
TITLE 'MONITOR SAPI-1  V4.0F'
;       30.7.1985       (P+S)
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;
;  VOLBA SYSTEMU
SP1     EQU     -1      ; -1 YES
SP1A    EQU     0       ;FOR CP/M SYSTEM MONITOR
CPM     EQU     00      ;JPR-1 EPROM VERSION
;
;
;       *** DEFINOVANI PAMETOVEHO PROSTORU *
;
MONIT   EQU     100H    ; START MONITORU
;  NASTAVENI PAMETI R A M

RAM     EQU     4000H   ;START RAM
        IF      CPM
ERAM    EQU     9FFFH   ;TOP RAM
TVBEG   EQU     0E800H  ;TV-RAM
EP2     EQU     800H+200H       ; SECOND EPROM
        ELSE
ERAM    EQU     0FFFFH  ;RAM-1 48K
TVBEG   EQU     3800H   ;TV-RAM
EP2     EQU     800H    ; SECOND EPROM
        ENDIF
@R@     EQU     4000H   ;RESTART VECTOR
RSTN    EQU     0CFH    ; RST 1

; GLOBAL CONSTANTS

CR      EQU     0DH     ; CARRIAGE RETURN
HT      EQU     9       ; TAB
BACK    EQU     8       ; BACK SPACE
BELL    EQU     7       ; BELL
LF      EQU     0AH     ; LINE FEED
ETX     EQU     03H     ; BREAK CHAR.(CONTROL C)
CTRLW   EQU     17H     ; BREAK USER
BEGIO   EQU     55H     ; START VALUE FOR I/O BYTE


; I/O STATUS BYTE MASKS AND VALUES

CMSK    EQU     11111100B       ; MASK FOR CONZOLE
RMSK    EQU     11110011B       ; MASK FOR READER
PMSK    EQU     11001111B       ; MASK FOR PUNCH
LMSK    EQU     00111111B       ; MASK FOR LIST


CTTY    EQU     00000000B       ; CONZOLE=TTY
CCRT    EQU     00000001B       ; CONZOLE=CRT
BATCH   EQU     00000010B       ; INPUT=READER,OUTPUT=LIST
CUSE    EQU     00000011B       ; USER REFINED CONZOLE


RTTY    EQU     00000000B       ; READER=TTY
RPTR    EQU     00000100B       ; READER=PTR
RUSE1   EQU     00001000B       ; USER DEFINED READER 1
RUSE2   EQU     00001100B       ; USER DEFINED READER 2


PTTY    EQU     00000000B       ; PUNCH=TTY
PPTR    EQU     00010000B       ; PUNCH=PTR
PUSE1   EQU     00100000B       ; USER DEFINED PUNCH 1
PUSE2   EQU     00110000B       ; USER DEFINED PUNCH 2


LTTY    EQU     00000000B       ; LIST=TTY
LCRT    EQU     01000000B       ; LIST=CRT
LLPT    EQU     10000000B       ; LIST=LPT
LUSE    EQU     11000000B       ; USER DEFINED LIST
;
;       SEPI CONTROL I/O
;
UDATA   EQU     12H
USTAT   EQU     11H
MMODE   EQU     11H
UMODE   EQU     10H
URES    EQU     13H
ALLINT  EQU     02H

        ASEG
        IF      SP1
;
;       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
;       RESTARTS & CP/M ENTRY
;
;       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

        IF      CPM
        ORG     100H
        ENDIF
        IF      NOT CPM
        ORG     0       ; BEGIN MEMORY
        ENDIF
        JMP     COLD    ; COLD START
        DB      55H     ;INTEL IOBYT
        DB      40H     ;V 4.0
        JMP     CCPM
        JMP     @R@
;
MINUS:  MVI     A,'-'
        JMP     COA
        JMP     @R@+3
;
EQUAL:  MVI     A,'='
        JMP     COA
        JMP     @R@+6
;
QUES:   MVI     A,'?'
        JMP     COA
        JMP     @R@+9
;
IOCHK:  LDA     IOBYT
        RET
        DB      'P'
        JMP     @R@+12
;
IOSET:  MOV     A,C
        STA     IOBYT
        RET
        JMP     @R@+15
;
SPCL:   LHLD    CADR
        MOV     A,M
        RET             ; FOR PEDIT
        JMP     @R@+18
;
CCPM:   MOV     A,C     ;CONTINUE ENTRY TO CPM
        MOV     C,E     ; INTEL
        PUSH    D       ;DE->HL
        LXI     H,TCPM
        MVI     B,11    ; MAX CPM ENTRY
        JMP     INJM@
;-------------------------------
TCPM:   DW      COLD,CI
        DW      CO,RI
        DW      PO,LO
        DW      CICO,IOCHK
        DW      IOSET,ERROR
        DW      ERROR,CSTS

CI:     PUSH    H
        LXI     H,CITB
        JMP     IOCOM-3
;

TABCOD: DB      'AQ1'
        DB      1BH,0DH         ; ESC, CR
        DB      'P0'

        DB      'ZSW2 LO9'

        DB      'XDE3MKI8'

        DB      'CFR4NJU7'

        DB      'VGT5BHY6'

; POKRACOVANI TABULKY - SHIFT
        DB      10H,11H         ; ^A ^Q
        DB      '!'
        DB      0AH,0DH
        DB      7FH
        DB      ')'

        DB      'Z'
        DB      13H,17H         ; ^S, ^W
        DB      '?'
        DB      9               ; TABELATOR/SHIFT SPC
        DB      '=#('

        DB      3               ; EXT/SHIFT X
        DB      '&E".*@>'

        DB      '[\%$,-:<'

        DB      ']_'
        DB      8               ; BACKSPACE
        DB      '^'
        DB      ';+/'
        DB      27H             ; ' UVOZOVKA

; I/O DEVICE TABLE
;
IOTAB:  DB      'C',03H ;CONSOLE (LOCAL, MASK)
        DB      'TCB1'  ;PHYSICAL
        DB      'R',0CH ;READER
        DB      'TP12'
        DB      'P',30H ;PUNCHER
        DB      'TP12'
        DB      'L',0C0H        ;LIST
        DB      'TCL1'

;  ASSING TABLE FOR LOG. DEVICE
;
COTB:   DW      COLO,CRT,LO,COLOC
CITB:   DW      KBR,KBR,RI,CILOC
LOTB:   DW      COLO,CO,LPR,LILOC
RITB:   DW      KBR,RDR,R1LOC,R2LOC
POTB:   DW      CO,PUN,P1LOC,P2LOC
;
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VERS:   DB      CR,LF
        DB      'SAPI-1 V4.0'
LVER    EQU     $-VERS  ; DELKA OHLASENI
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

;***************************************************
        IF      CPM
        ORG     MONIT+100H
        ELSE
        ORG     MONIT   ; *** ZACATEK MONITORU ***
        ENDIF
;***************************************************

; TABLE OF EXTERNALLY REFERENCED  ROUTINES

        JMP     COLD    ; START MONITORU
        JMP     CI      ; CONZOLE INPUT <A>
        JMP     RI      ; READER INPUT <A>, CY=1 ERROR
        JMP     CO      ; CONZOLE OUTPUT <C>
        JMP     PO      ; PUNCH OUTPUT <C>
        JMP     LO      ; LIST OUTPUT <C>
        JMP     CSTS    ; CONZOLE INPUT STATUS
        JMP     IOCHK   ; I/O BYTE CHEK <A>
        JMP     IOSET   ; I/O BYTE SET <C>
        JMP     MEMCK   ; SIZE MEMORY CHECK
        JMP     IODEF   ; DEFINE USER I/O ENTRY POINTS
        JMP     SPCL    ; I/O CONTROL SPECIAL
        JMP     CRLF    ; NOVY RADEK
        JMP     EXPR    ; SKLADANI ADRES (N=POCET <C>, SP)
        JMP     ERROR   ; HLASENI CHYBY
        JMP     ASHEX   ; PREVOD ASCII->HEX,CHYBA-CARRY
        JMP     DADR    ; ZOBRAZENI ADRESY <HL>
        JMP     DBYT    ; ZOBRAZENI ZNAKU <A> NA 'CO'
        JMP     HILO    ; HL+1,SROVNANI S DE,(HL=0)
        JMP     NEXT    ; PREDANI MONITORU
        JMP     SPACE   ; MEZERA NA 'CO'
        JMP     CINCR   ; ECHO+ANALIZA
        JMP     TEXT    ; VYPIS TEXTU <HL=ADRESA>,<D=DELKA>
        JMP     XY      ; PROVEDENI POVELU DLE <A>
        JMP     HXASC   ; PREVOD HEX->ASCII DO <A>,<C>
        JMP     EXFLG   ; EXTERNAL CONTROL FLAGS
;
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
;  ASSIGN I/O DEVICE MODUL
;
ASIGN:  CALL    CIMIN   ;NAME
; <A>..NAME (EXTERN CALLS)
        LXI     H,IOTAB ;TABLE
        MVI     C,4     ;COUNTER
        LXI     D,6     ;OFFSET
ASS0:   CMP     M       ;IS IT?
        JZ      ASS1    ;+
        DAD     D       ;ADR
        DCR     C       ;ALL ?
        JNZ     ASS0    ;-
;
; ERROR MESSAGE
;
ERROR:  CALL    QUES
        CALL    BEEP
        JMP     INIC    ;START
;
ASS1:   CALL    EQUAL
        CALL    ECHO    ;PHIS.D
        INX     H
        MOV     B,M     ;MASK
        MVI     C,0     ;IOBYT
ASS2:   INX     H
        CMP     M       ;IS IT?
        JZ      ASS3    ;+
        PUSH    PSW
        MVI     A,55H   ;OFFSET
        ADD     C
        MOV     C,A
        JC      ERROR   ;NO #
        POP     PSW
        JMP     ASS2    ;NEXT
ASS3:   MOV     A,C     ;COMPUTE IOBYT
        ANA     B       ;MASK
        MOV     C,A     ;SAVE
        MOV     A,B
        CMA             ;NEG
IONEW:  LXI     H,IOBYT
        ANA     M
        ORA     C
        MOV     M,A
        RET
;
; QUERY DEVICE
;
QUERY:  LXI     H,IOTAB ;TABLE
        LDA     IOBYT   ; READ
        MOV     B,A     ;SAVE
        CALL    $+3
        CALL    $+3     ;DO IT
; DISPLAY ASSIGN I/O
        CALL    SPACE
        MOV     A,M     ; READ LOGICAL NAME
        CALL    COA
        CALL    EQUAL
        PUSH    H       ;SAVE ADR
        INX     H
        INX     H       ;ADR
        MOV     A,B
        ANI     3
        MOV     E,A
        MVI     D,0
        DAD     D       ;PHYSICAL DEVICE ADR
        MOV     A,M
        CALL    COA
        MOV     A,B
        RRC
        RRC             ;ROTATE IOBYT
        MOV     B,A
        POP     H
        MVI     E,6     ;OFFSET
        DAD     D
        RET             ;HL=NEXT ADR
;
;%%%%%%%%%%%%%%%%%%%%%%%%%
; I/O DEVICE CONTROL
;%%%%%%%%%%%%%%%%%%%%%%%%%

CSTS1:  ORA     A
        JM      CSLOC   ;USER CSTS
        XRA     A
        RET             ;BATCH-NOT READY
;
CSTS:   LDA     IOBYT
        RAR
        RAR
        JC      CSTS1
        IF      NOT CPM

KBRST:  PUSH    H       ; KEYBOARD STATUS
        PUSH    D
        PUSH    B
        MVI     H,24H   ; PORT0
;                        #VERS."F"#
        MVI     M,10H   ;#BEZ SLOUPCE SHIFT
        MOV     A,M     ;#
        INR     A       ;#0FFH+1=CO
        JNZ     KBRS1   ;#
        MVI     M,0FH   ;#JEN SLOUPEC SHIFT
        STC             ;#
        MOV     A,M     ;#
        RAR             ;#SHIFT NETESTUJE
        INR     A       ;#
KBRS1:  LXI     H,FLAG
        JZ      SET80   ; POVOL
        MOV     A,M     ; CSTS POVOLENO?
        INR     A       ; FF+1=00..ZAKAZ
        JZ      CSTS0
        CALL    KEYIN   ; ZACHOVA 'HL'
        JM      SET80   ; POVOL
        MOV     M,A     ; USCHOVA LIN. KODU
        MVI     A,0FFH
        ORA     A       ; TRUE, NOT ZERO
        JMP     CSTS0

SET80:  MVI     M,80H   ; POVOL CSYS
        XRA     A       ; SET ZERO
CSTS0:  POP     B
        POP     D
        POP     H
        RET
;
        ELSE
        PUSH    B
        PUSH    D
        PUSH    H
        MVI     C,6
        MVI     E,0FFH
        CALL    5
        CPI     CTRLW
        CZ      RESTA   ; BREAK
        ORA     A
        POP     H
        POP     D
        POP     B
        RET
;
        ENDIF

DTTO?:  LDA     LASTC
        CMP     C
        JNZ     LONG
        LHLD    LIMIT
        DCX     H
        SHLD    LIMIT
        MOV     A,H
        ORA     L
        JNZ     CI1
        LXI     H,100   ; 100 MS
        JMP     LSET

BEEP:   PUSH    B
        MVI     C,40
        CALL    CLICK
        DCR     C
        JNZ     $-4
        POP     B
        RET

CLICK:  MVI     H,24H   ; PORT0
        MVI     M,5FH   ; REPRO ON
CLCK1:  DCR     B
        JNZ     CLCK1
        MVI     M,1FH   ; REPRO OFF
CLCK2:  DCR     B
        JNZ     CLCK2
        RET


; PROHLEDAVANI KLAVESNICE ANK-1
;===============================
; KONSTANTNI DOBA PROHLEDAVANI 0.816 MS/488NS.
; PLATNA POSLEDNI NALEZENA KLAVESA.
; B...CITAC DO 8, C... LINEARNI KOD
; D...SHIFT FLAG, SOUCASNE MASKA LED.
; E...CITAC LINEARNIHO KODU KLAVES:
;     A-Q-1-LF-CR-P-0 Z-S-W-SP-L-O-9..
; H...UKAZATEL NA PORT0 JPR-1
; L...VYBER MATICE VODOROVNE

; PO PROVEDENI KOD V 'A', 'C' REGISTRU.
; PRIZNAK 'SHIFT' V 'D' REGISTRU.
; FLAG 'SIGN' SIGNALIZUJE STISKNUTI-
;  PLUS...ANO, MINUS...NE

KEYIN:  PUSH    H       ; V2.2  20.1.85
        LXI     D,1FFFH ; MASKA&CITAC
        MVI     C,0
        MVI     H,24H   ; PORT0
        MVI     A,11101111B
NXLIN:  MOV     L,A
        ANA     D
        MOV     M,A
        MVI     B,8     ; CITAC BITU
        MOV     A,M
KEY:    RRC
        INR     E       ; NACTI KOD
        JC      NXKEY   ; SKOC, KDYZ NIC
        MOV     C,E     ; KOD KLAVESY
        JNZ     NXKEY   ; SHIFT ?
        MVI     D,3FH   ; ANO NASTAV MASKU
NXKEY:  DCR     B
        JNZ     KEY
        MOV     A,L
        RRC
        JC      NXLIN
        DCR     C       ; NASTAV 'SIGN'
        POP     H
        RM              ; STISKNUTA?
        MOV     A,D     ; SHIFT?
        ANI     20H
        MOV     A,C
        RZ              ; NE,NAVRAT
        ADD     E       ; ANO, +39
        MOV     C,A
        RET

        ENDIF
;
;
;
        CALL    RESTA   ;^W
KBR:    CALL    KBRD
        CPI     CTRLW
        JZ      KBR-3   ; SIMUL. INTERRUPT
        CPI     CTRLQ
        RNZ

        PUSH    B       ;WINDOW
        PUSH    D
        PUSH    H
        MVI     B,0
        CALL    UCMD    ;CLEAR
        CALL    KBRD    ;NUMBER OF RESEVED LINES
        ANI     0FH     ;MAX 15
        STA     RESL
        MVI     B,80H   ;SET NEW LINE
        CALL    UCMD
        POP     H
        POP     D
        POP     B
        JMP     KBR     ;NEW CHAR.
;
CICO:   MOV     A,C     ; DIRECT CRT/KBRD
        INR     A
        JNZ     CRT     ; ONLY OUTPUT
        CALL    KBRST
        RZ

KBRD:   PUSH    B       ;DIRCT  KEYBOARD
        PUSH    D
        PUSH    H
;
        IF      CPM
KBR1    MVI     E,0FFH
        MVI     C,6
        CALL    5
        ANI     7FH
        JNZ     KBR1    ;WAIT
        ELSE
;
; AUTOREPEAT+KEYIN+CSTS+CLICK V2.6

        LDA     FLAG    ; STATUS CSTS
        ORA     A
        JM      CI1     ; BIT7..STANDARD CI
        MOV     C,A
        MVI     B,0     ; LIN. KOD V 'BC'
        JMP     SETLST  ; SET LAST CODE

CI1:    CALL    KEYIN
        JP      DTTO?
PRESS:  MVI     L,20
WAIT0:  CALL    KEYIN
        JP      PRESS
        DCR     L
        JNZ     WAIT0
LONG:   LXI     H,1000  ; 1 SEKUNDA
LSET:   SHLD    LIMIT
FREE:   MVI     L,10    ; 10 MS
WAIT1:  CALL    KEYIN
        JM      FREE
        DCR     L
        JNZ     WAIT1
SETLST: STA     LASTC
        LXI     H,TABCOD
        DAD     B
        MVI     A,0FFH
        STA     FLAG    ; ZAKAZ CSTS
        MOV     A,M
        CALL    CLICK

        ENDIF
;
        POP     H
        POP     D
        POP     B
        CPI     CTRLP   ;^P
        RNZ
        LDA     MODE
        XRI     1
        STA     MODE    ; LPR ON/OFF
        JMP     KBRD
;
;
RI:     PUSH    H
        LXI     H,RITB
        LDA     IOBYT
RICOM:  RRC
        RRC
        JMP     IOCOM
;
PO:     PUSH    H
        LXI     H,POTB
        LDA     IOBYT
        RRC
        RRC
        JMP     RICOM
;
LO:     PUSH    H
        LXI     H,LOTB
        LDA     IOBYT
        RLC
        RLC
        JMP     IOCOM
;----------------------------
;
COLO:   CALL    LPR
        JMP     CRT
;----------------------------
;
;
; RUN AND BREAK MODUL:
;
RESTA:  DI              ;SAVE ALL
        SHLD    HLSAV
        PUSH    PSW
        LXI     H,2     ;OFSSET
        DAD     SP
        SHLD    SPSAV
        POP     PSW
        POP     H       ;PC
        LXI     SP,HLSAV
        PUSH    D
        PUSH    B
        PUSH    PSW
        XCHG
        DCX     D       ; PC-1
        LXI     H,BRAD  ;BREAK ?
        MVI     C,2     ; TWO BREAKS
RST10:  PUSH    B       ;COUNTER
        MOV     C,M
        MVI     M,0
        INX     H
        MOV     B,M
        MVI     M,0
        INX     H
        MOV     A,C
        ORA     B       ;0 ?
        JZ      RST20   ;NO BREAK
        MOV     A,M     ;RESTORE INSTR
        STAX    B
        INX     H
        PUSH    H
        MOV     H,B
        MOV     L,C     ;BREAK/INTR ?
        CALL    COMPR
        POP     H
        JNZ     RST20
        DCX     D       ;PC-1
RST20:  POP     B
        DCR     C
        JNZ     RST10
        XCHG
        INX     H       ;RESTORE PC
        SHLD    PCSAV
        STC
        CALL    X+3     ;DISPLAY ALL REGISTERS
        JMP     NEXT    ;WAIT FOR COMMAND
;
; GO TO COMMAND
;
GOTO:   CALL    EQUAL
        CALL    CINCR   ;COMMAND
        JC      GO@     ;IF CR THEN GOTO FROM OLD PC
        JZ      GO@BR   ; OLD PC AND BREAK
        CALL    EXPRM   ;START ADR
        POP     H
        SHLD    PCSAV   ;SET NEW
        MOV     A,B     ;ONLY START ADR ?
        CPI     CR
        JZ      GO@
GO@BR:  CALL    RADR    ;READ BREAK ADR
        SHLD    BRAD
        MOV     A,M     ;SAVE INSTR. CODE
        STA     INSTR
        MVI     M,RSTN  ;SET RST
        MVI     A,CR
        CMP     B       ;ONLY 1-BREAK ?
        JZ      GO@
; SECOND BREAK
        CALL    RADR
        SHLD    BRAD2
        MOV     A,M
        STA     INST2
        MVI     M,RSTN
; START PROGRAM
GO@:    CALL    CRLF
        DI
        LXI     SP,ACSAV        ;REASTORE REGISTERS
        POP     PSW
        POP     B
        POP     D
        LHLD    SPSAV   ;STACK
        SPHL
        LHLD    PCSAV   ; PC
        XTHL
        LHLD    HLSAV
        RET             ;CONTINUE...
;
; EXAMINE REGISTRS
;
X:      CALL    CINCR   ;COMMAND
        LXI     H,RGNAM ;NAME TABLE
        MVI     D,HIGH ACSAV    ;DATA
        JNC     X1      ;CHANGE
        CALL    CRLF
X0:     CALL    XDISP
        RZ              ;END
        INX     H
        JMP     X0
X1:     JZ      X2      ;NO CHANGE
        MOV     E,A     ;SAVE NAME
        DB      1       ; LXI B,##
X10:    INX     H
        INX     H
        MOV     A,M     ; READ NAME REG.
        ANI     7FH
        JZ      ERROR   ; NO FIND
        CMP     E
        JNZ     X10     ; NEXT
        CALL    XDIS1   ; DISPLAY IT
        JMP     X2+3
;
X2:     CALL    XDISP+3
        RZ
        CALL    CIMIN   ;- COMMAND
        RC              ;CR - END
        MOV     E,M     ;LOW ADR
        INX     H
        JZ      X2      ;SP - NEXT
        XCHG
        PUSH    D
        CALL    RBYT    ; READ NEW BYTE AND CHANGE
        DCR     B
        JZ      $+6
        MOV     M,D     ; HIGH BYTE

        DCX     H
        MOV     M,E     ;LOW
        POP     D
        XCHG
        CPI     CR      ;LAST?
        RZ              ;+
        JMP     X2      ;NEXT
;
XDISP:  CALL    SPACE
        MOV     A,M
        ANI     7FH
        RZ
        CALL    COA
XDIS1:  CALL    EQUAL   ;NAME=
        MOV     A,M
        RLC
        MVI     A,1
        ACI     0       ; COMPUTE LENGHT
        MOV     B,A     ; SAVE
        INX     H
        MOV     E,M     ; LOW ADR
        LDAX    D       ;HIG BYTE
        CALL    DBYT
        MOV     A,B     ;SINGLE REG. ?
        DCR     A
        DCX     D
        LDAX    D       ;READ SECOND BYTE
        CNZ     DBYT    ;IF 2.BYTE REG. THEN DISP.
        ORA     E       ;NZY (IN PAGE)
        RET
;
; X: COMMAND TABLE
RGNAM:  DB      'A',LOW ACSAV+1
        DB      'F',LOW ACSAV
        DB      'B',LOW BCSAV+1
        DB      'C',LOW BCSAV
        DB      'D',LOW DESAV+1
        DB      'E',LOW DESAV
        DB      'H',LOW HLSAV+1
        DB      'L',LOW HLSAV
        DB      'P' OR 80H,LOW PCSAV+1
        DB      'S' OR 80H,LOW SPSAV+1
        DB      0
;
; DISPLAY CONTENS OF MEMORY
;
DISP:   CALL    EXPR    ; FROM -TO
        POP     D
        POP     H
DI0:    PUSH    H       ;FIRST ADR
        CALL    DNADR   ;NEW ADR
DI1:    MOV     A,M
        CALL    DBYTE
        CALL    HILO
        JC      DIA     ;DISPLAY  ASCII
        MOV     A,L
        ANI     7
        JNZ     DI1     ;NEXT BYTE
DIA:    POP     H
        CALL    SPACE
DI2:    MOV     A,M
        MVI     C,'.'   ;NO ASCII
        CPI     ' '
        JNC     $+4
        MOV     A,C
        CPI     60H
        JC      $+5
        SUI     ' '
        CALL    COA
        CALL    HILO
        RC
        MOV     A,L
        ANI     7
        JNZ     DI2     ;NEXT ASCII
        CALL    CSTS
        JZ      DI0     ;NEXT LINE
        CALL    CIMIN   ;#VERS."F" -
        RC              ;#IF SPC WAIT
        RNZ             ;#ELSE BREAK.
        CALL    CINCR   ;#CR?
        JNC     DI0     ;#BREAK,IF CR
        RET
;
; FILL MEMORY BLOCK WITH BYTE
;
FILL:   INR     C
        CALL    EXPR    ;FROM-TO-WITH
        POP     B
        POP     D
        POP     H
FI1:    MOV     M,C
        CALL    HILO
        JNC     FI1
        RET
;
; MOVE BLOCK MEMORY
;
MOVE:   INR     C
        CALL    EXPR
        POP     B
        POP     D
        POP     H
MO1:    MOV     A,M
        STAX    B
        INX     B
        CALL    HILO
        JNC     MO1
        RET
;
; SUBSTITUTE MEMORY
;
SUBS:   CALL    RADR    ;ADR
SU1:    MOV     A,M
        CALL    DBYT
        CALL    CIMIN   ;- & CINCR
        RC              ;CR
        JZ      SU2
        CALL    RBYT    ;CHANGE
        RZ              ;END
SU2:    INX     H       ;NEXT BYTE
        CPI     ','     ;IF , THEN DISPLAY ADR
        CZ      DNADR
        JMP     SU1
;
; CONSOLE MODUL
;
;
ECHO:   CALL    CI
COA:    PUSH    B
        MOV     C,A
        CALL    CO
        POP     B
        RET
;
        IF      SP1A
MINUS:  MVI     A,'-'
        JMP     COA
;
EQUAL:  MVI     A,'='
        JMP     COA
;
QUES:   MVI     A,'?'
        JMP     COA
;
        ENDIF
;
;SET MODE. I/O FLAGS
;
EXFLG:  MOV     B,A
        MOV     A,C
        CPI     EXSER   ; OVERFLOW ?
        MOV     A,B
        RNC
        PUSH    H       ; <A> .. COMMAND
                        ; <C> .. 0-N SLUZBA
        MVI     B,0     ; 0-MODE, 1-@IF1..4@OF2
        LXI     H,MODE  ; 0=0
        DAD     B       ; 5- RESERVE_LINE, 6-S@FLG
        MOV     M,A
        POP     H
        RET

;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
; ****   S T A R T    M O N I T O R U   ****
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;
COLD:   OUT     URES    ; RESET
        XRA     A       ;MONITORU
        OUT     UMODE
        MVI     A,0DH
        OUT     MMODE
        NOP             ; RESERVA
        NOP
        NOP
        NOP
;
;-------------------------------------
BEG:    DI              ; COMMAND "C"
        LXI     H,MSTAK ; SET STACK POINTER
        SPHL
        LXI     D,@R@+255
        MVI     C,0
        CALL    FI1     ;CLEAR M-RAM
        MVI     A,BEGIO ;SET IOBYTE
        STA     IOBYT
        CALL    COINIT  ;TV
        CALL    EP2?    ;M-PLUS ?
        CZ      EP2+3   ;INIT M-PLUS
        LXI     H,RAM
MEM1:   INR     H       ; NEXT PAGE
        MOV     A,H
        IF      HIGH ERAM NE 0FFH
        CPI     HIGH ERAM+1
        ELSE
        CPI     0
        ENDIF
        JZ      MEM2
        MOV     A,M
        CMA
        MOV     M,A     ; WRITE COMPLEMENT
        CMP     M       ; WRITE O.K. ?
        CMA
        MOV     M,A     ; RAM RESTORE
        JZ      MEM1
MEM2:   DCX     H       ; LAST BYTE IN RAM
        SHLD    MEMTOP  ; SAVE ADDRES
        MVI     A,17H   ; LIN. KOD 'C'
        STA     LASTC   ; LAST CODE
        MVI     A,0FFH
        STA     FLAG    ; ZAKAZ CSTS
        LXI     H,MSTAK-20H
        SHLD    SPSAV

; OHLASENI MONITORU

INIC:   LXI     H,VERS  ; TEXT OHLASENI
        MVI     D,LVER ; DELKA TEXTU
        CALL    TEXT    ; TEXT OHLASENI
;------------------------------------
;  *  VYHODNOCENI POVELU OPERATORA  *
;------------------------------------

NEXT:   LXI     SP,MSTAK        ; SET STACK FOR MONITOR
        LXI     H,NEXT
        PUSH    H       ;RET. ADR
        IF      NOT CPM
        MVI     H,30H   ;INTERRUPT ENABLE
        MVI     M,2
        ENDIF
        CALL    CRLF
        MVI     A,0C3H  ; JMP
        STA     @R@     ; SET INTERUPT ADR "08CH"
        LXI     H,RESTA
        SHLD    @R@+1
        MVI     C,'.'
        CALL    CO
        CALL    CINCR   ; POVEL
XY:     MOV     L,A     ; L-COMMAND
        PUSH    H       ; SAVE
        SUI     'A'
        JM      NEXT    ; ASCII < "A"
        LXI     H,CTBL  ; ZACATEK COMMAND TABLE
        LXI     B,(LCT SHL 8) OR 2
INJM@:  CMP     B
        JNC     ERROR   ;OVERFLOW
INJMP:  ADD     A       ;2*
        ADD     L
        MOV     L,A
        MOV     A,M
        INX     H
        MOV     H,M
        MOV     L,A
        XTHL            ;SET HL
        RET             ;START

;----------------------------------
;   *  TABULKA POVELU MOVITORU  *
;----------------------------------

;
CTBL:   DW      ASIGN   ; ASSING I/O RUTINE
        DW      EXROM   ;B
        DW      BEG     ; CLEAR
        DW      DISP    ; DISPLAY MEMORY
        DW      EXROM   ; END OF FILE
        DW      FILL    ; FILL MEMORY
        DW      GOTO    ; GOTO WITH BREAK
        DW      EXROM
        DW      EXROM   ;I
        DW      EXROM   ;J
        DW      EXROM   ;K
        DW      EXROM   ;L
        DW      MOVE    ; MOVE MEM.
        DW      EXROM   ; N - BLANK
        DW      EXROM   ;O
        DW      EXROM   ;P
        DW      QUERY   ; Q - MEMTOP & IOBYTE
        DW      EXROM   ; READ TAPE
        DW      SUBS    ; SUBSTITUTE
        DW      EXROM
        DW      EXROM   ;U
        DW      EXROM
        DW      EXROM   ;WRITE TO TAPE
        DW      X       ;X - EXAMINE
LCT     EQU     ($-CTBL)/2


;
; EXTEND ROM WITH MONIT-PLUS ?
;
EXROM:  CALL    EP2?
        JNZ     ERROR   ;NO, ERROR
        JMP     EP2 + 6 ;YES, EXECUTE COMMAND
;
EP2?:   LDA     EP2
        CPI     0C3H    ;JMP?
        RET
;
;

;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
;  *  EXTERNAL RUTINES FOR MONITOR  *
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&



; HIGH NIBBLE
HBYTE:  RRC
        RRC
        RRC
        RRC
LBYTE:  ANI     0FH
; PREVOD HEXADECIMALNI CIFRY NA ASCII V "C" REG

HXASC:  ADI     90H
        DAA
        ACI     40H
        DAA
        MOV     C,A
        RET

; SKLADANI ADRES (VSTUP PARAMETRU) DO STACKU, POCET V C-REG

EXPRO:  JC      ERROR   ;# VERS."C" #
EXPR:   CALL    EQUAL   ; TISK =
        LXI     H,0
EX0:    CALL    ECHO
EX1:    MOV     B,A
        CPI     27H     ;'
        JZ      EX4
        CALL    ASHEX   ; HEX CIFRA ?
        JC      EX3     ; POSUV "HL" O 4 BITY VLEVO
        DAD     H
        DAD     H
        DAD     H
        DAD     H
        ORA     L
        MOV     L,A
        JMP     EX0     ; DALSI ZNAK

EX3:    MOV     A,B
        CALL    ANAL
        JNZ     ERROR   ; NENI HEX CIFRA
        XTHL
        PUSH    H
        DCR     C       ; CARKA, MEZERA
        JNZ     EXPRO   ; DALSI ADRESY
        RNC             ;#VERS."F"#
;
CRLF:   MVI     C,CR
        CALL    CO
        MVI     C,LF    ; DO CR,LF
;
CO:     PUSH    H
        LXI     H,COTB
        LDA     IOBYT
IOCOM:  ANI     3
        JMP     INJMP


EXPRM:  MVI     C,1
        LXI     H,0
        JMP     EX1
;
EX4:    CALL    CINCR   ;COMMAND
        MOV     B,A     ;SAVE
        JZ      EX3
        MOV     H,L
        MOV     L,A
        JMP     EX4

;  IODEF:... DEFINE USER I/O RUTINE

IODEF:  PUSH    B
        PUSH    H
        LXI     H,MEMTOP        ;NEW FUNCTION
        MOV     A,C     ; NUMBER
        CPI     8
        JZ      IODEF1
        JP      ERROR
        ADD     C
        ADD     C
        MOV     C,A
        MVI     B,0     ; OFFSET
        LXI     H,CILOC ; COMPUTE ADR
        DAD     B
        MVI     M,0C3H  ; JMP
        INX     H
IODEF1: MOV     M,E
        INX     H
        MOV     M,D     ; ADR
        POP     H       ; UNSAVE
        POP     B
        RET


; INKREMENTRUJE "HL" ,KONTROLUJE "HL"=0 NEBO
;   "HL">"DE"...CARRY=1

HILO:   INX     H
        MOV     A,H
        ORA     L
        STC
        RZ              ; NAVRAT PO "HL"=0000
COMPR:  MOV     A,D
        CMP     H
        RNZ
        MOV     A,E
        CMP     L
        RET

; READ ADR

RADR:   MVI     C,1
        CALL    EXPR
        POP     H
        RET


; READ NEW BYTE

RBYT:   PUSH    B
        PUSH    H
        CALL    EXPRM
        POP     D
        POP     H
        MOV     M,E
        MOV     A,B
        CPI     CR
        POP     B
        RET


; DISPLAY NEW ADR

DNADR:  CALL    CRLF
DADR:   CALL    DADR0
        JMP     SPACE


        IF      SP1A
; CHEK I/O STATUS BYTE

IOCHK:  LDA     IOBYT
        RET


; SET I/O STATUS BYTE

IOSET:  MOV     A,C
        STA     IOBYT
        RET
        ENDIF

; DISPLAY ADDRES INT0 "HL"

DADR0:  MOV     A,H
        CALL    DBYT
        MOV     A,L

; DISPLAY BYTE INT0 ACC

DBYT:   PUSH    PSW
        CALL    HBYTE
        CALL    CO
        POP     PSW
        CALL    LBYTE
        JMP     CO


; CHEK SIZE RAM MEMORY

MEMCK:  PUSH    H
        LHLD    MEMTOP
        MOV     A,L
        MOV     B,H
        POP     H
        RET

; PREVOD ZNAKU ASCII NA HEXADEC

ASHEX:  SUI     '0'     ;#VERS."F"#
        RC              ; <'0'
        CPI     17H     ; >'F'
        CMC
        RC
        CPI     10      ; '0'..'9'
        CMC
        RNC
        CPI     11H     ; 0AH..10H
        RC
        SUI     7       ; 'A'..'F'
        RET


CIMIN:  CALL    MINUS   ;-
;
CINCR:  CALL    ECHO
ANAL:   CPI     ','
ANAL0:  RZ
        CPI     ' '
        RZ
        CPI     CR
        STC
        RZ
        ORA     A
        RET             ; PO CR CARRY=1

; VYPIS TEXTU - HL ADRESA, D DELKA

TEXT:   MOV     C,M
        INX     H
        CALL    CO
        DCR     D
        JNZ     TEXT
        RET

DBYTE:  CALL    DBYT
SPACE:  MVI     C,' '   ; DISPLAY MEZERY
        JMP     CO
;
;
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;       I/O  DEVICE
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;
; T.V. PARAM.
WIDTH   EQU     40
HEIGHT  EQU     24
LINOF   EQU     64      ;OFFSET
LREST   EQU     LINOF - WIDTH
TVEND   EQU     TVBEG + 5E7H
ERS     EQU     1FH             ;ERASE SCREEN
EOL     EQU     1EH             ;ERASE END OF LINE
CTRLQ   EQU     11H     ;^Q-RESERVE
CTRLP   EQU     10H     ;^P-LIST
CURSOR  EQU     0A0H            ;CODE
HOME    EQU     1DH             ;HOME
;
;-------------------------------------------------

COINIT: LXI     H,TVBEG
        SHLD    CADR            ;SET CURSOR ADR
        MVI     C,ERS           ;CLEAR SCREEN
;
;%%%%%%%%%%%%%%%%%%%%%%%%%%
;       CONSOLE OUTPUT
;       <C>...WRITE ON SCREN
;
CRT:    PUSH    D
        PUSH    H
        LXI     H,COEX  ;RET-ADR
        PUSH    H       ;PUT TO STACK
        LHLD    CADR    ;CLEAR CURSOR
        LDA     CHAR    ;ADR RESTORE
        MOV     M,A     ;CHART
        CALL    COADR   ;COMPUTE ADR
        MOV     A,C
        CPI     ' '     ;IF ' '...'Z' THEN WRITE
        JNC     CRTWR   ;ELSE DECODE CONTROL
        CPI     CR      ;CHARTS AND DO
        JZ      CR@     ;CHANGE ON SCREEN
        CPI     LF
        JZ      LF@
        CPI     EOL
        JZ      EOL@    ;ERASE TO END LINE
        CPI     BACK
        JZ      BACK@   ;LEFT SHIFT
        CPI     HOME
        JZ      HOME@   ;LEFT UP
        CPI     ERS
        JZ      ERS@
        CPI     BELL
        JZ      BEEP
        RET
;
CRTWR:  LDA     MODE
        ANI     0C0H    ;MODE
        MOV     D,A     ; SAVE
        MOV     A,C     ;6.BITS
        ANI     3FH
        ORA     D       ;COMPOSITE
        MOV     M,A     ;WRITE!
        SUI     0C0H    ;DOUBLE ?
        CNC     CONXT   ;+
CONXT:  CALL    COADR   ;COMPUTE NEXT ADR
        MOV     A,D
        INR     A
        STA     COLUM   ;NEW POSITION
        SUI     WIDTH   ;END LINE
        RC              ;NO
        STA     COLUM   ;SET POSITION AND COMPUTE
; NEXT LINE
LF@:    MOV     A,E
        INR     A
        CPI     HEIGHT  ;END OF SCREEN?
        JC      LF@1    ;NO
        LHLD    RESL
        MVI     H,0
        CALL    COADR+3 ;FIRST LINE
        PUSH    B
        LDA     RESL    ;LINE COUNTER
        SUI     HEIGHT
        CMA
        MOV     C,A
ROLL:   MVI     B,WIDTH
        XCHG
ROLL1:  LXI     H,LINOF ;OFFSET
        DAD     D
        MOV     A,M
        STAX    D       ;COPY
        INX     D       ;+
        DCR     B
        JNZ     ROLL1   ;ALL LINE
        LXI     H,LREST ;NEW LINE
        DAD     D
        DCR     C
        JNZ     ROLL    ;NEXT LINE
        POP     B
;
ERS@:   CALL    EOL@
        LXI     D,LREST
        DAD     D
        LXI     D,TVEND-1
        CALL    COMPR
        JNC     ERS@
        RET
;
;
;  "EXIT" AND SET CURSOR
COEX:   CALL    COADR   ;WRITE CURSOR
        LDA     MODE
        RRC             ;CY=1.. LIST
        CC      LPR     ;PRINT ECHO
        MOV     A,M
        STA     CHAR    ;ADD SAVE CHAR
        SHLD    CADR
        LDA     MODE    ;#VERS."F"#
        ANI     20H     ;#SUPRESS CURSOR?
        JNZ     COEX1   ;#
        MVI     M,CURSOR
COEX1:  POP     H       ;UNSAVE
        POP     D
        MOV     A,C
        RET             ;END OF CONSOLE OUTPUT

;  SUBROUTINES
;--------------------------------------------------

COADR:  LHLD    LINE    ;COMPARE ADR <HL>
        PUSH    H
        MVI     H,0
        DAD     H
        DAD     H
        DAD     H
        DAD     H
        DAD     H
        DAD     H       ;64*
        LXI     D,TVBEG ;TV-RAM
        DAD     D       ;BEGIN LINE
        POP     D       ;SET DE
        MOV     A,L     ;D-COLUM
        ORA     D       ;E-LINE
        MOV     L,A     ;HL...ADR
        RET


; ERASE FROM CURSOR TO END LINE
EOL@:   MVI     M,' '
        INX     H
        MOV     A,L
        ANI     3FH
        CPI     WIDTH
        JC      EOL@
        RET

BACK@:  MOV     A,D     ;COLUMN:0 ?
        ORA     A
        JNZ     BAC@1   ;NO FINST POSITIONS
        INR     E       ;IF LINE=0 THEN BEGIN
        DCR     E       ;OF SCREEN
        RZ
        LDA     RESL    ;SAVE "RESERVE" PARTIONS
        CMP     E
        RZ              ;YES,GO OUT
        MOV     A,E     ;NO SET NEW LINE
        DCR     A
        STA     LINE
        MVI     A,WIDTH
BAC@1:  DCR     A
        DB      16H     ;MVI D,#
CR@:    XRA     A       ;CARIG. RETURN
        STA     COLUM
        RET

;SET CURSOR ON BEGIN "NORMAL" SCREEN
HOME@:  CALL    CR@     ;NULL
        LDA     RESL    ;"RESERVE" LINE SET
LF@1:   STA     LINE
        RET
;
; UNDERLINE
UCMD:   LDA     RESL    ;EMPTY ?
        ORA     A
        RZ              ;EMPTY
        DCR     A
        MOV     L,A
        MVI     H,0
        CALL    COADR+3
        MVI     D,WIDTH
RESX:   MOV     A,M     ;UNDER LINE
        ANI     3FH     ;ASCII
        ORA     B       ;PARAM
        MOV     M,A
        INX     H
        DCR     D
        JNZ     RESX
        RET
;**********************************************************
;
; LINE PRINTER
;
LPR:    PUSH    H
        LXI     H,2C01H
        MOV     M,C
        DCR     H
        MOV     M,L
        INR     H
LPR1:   MOV     A,M
        ADD     A
        JP      LPR1
        DCR     H
        MVI     M,3
        INR     H
LPR2:   MOV     A,M
        ADD     A
        JM      LPR2
        DCR     H
        MOV     M,L
        POP     H
        RET
;
;
; PUNCH OUTPUT
;
PUN:    RET             ; EMPTY
        DS      20      ; RESERVA
;
; READER INPUT
;
RDR:    STC             ; CHYBA SNIMACE
        RET
;
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        ORG     @R@
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
; SYSTEM RAM SAPI-1
;
RST1:   DS      21      ;RESTART VECTOR
;<<... USER & MONITOR STACK
;
;
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        ORG     @R@+090H
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
; MONITOR DATA
;
MSTAK:  DS      2       ; SAVE REGISTERS
ACSAV:  DS      2
BCSAV:  DS      2
DESAV:  DS      2
HLSAV:  DS      2
PCSAV:  DS      2
SPSAV:  DS      2
;
BRAD:   DS      2
INSTR:  DS      1
BRAD2:  DS      2
INST2:  DS      1
LASTC:  DS      1       ;LAST CODE "REPEAT"
CADR:   DS      2       ; CURSOR ADR
CHAR:   DS      1       ; CODE
FLAG:   DS      1       ; FLAG MEMBR
LIMIT:  DS      2       ; TIME LIMIT FOR AUTO REPEAT
@BT:    DS      1
@PED:   DS      1
UADR:   DS      2       ;USER ADR
SADR:   DS      2       ; START ADR
EADR:   DS      2       ; END ADR
SUM:    DS      1

;*******************************
;MONITOR PLUS DATA
JOINT:  DS      1
FNAME:  DS      11
BNO:    DS      1       ;BLOCK NUMSER,FILE NUMBER
BTO:    DS      1
BNI:    DS      1       ; --- " ---
BTI:    DS      1
ADRO:   DS      2
ADRI:   DS      2
PBITM:  DS      2
FND:    DS      1       ; FIND FLAG

;-------------------------
;       USER I/O DEVICE
;                       IODEF NUMBER
CILOC:  DS      3       ; (0)
COLOC:  DS      3       ; (1)
R1LOC:  DS      3       ; (2)
R2LOC:  DS      3       ; (3)
P1LOC:  DS      3       ; (4)
P2LOC:  DS      3       ; (5)
LILOC:  DS      3       ; (6)
CSLOC:  DS      3       ; (7)
;******************************
;<< EXTERNE OVLADANE FLAGY: >>
;******************************
MODE:   DS      1       ;CRT-MODE
@IF1:   DS      1       ;OPEN FLAGS
@IF2:   DS      1
@OF1:   DS      1
@OF2:   DS      1
LINE:   DS      1       ;LINE
COLUM:  DS      1       ;COLUMN
RESL:   DS      1       ;RESERVE
UBYTE:  DS      1       ;USER BYTE (REALTIME..)
@SFLG:  DS      1       ;#0..NO STOP
EXSER   EQU     $-MODE  ;EXTERNAL SERVICE
IOBYT:  DS      1       ;I/O CONTROL
MEMTOP: DS      2       ;MEMTOP "RAM"

;-------------------------
; I/O BUFFERS
        DS      1       ;BLOCK LABEL
BOUT:   DS      255     ;BLOCK LENGHT
BOEND   EQU     $
;
        DS      1       ; BLOCK LABELS
BIN:    DS      255     ;BLOCK  LENGHT
BIEND   EQU     $
;
WRNM:   DS      11
;=============================
        ORG     @R@ + 300H
;=============================
; "MAT" ARRAY
        DS      0FFH
;=============================
        ORG     @R@ + 400H
;=============================
; SYSTEM OR USER PROGRAMS
;---->>>>>>>>>>>
;
;
;
        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


8 bity / SAPI-1 / Programové vybavení / V4.x / ASM MONITOR



SAPI.cz - web o československých osmibitech, zejména SAPI-1. Provozuje EC1045 od roku 2011
Za korekce češtiny dekuji: MELSOFTovi, Silliconovi, Martinu Lukáškovi a NOSTALCOMPovi

Když začínám blbnout z 8bitů tak se chodím léčit mezi otaku.
Animefest.cz