DataMuseum.dk

Presents historical artifacts from the history of:

CR80 Hard and Floppy Disks

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about CR80 Hard and Floppy Disks

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦a71a0c101⟧ TextFile

    Length: 17762 (0x4562)
    Types: TextFile
    Names: »IOPROS.S«

Derivation

└─⟦8c095a7f3⟧ Bits:30005798 CR80 Disc Pack ( Vol ILS systemdisk XAMOS TOS 10:01 hard boot #43c 19-7-87/JFJ )
    └─ ⟦this⟧ »PREFIXES.D!XAMOS.D!ASM.D!IOPROS.S« 
└─⟦c2e810e96⟧ Bits:30005799 CR80 Disc Pack ( XAMOS 841129 ILS TOS 10-01 System Disk Tilhører ILS/MSG hard boot boot entry #43c )
    └─ ⟦this⟧ »PREFIXES.D!XAMOS.D!ASM.D!IOPROS.S« 

TextFile

;***********************************************************************
;                                                                      *
;          I / O   I N T E R F A C E   P R O C E D U R E S             *
;                                                                      *
;              CONFIG ID:   CSS356                                     *
;              VERSION:     1                                          *
;              DATE:        790801                                     *
;              AUTHOR:      JHO                                        *
;                                                                      *
;***********************************************************************

;       D E V I C E   D R I V E R   P R O C E D U R E S   F O R
;       I N T E R F A C I N G   T O    T H E   A M O S   I / O
;       S Y S T E M
BEGIN USE BASE
ENTRY XGETBYTE, XPUTBYTE, XGETWORD, XPUTWORD, XCHKOP, XNXFER, XTMOPR
ENTRY XNXOPR
ENTRY XBACKSPACE
EXTERNAL CONTLENGTH, XBASE
$@**GENS.D*DMADIF
AX=     XXFLNG                      ;   STANDARD XFER LIST ELEM
XFERSC:=             AX, AX=AX+1    ;   CURRENT XFER LIST SECTION (PSW)
BUFFSC:=             AX, AX=AX+1    ;   CURRENT BUFFER SECTION (PSW)
XFOCNT:=             AX, AX=AX+1    ;   ORIGINAL XFECNT
XTXFLNG:=            AX             ;   LENGTH OF EXTENDED XFER LIST ELE
CXFER:  0 REPEAT XTXFLNG -1         ;   CURRENT XFER LIST ELEM
SV12:   0     ; SAVE LOC USED BY XCHKOP, XPUTBYTE, XGETBYTE
SV14:   0     ; SAVE LOC USED BY XCHKOP, XPUTBYTE, XGETBYTE
SV15:   0     ; SAVE LOC USED BY XCHKOP, XPUTBYTE
SV27:   0     ; SAVE LOC USED BY XNXFER
SV24:   0     ; SAVE LOC USED BY XNXFER
SV17:   0     ; SAVE LOC USED BY XPUTBYTE, XGETBYTE
SV34:   0     ; SAVE LOC USED BY XNXOPR, XTMOPR
SV33:   0     ; SAVE LOC USED BY XNXOPR, XTMOPR
SV44:   0     ; SAVE LOC USED BY XGETWORD, XPUTWORD
SV43:   0     ; SAVE LOC USED BY XGETWORD
REGTOP: 0 REPEAT 6, REGSTC:         ;   REGISTER SAVE STACK
USE PROG

; PROCEDURE NEXT_OPERATION  I:(MSG)  O:(OPERATION/EVENT,BYTECOUNT)
;                                    R:(ERROR,CANCEL,COMMAND)
; THE REFERENCED SYSTEM MESSAGE IS INSPECTED. IF IT DOES NOT HAVE A PROP
; ER FORMAT, RETURN IS MADE TO ERROR.
; IF IT CONTAINS A CANCEL COMMAND, RETURN IS MADE TO CANCEL ND THE EVENT
; TO BE CANCELLED IS DELIVERED.
; IF THE MESSAGE CONTAINS A PROPER I/O COMMAND, RETURN IS MADE TO COMMAN
; AND THE OPERATION CODE AND BYTECOUNT ARE RETURNED.
; R0                 -                  BYTECOUNT(LEAST SIGNIFICANT PART
; R1                 REF(MSG)           BYTECOUNT(MOST  SIGNIFICANT PART
; R2                 -                  OPERATION/EVENT
; R4                 LINK               DEST
; RETURNS:
; LINK+0:     ERROR
; LINK+1:     CANCEL
; LINK+2:     COMMAND
XNXOPR:                             ; NEXT_OPERATION:
        MOV          R4  SV34       ;   SAVE(LINK)
        JMP          S4  XCHKOP     ;   CHECK_OPERATION(MSG
        JMPI &           SV34       ;     ERROR:      RETURN(ERROR),
        JMP &            L4         ;     CANCEL:     GOTO L4,
                                    ;     XFER:       CONTINUE)
        MOV          R3  SV33       ;   SAVE(3)
        JMP          S4  XGETWORD   ;   GETWORD(WORD,
        JMP &            XERR       ;     NONE:       GOTO ERR,
        MOV          R3         R2  ;     OK:         WORD=>OPERATION)
        MOVC  8                 R1  ;   FOR I:=1 TO 8 DO
L5:                                 ; L5:
        MOV          R3         R0  ;   WORD=>CNT.LOWER
        JMP          S4  XGETWORD   ;   GETWORD(WORD,
        JMP &            XERR       ;     NONE:       GOTO ERR,
                                    ;     OK:         CONTINUE)
        SOB          R1  L5         ;   ROF
        MOV          R3         R1  ;   WORD=>CNT.UPPER
        JMP          S4  XNXFER     ;   NEXT_XFER_ELEM(
        NOP                         ;     NONE:       CONTINUE,
                                    ;     OK:         CONTINUE)
        MOV   SV33              R3  ;   RESTORE(3)
        MOV   SV34              R4  ;
        JMP              2.     X4  ;   RETURN(COMMAND)
L4:                                 ; L4:
        MOV   SV34              R4  ;
        JMP              1.     X4  ;   RETURN(CANCEL)
XERR:                               ; ERR:
        MOV   SV33              R3  ;   RESTORE(3)
        JMPI             SV34       ;   RETURN(ERROR)

; PROCEDURE TERMINATE_OPERATION  I:(RESULT,BYTECOUNT)  R:(ERROR,OK)
; SKIPS FORWARD TO THE LAST XFER LIST ELEMENT AND STORES THE RESULT AND
; THE BYTECOUNT (=NUMBER OF XFERRED BYTES)
; R0                 RESULT             KEPT (COMPLETION CODE)
; R1                 BYTECOUNT (LEAST SIGNIFICANT PART)  KEPT
; R2                 BYTECOUNT (MOST  SIGNIFICANT PART)  KEPT
; R4                 LINK               DEST
; RETURNS:
; LINK+0:     ERROR
; LINK+1:     OK
XTMOPR:                             ; TERMINATE_OPERATION:
        MOV          R4  SV34       ;   SAVE(LINK)
        MOV          R3  SV33       ;   SAVE(3)
L7:                                 ; L7:
        JMP          S4  XNXFER     ;   NEXT_XFER_ELEM(
        JMP &            L8         ;     NONE:       GOTO L8,
        JMP &            L7         ;     OK:         GOTO L7)
L8:                                 ; L8:
        MOV          R0         R3  ;
        JMP          S4  XPUTWORD   ;   PUTWORD(RESULT,
        JMP &            XERR1      ;     FAULT:      GOTO ER1,
        JMP &            XERR1      ;     LAST:       GOTO ER1,
        MOV          R1         R3  ;     MORE:       CONTINUE)
        JMP          S4  XPUTWORD   ;   PUTWORD(BYTECNT.LOWER,
        JMP &            XERR1      ;     FAULT:      GOTO ER1,
        JMP &            XERR1      ;     LAST:       GOTO ER1,
        MOV          R2         R3  ;     MORE:       CONTINUE)
        JMP          S4  XPUTWORD   ;   PUTWORD(BYTECNT.UPPER,
        JMP &            XERR1      ;     FAULT:      GOTO ER1,
        NOP                         ;     LAST:       CONTINUE,
        MOV   SV33              R3  ;     MORE:       RESTORE(3))
        MOV   SV34              R4  ;
        JMP              1.     X4  ;   RETURN(OK)
XERR1:                              ; ER1D
        MOV   SV33              R3  ;   RESTORE(3)
        JMPI             SV34       ;   RETURN(ERROR)

; PROCEDURE CHECK_OPERATION  I:(MSG)  O:(EVENT)  R:(FAULT,CANCEL,XFER)
; THE REFERENCED SYSTEM MSG IS INSPECTED. IF IT DOES NOT HAVE A PROPER
; FORMAT, RETURN IS MADE TO FAULT.
; IF IT CONTAINS A CANCEL COMMAND, RETURN IS MADE TO CANCEL AND THE
; EVENT TO BE CANCELLED IS PRODUCED.
; IF IT CONTAINS A TRANSFER COMMAND, THE XFER LIST ELEMENT IS FETCHED IN
; TO CXFER. RETURN IS MADE TO XFER.
; R1                 REF(MSG)           KEPT
; R2                 -                  EVENT(IF CANCEL)
; R4                 LINK               DEST
; RETURNS:
; LINK+0:     FAULT
; LINK+1:     CANCEL
; LINK+2:     XFER
XCHKOP:                             ; CHECK_OPERATION:
        MOV          R4  SV14       ;   SAVE(LINK)
        MOV          R5  SV15       ;   SAVE(5)
        MOV          R2  SV12       ;   SAVE(2)
        MOV          R1         R5  ;
        MOV   DMAMOP.X5         R2  ;   MSG.DMAMOP
        SRL          R2  DMACMP ;       [DMACMP
        XTR          R2  DMACML ;       :DMACML]=>CMD
        INE          R2  DMAABT     ;   IF CMD=ABORT THEN
        JMP              L1         ;
        MOV   DMAMET.X5         R2  ;     MSG.DMAMET=>EVENT
        MOV   SV15              R5  ;     RESTORE(5)
        JMP              1.     X4  ;     RETURN(CANCEL)
L1:
        IEQ          R2  DMATXF     ;   IF CMD<>TRANSFER THEN
        JMP              L2         ;
        MOV   SV12              R2  ;     RESTORE(2)
        MOV   SV15              R5  ;     RESTORE(5)
        JMP              0.     X4  ;     RETURN(FAULT)
L2:
        MOV   DMAMOP.X5         R2  ;   MSG.DMAMOP
        XTR          R2  DMASTP+DMASTL;   [DMASTP:DMASTL]
        ADDC  #E800             R2  ;     +#E800 =>SCT
        MOV   DMAMLS.X5         R4  ;   MSG.DMAMLS=> LST
        MOVC  CXFER             R5  ;
        MOV          R2  XFERSC.X5  ;   SCT=>CXFER.XFERSC
        MOV          R4  XFELNK.X5  ;   LST=>CXFER.XFELNK
        JMP          S4  XNXFER     ;   NEXT_XFER_ELEM(
        MODC  -2                    ;     NONE:       FAULT=>OFFSET,
        MOD   SV14                  ;     OK:         XFER=>OFFSET)
        MOVC  0                 R4  ;   LINK+OFFSET=>LINK
        MOV   SV12              R2  ;   RESTORE(2)
        MOV   SV15              R5  ;   RESTORE(5)
        JMP              2.     X4  ;   RETURN(LINK)

; PROCEDURE NEXT_XFER_ELEM  R:(NONE, OK);
; THE NEXT XFER LEMENT IF ANY IS FETCHED TO CXFER.
; R4                 LINK               DEST
; RETURNS:
; LINK+0:     NONE
; LINK+1:     OK
XNXFER:                             ; NEXT_XFER_ELEM:
        MOV          R4  SV24       ;   SAVE(LINK)
        MOVC  CXFER             R4  ;
        SON              XFELNK.X4  ;   IF CXFER.XFELNK=0 THEN
        JMPI             SV24       ;     RETURN(NONE)
        MOV          R7  SV27       ;   SAVE(7)
        MOVC  REGSTC            R7  ;
        STC              6          ;   SAVE(0-6)
        MOV   XFELNK.X4         R7  ;   CXFER.XFELNK
        SUB   XBASE             R7  ;     -BASE=>FROM
        SVS                     R6  ;   SAVE(PSW)
        LDS              XFERSC.X4  ;   SWITCH(CXFER.XFERSC)
        UNS   XXFLNG-1              ;   FROM.0..(XXFLNG-1) =>TEMP
IF XXFLNG GT 5 THEN USE 16 FI
        LDS          R6             ;   RESTORE(PSW)
        MOVC  CXFER+XXFLNG      R7  ;
        STC              XXFLNG-1   ;   TEMP=> CXFER.0..(XXFLNG-1)
        XTR          R0  XFESTP+XFESTL; CXFER.XFECOM[XFESTP:XFESTL]
        ADDC  #E800             R0  ;     +#E800
IF XFECOM NE 0 THEN USE 16 FI
        MOVC  CXFER             R4  ;
        MOV          R0  BUFFSC.X4  ;     =>CXFER.BUFFSC
        MOV   XFECNT.X4         R0  ;   CXFER.XFECNT
        MOV          R0  XFOCNT.X4  ;     =>CXFER.XFOCNT
        MOVC  REGTOP            R7  ;
        UNS   6                     ;   RESTORE(0-6)
        MOV   SV27              R7  ;   RESTORE(7)
        MOV   SV24              R4  ;
        JMP              1.     X4  ;   RETURN(OK)

; PROCEDURE PUTBYTE I:(BYTE)  R:(ERROR,LAST,MORE)
; CHECKS THAT THE CURRENT XFER LIST ELEMENT CONTAINS A REFERENCE TO A
; NON EMPTY INPUT BUFFER. IF NOT, RETURN IS MADE TO ERROR.
; PUTS THE BYTE AT THE NEXT BYTE POSITION IN THE INPUT BUFFER. IF NOT RO
; OM FOR ANY MORE BYTES, RETURN IS MADE TO LAST.
; R3                 BYTE               KEPT
; R4                 LINK               DEST
; RETURNS:
; LINK+0:     ERROR
; LINK+1:     LAST
; LINK+2:     MORE
XPUTBYTE:
        MOV          R4  SV14       ;   SAVE(LINK)
PUTBYTE0:                           ; L0:
        MOV   CXFER+XFECOM      R4  ;   CXFER.XFECOM
        SRL          R4  XFECMP     ;     [XFECMP
        XTR          R4  XFECML     ;     :XFECML]=>CMD
        INE          R4  XFCINP     ;   IF CMD<>INPUT THEN
        JMPI             SV14       ;     RETURN(ERROR)
        MOVC  CXFER             R4  ;
        SON              XFECNT.X4  ;   IF CXFER.XFECNT=0 THEN
        JMPI             SV14       ;     RETURN(ERROR)
        MOV          R2  SV12       ;   SAVE(2)
        MOV   XFEADD.X4         R2  ;   CXFER.XFEADD=>ADDR
        SUB   XBASE             R2  ;   ADDR-BASE=>ADDR
        MOV          R7  SV17       ;   SAVE(7)
        MOV   XFEOFF.X4         R7  ;   CXFER.XFEOFF=>X
        MOV          R5  SV15       ;   SAVE(5)
        SVS                     R5  ;   SAVE(PSW)
        LDS              BUFFSC.X4  ;   SWITCH(CXFER.BUFFSC)
        MOD          R2             ;   BYTE(2*ADDR
        MOVB         R3  0.     X7  ;     +X):= BYTE
        LDS          R5             ;   RESTORE(PSW)
        INC              XFEOFF.X4  ;   INCR(CXFER.XFEOFF)
        DEC              XFECNT.X4  ;   DECR(CXFER.XFECNT)
        MOV   SV15              R5  ;   RESTORE(5)
        MOV   SV17              R7  ;   RESTORE(7)
        MOV   SV12              R2  ;   RESTORE(2)
PUTBYTE2:                           ; L2:
        SOZP             XFECNT.X4  ;   IF CXFER.XFECNT<>0 THEN
        MOV   SV14              R4  ;
        JMP              2.     X4  ;     RETURN(MORE)
        JMP          S4  XNXFER     ;   NEXT_XFER_ELEM(
        JMP &            PUTBYTE3   ;     NONE:       GOTO L3,
        MOVC  CXFER             R4  ;     OK:         CONTINUE)
        JMP              PUTBYTE2   ;   GOTO L2
PUTBYTE3:                           ; L3:
        MOV   SV14              R4  ;
        JMP              1.     X4  ;   RETURN(LAST)

; PROCEDURE GETBYTE  O:(BYTE)  R:(NONE,MORE)
; CHECKS THAT THE CURRENT XFER LIST ELEMENT CONTAINS A REF TO AN OUTPUT
; BUFFER. IF NOT, RETURN IS MADE TO NONE.
; IF THE BUFFER IS EMPTY, THE NEXT XFER LIST ELEMENT IS FETCHED TO CXFER
; THIS XFER LIST ELEMENT IS PROCESSED AS THE PREVIOUS.
; IF THE BUFFER IS NON EMPTY, THE NEXT BYTE IS DELIVERED AND RETURN IS
; MADE TO MORE.
; R3                 -                  BYTE.
; R4                 LINK               DEST
; RETURNS:
; LINK+0:     NONE
; LINK+1:     MORE
XGETBYTE:                           ; GETBYTE:
        MOV          R4  SV14       ;   SAVE(LINK)
GETBYTE0:                           ; L0:
        MOV   CXFER+XFECOM      R4  ;   CXFER.XFECOM
        SRL          R4  XFECMP     ;     [XFECMP
        XTR          R4  XFECML     ;     :XFECML]=> CMD
        INE          R4  XFCOUT     ;   IF CMD<>OUTPUT THEN
        JMPI             SV14       ;     RETURN(NONE)
        MOVC  CXFER             R4  ;
        SOZ              XFECNT.X4  ;   IF CXFER.XFECNT<>0 THEN
        JMP              GETBYTE1   ;     GOTO L1
        JMP          S4  XNXFER     ;   NEXT_XFER_ELEM(
        JMPI &           SV14       ;     NONE:       RETURN(NONE),
        JMP &            GETBYTE0   ;     OK:         GOTO L0)
GETBYTE1:                           ; L1:
        MOV   XFEADD.X4         R3  ;   CXFER.XFEADD=> ADDR
        SUB   XBASE             R3  ;   ADDR-BASE=>ADDR
        MOV          R7  SV17       ;   SAVE(7)
        MOV   XFEOFF.X4         R7  ;   CXFER.XFEOFF=> X
        MOV          R2  SV12       ;   SAVE(2)
        SVS                     R2  ;   SAVE(PSW)
        LDS              BUFFSC.X4  ;   SWITCH(CXFER.BUFFSC)
        MOD          R3             ;   (ADDR*2
        MOVB         X7         R3  ;     +X)=> BYTE
        LDS                     R2  ;   RESTORE(PSW)
        INC              XFEOFF.X4  ;   INCR(CXFER.XFECNT)
        DEC              XFECNT.X4  ;   DECR(CXFER.XFECNT)
        MOV   SV17              R7  ;   RESTORE(7)
        MOV   SV12              R2  ;   RESTORE(2)
        MOV   SV14              R4  ;
        JMP              1.     X4  ;   RETURN(MORE)

; BACKBYTE  R:(ERROR,DONE)
; IF POSSIBLE, THE BYTECNT AND OFFSET FOR THE CURRENT BUFFER ARE UPDATED
; CORRESPONDING TO A BACKSPACING.
; R4                 LINK               DEST
; RETURNS:
; LINK+0:     ERROR
; LINK+1:     DONE
XBACKSPACE:                         ; BACKSPACE:
        MOV          R4  SV14       ;   SAVE(LINK)
        MOVC  CXFER             R4  ;
        MOV          R2  SV12       ;   SAVE(2)
        MOV   XFECNT.X4         R2  ;   WITH CXFER DO
        IHSP         R2  XFOCNT.X4  ;     IF XFECNT>=XFOCNT THEN
        MOV   SV12              R2  ;       RESTORE(2)
        JMPI             SV14       ;       RETURN(ERROR)
        DEC              XFEOFF.X4  ;     DECR(XFEOFF)
        INC              XFECNT.X4  ;     INCR(XFECNT)
        MOV   SV12              R2  ;   RESTORE(2)
        MOV   SV14              R4  ;
        JMP              1.     X4  ;   RETURN(DONE)

; PROCEDURE PUTWORD  I:(WORD)  R:(ERROR,LAST,MORE)
; SIMILAR TO PUTBYTE.
; R3                 WORD               KEPT
; R4                 LINK               DEST
; RETURNS;
; LINK+0:     ERROR
; LINK+1:     LAST
; LINK+2:     MORE
XPUTWORD:                           ; PUTWORD
        MOV          R4  SV44       ;   SAVE(LINK)
        JMP          S4  XPUTBYTE   ;   PUTBYTE(WORD.LOWER,
        JMPI &           SV44       ;     ERROR:      RETURN(ERROR),
        JMPI &           SV44       ;     LAST:       RETURN(ERROR),
                                    ;     MORE:       CONTINUE)
        SWP                     R3  ;
        JMP          S4  XPUTBYTE   ;   PUTBYTE(WORD.UPPER,
        MODC  0          -1         ;     ERROR:      0=>OFFS,
        MODC  1          -2         ;     LAST:       1=>OFFS,
        MOVC  2                 R4  ;     MORE:       2=>OFFS)
        ADD   SV44              R4  ;   OFFS+LINK=>LINK
        SWP                     R3  ;
        JMP                     X4  ;   RETURN(LINK)

; PROCEDURE GETWORD O:(WORD)  R:(NONE,OK)
; SIMILAR TO GETBYTE, EXCEPT THE NEXT WORD IF ANY IS DELIVERED.
; R3                 -                  WORD
; R4                 LINK               DEST
; RETURNS:
; LINK+0:     NONE
; LINK+1:     OK
XGETWORD:                           ; GETWORD:
        MOV          R4  SV44       ;   SAVE(LINK)
        JMP          S4  XGETBYTE   ;   GETBYTE(LOWER,
        JMPI  &          SV44       ;     NONE:       RETURN(NONE),
                                    ;     OK:         CONTINUE)
        MOV          R3  SV43       ;
        JMP          S4  XGETBYTE   ;   GETBYTE(UPPER,
        JMPI &           SV44       ;     NONE:       RETURN(NONE),
                                    ;     OK:         CONTINUE)
        SWP                     R3  ;   UPPER<8
        ADD   SV43              R3  ;     +LOWER=>WORD
        MOV   SV44              R4  ;
        JMP              1.     X4  ;   RETURN(OK)
END ▶9a◀