--- /dev/null
+* MS$IOR, MS$IOW - MEGASTORE PIO ACCESS ROUTINES
+*********************************************************************************
+*
+* M$IOR - READ DATA FROM AMPEX MEGASTORE
+* M$IOW - WRITE DATA TO AMPEX MEGASTORE
+*
+* PURPOSE:
+*
+* ACCESS AMPEX MEGASTORE RAM DISK SYSTEM VIA PROGRAMMED IO.
+* SHOULD WORK WITH HONEYWELL FIXED HEAD DISK AS WELL.
+*
+*
+* AUTHOR:
+*
+* PHILIPP HACHTMANN
+*
+*
+* REVISIONS:
+*
+* REV 1 29.10.2009 INITIAL VERSION
+*
+*
+* CALLING SEQUENCE:
+*
+* DISK ADDRESS IS EXPECTED IN A.
+* *
+* CALL MS$IOR CALL TO READ ROUTINE
+* DAC BUFFP POINTER TO READ BUFFER
+* DAC CNTP POINTER TO NUMBER OF BLOCKS TO TRANSFER
+* DAC 0 NEEDED FOR FORTRAN IV COMPATIBILITY
+*
+* CALL MS$IOW CALL TO WRITE ROUTINE
+* DAC BUFFP POINTER TO WRITE BUFFER
+* DAC CNTP POINTER TO NUMBER OF BLOCKS TO TRANSFER
+* DAC 0 NEEDED FOR FORTRAN IV COMPATIBILITY
+*
+* EVERY BLOCK CONTAINS 16 WORDS.
+* INDEX AND B REGISTER ARE PRESERVED.
+* RETURN VALUES ARE STORED IN A.
+*
+* RETURN VALUES:
+*
+* 0 - NO ERROR
+* 1 - PARITY ERROR
+* 2 - ACCESS ERROR, ADDRESSED BLOCK NONEXISTANT
+* 3 - TIMOUT ERROR, SHOULD NOT OCCUR
+* 4 - MEGASTORE NOT BUSY, UNSPECIFIED ABORT
+*
+*
+* REMARKS:
+*
+* THE FOLLOWING IS MORE CORRECT THAN THE MEGASTORE MANUAL.
+* IT HAS BEEN PAINFULLY VERIFIED AGAINST REALITY AND SCHEMATICS.
+*
+* SKS '522 SKIP IF *NO* TIMEOUT OCCURED
+*
+*
+* *******************************************************************************
+* EXPORT SYMBOLS
+*
+ SUBR MS$IOR,READ
+ SUBR MS$IOW,WRIT
+*
+ ABS
+ ORG '20000
+*
+*
+*********************************************************************************
+*
+* READ ROUTINE
+*
+READ DAC 0
+*
+ SSP CLEAR WRITE BIT IF ACCIDENTALLY SET
+ STA DADD SAVE DISK ADDRESS
+ LDA RDBR READ BRANCH INSTRUCTION FOR INNER LOOP
+ STA BRAN SAVE TO BRANCH LOCATION
+ LDA READ LOAD RETURN POINTER
+ JMP MAIN GO TO MAIN WORKING PART
+*
+*
+*********************************************************************************
+*
+* WRITE ROUTINE
+*
+WRIT DAC 0
+*
+ SSM SET WRITE BIT
+ STA DADD SAVE DISK ADDRESS
+ LDA WRBR READ BRANCH INSTRUCTION FOR INNER LOOP
+ STA BRAN SAVE TO BRANCH LOCATION
+ LDA WRIT LOAD RETURN POINTER
+ JMP MAIN GO TO MAIN WORKING PART
+*
+*
+********************************************************************************
+*
+* MAIN WORKING PART
+*
+MAIN STA RTPT SAVE RETURN POINTER
+ LDA* RTPT BUFFER ADDRESS
+ STA PTR SAVE TO POINTER
+ IRS RTPT
+ LDA* RTPT GET BLOCK COUNT POINTER
+ STA CNT TEMPORARILY STORE POINTER
+ LDA* CNT GET BLOCK COUNT VALUE
+ ALS 4 MULTIPLY BY 16, MAKING IT THE WORD COUNT
+ TCA NEGATE IT
+ STA CNT AND SET UP THE LOOP COUNTER
+ IRS RTPT JUMP OVER CALLER'S DAC 0
+*
+****************************************
+* INITIALIZE MEGASTORE
+*
+ LDA DADD LOAD DISK ADDRESS
+ OCP '722 ACTIVATE IO MODE
+ OTA '22 WRITE DISK ADDRESS TO MEGASTORE
+ JMP *-1 WAIT IF NEEDED
+*
+****************************************
+* WORKING LOOP
+*
+LOOP SKS '22 CHECK FOR READY - THERE IS NO REASON FOR THIS CHECK
+ JMP *-1 -- OTHER THAN IT IS NEEDED BY THE MEGASTORE!
+*
+BRAN HLT DYNAMICALLY FILLED WITH RDBR OR WRBR
+*
+RD CRA CLEAR A, ONE OF MY BOARDS DOESN'T DO INA '1022
+ INA '22 GET DATA FROM MEGASTORE
+* INA '1022 CAN BE USED FOR ABOVE TWO WHEN CONTROL HAS BEEN FIXED.
+RDBR JMP RD COPIED TO BRAN
+ STA* PTR STORE TO BUFFER
+ JMP EBRA TO END OF BRANCH
+*
+WR LDA* PTR
+ OTA '22 WRITE TO MEGASTORE
+WRBR JMP WR COPIED TO BRAN
+*
+****************************************
+* ERROR CHECKS
+*
+EBRA CRA
+ AOA ERROR CODE 1
+ SKS '0222 SKIP IF NO PARITY ERROR
+ JMP ABRT ABORT
+*
+ AOA ERROR CODE 2
+ SKS '322 SKIP IF NO ACCESS ERROR
+ JMP ABRT ABORT
+*
+ AOA ERROR CODE 3
+ SKS '522 SKIP IF *NO* TIMEOUT (SEE ERRATA)
+ JMP ABRT ABORT
+*
+ AOA ERROR CODE 4
+ SKS '122 SKIP IF MEGASTORE NOT BUSY - IT SHOULD BE BUSY!
+ SKP
+ JMP ABRT ABORT
+*
+****************************************
+* END OF LOOP
+ IRS PTR INCREMENT POINTER
+ IRS CNT LOOP COUNTER UPDATE
+ JMP LOOP LOOP AGAIN
+*
+****************************************
+* CLEANUP AND EXIT
+*
+ CRA
+ABRT SKS '122 CHECK FOR BUSY (AGAIN)
+ OCP '722 STOP MEGASTORE IF BUSY
+ JMP* RTPT RETURN VIA RETURN POINTER
+*
+*
+********************************************************************************
+*
+* VARIABLES
+*
+CNT DAC 0 LOOP COUNTER
+PTR DAC 0 DATA POINTER
+DADD DAC 0 DISK ADDRESS: BIT 1=WRITE, 15 LSB SECTOR ADDRESS
+RTPT DAC 0 RETURN POINTER
+*
+*
+********************************************************************************
+*
+* THE END OF EVERYTHING
+*
+ END
+*
+********************************************************************************
*
* TYPE OUT THE VALUE IN A. A STAYS UNCHANGED AFTERWARDS
*
- SUBR OCT
+ SUBR OCT,OCT6 PRINT OCTAL VALUE WITH 6 DIGITS + CR/LF
+ SUBR OCTN,N6 PRINT OCTAL VALUE WITH 6 DIGITS
*
+ SUBR OCTN1,N1 PRINT OCTAL, 1 DIGIT
+ SUBR OCTN2,N2 PRINT OCTAL, 2 DIGITS
+ SUBR OCTN3,N3 PRINT OCTAL, 3 DIGITS
+ SUBR OCTN4,N4 PRINT OCTAL, 4 DIGITS
+ SUBR OCTN5,N5 PRINT OCTAL, 5 DIGITS
+ SUBR OCTN6,N6 PRINT OCTAL, 6 DIGITS
+ SUBR OCT1 PRINT OCTAL, 1 DIGIT
+ SUBR OCT2 PRINT OCTAL, 2 DIGITS
+ SUBR OCT3 PRINT OCTAL, 3 DIGITS
+ SUBR OCT4 PRINT OCTAL, 4 DIGITS
+ SUBR OCT5 PRINT OCTAL, 5 DIGITS
+ SUBR OCT6 PRINT OCTAL, 6 DIGITS
*
+ SUBR TP TYPE OUT LETTER IN A
+ SUBR CR PRINT CR
+ SUBR LF PRINT LF
+ SUBR SP PRINT A SPACE CHARACTER
+ SUBR NL PRINT CR/LF
+ SUBR TYPE,TEXT
+*
+*
+********************************************************************************
+*
REL
-OCT DAC **
- STA ATMP
+ ORG 0
+*
+********************************************************************************
+*
+*
+TP DAC 0
SKS '104
JMP *-1
OCP '104
- IAB SAVE TO B
- STA BTMP
- CRA
- LLR 1
- ADD =48
- OTA '4 ASR OUTPUT
+ OTA '4 TYPE ON ASR
JMP *-1
- CRA
- LLR 3
- ADD =48
- OTA 4 ASR OUTPUT
- OTA 4
- JMP *-1
- CRA
- LLR 3
- ADD =48
- OTA '4 ASR OUTPUT
- OTA 4
- JMP *-1
- CRA
- LLR 3
- ADD =48
- OTA '4 ASR OUTPUT
- OTA 4
+ SKS '4
JMP *-1
+ JMP* TP RETURN
+*
+*
+********************************************************************************
+*
+OCT6 DAC 0
+ JST N6
+ JST NL
+ JMP* OCT6
+OCT5 DAC 0
+ JST N5
+ JST NL
+ JMP* OCT5
+OCT4 DAC 0
+ JST N4
+ JST NL
+ JMP* OCT4
+OCT3 DAC 0
+ JST N3
+ JST NL
+ JMP* OCT3
+OCT2 DAC 0
+ JST N2
+ JST NL
+ JMP* OCT2
+OCT1 DAC 0
+ JST N1
+ JST NL
+ JMP* OCT1
+*
+********************************************************************************
+*
+N1 DAC 0
+ JST SAVE
+ LDA =-6
+ JMP NGO
+N2 DAC 0
+ JST SAVE
+ LDA =-5
+ JMP NGO
+N3 DAC 0
+ JST SAVE
+ LDA =-4
+ JMP NGO
+N4 DAC 0
+ JST SAVE
+ LDA =-3
+ JMP NGO
+N5 DAC 0
+ JST SAVE
+ LDA =-2
+ JMP NGO
+N6 DAC 0
+ JST SAVE
+ LDA =-1
+ JMP NGO
+*
+****************************************
+*
+SAVE DAC 0
+ STA ATMP
+ IAB
+ STA BTMP
+ JMP* SAVE
+*
+****************************************
+*
+NGO STA PCNT
+ AOA
+ ALS 2 MULTIPLY BY 4
+ STA 0 TO INDEX REGISTER
+ LDA =-7
+ STA CNT
+*
CRA
+ LRR 5 VORSPANNUNG
+ IRS CNT
LLR 3
- ADD =48
- OTA '4 ASR OUTPUT
- OTA 4
- JMP *-1
+ IRS PCNT
+ JMP *-3
+*
+NXL LLR 3
+ ADD ZERO
+ JST TP
CRA
- LLR 3
- ADD =48
- OTA '4 ASR OUTPUT
- OTA 4
- JMP *-1
-*
- LDA =10
- OTA '4
- JMP *-1
- LDA =13
- OTA '4
- JMP *-1
- LDA =13
- OTA '4
- JMP *-1
-*
+ IRS CNT
+ JMP NXL
LDA BTMP
IAB
- LDA ATMP
- JMP* OCT
+ LDA ATMP
+ JMP* N6,1 EVIL!!!
*
+*
+****************************************
+*
+*
ATMP DAC ** TEMPORARY STORAGE FOR A
-BTMP DAC ** TEMPORARY STORAGE FOR B
+BTMP DAC ** TEMPORARY STORAGE FOR B
+PCNT DAC **
+CNT DAC **
+ZERO DEC 48 CHARACTER ZERO
+*
+********************************************************************************
+*
+CR DAC 0
+ STA ATMP
+ LDA =13
+ JST TP
+ LDA ATMP
+ JMP* CR
+*
+LF DAC 0
+ STA ATMP
+ LDA =10
+ JST TP
+ LDA ATMP
+ JMP* LF
+*
+NL DAC 0
+ JST CR
+ JST LF
+ JMP* NL
+*
+SP DAC 0
+ STA ATMP
+ LDA ='040
+ JST TP
+ LDA ATMP
+ JMP* SP
+*
+*
+********************************************************************************
+*
+TEXT DAC 0
+ STA ATMP
+ LDA* TEXT GET POINTER
+ STA PTR
+ IRS TEXT RETURN ADDRESS
+*
+TLOP LDA* PTR
+*
+ SNZ
+ JMP TDON
+*
+ ICL COPY DOWN
+ SZE DON'T PRINT ZEROES
+ JST TP
+ LDA* PTR
+ CAL CLEAR UPPER HALF
+ SZE DON'T PRINT ZEROES
+ JST TP
+*
+ IRS PTR
+ JMP TLOP
+*
+TDON LDA ATMP
+ JMP* TEXT
+*
+PTR DAC 0
*
********************************************************************************
*