Trailing-Edge
-
PDP-10 Archives
-
BB-Z759A-SM
-
cobol-source/move.mac
There are 10 other files named move.mac in the archive. Click here to see a list.
; UPD ID= 1035 on 4/29/83 at 12:05 AM by NIXON
TITLE MOVE FOR COBOTS
SUBTTL MOVE A STRING OF CHARACTERS /ACK
SEARCH COPYRT
SALL
;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
; OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
COPYRIGHT (C) 1974, 1983, 1984 BY DIGITAL EQUIPMENT CORPORATION
SEARCH LBLPRM ;DEFINE PARAMETERS.
%%LBLP==:%%LBLP
DEBUG==:DEBUG
EXTERN EASTB. ;FORCE EASTBL TO BE LOADED.
HISEG
.COPYRIGHT ;Put standard copyright statement in REL file
;REVISION HISTORY:
;V10 *****
; 15-DEC-74 /ACK CREATION.
; 26-JAN-75 /ACK REWRITTEN - BAD REGISTER ALLOCATION.
; (T1 AND CH WERE THE SAME REGISTER, WHICH
; SCREWED UP BLT'S.)
; 5/10/75 /DBT BIS CODE
;*****
COMMENT \
THIS ROUTINE MOVES A STRING OF CHARACTERS FROM ONE PLACE TO ANOTHER.
MOVEI 16,PARAMETER ADDRESS
PUSHJ 17,MOVE.
PARAMETERS:
WORD 1:
BYTE POINTER TO THE INPUT STRING.
WORD 2:
BITS 0-5 BYTE POINTER RESIDUE FOR THE OUTPUT STRING.
BIT 6 IGNORED (1 IF THE FIELD IS EXPLICTLY SIGNED.)
BITS 7-17 SIZE OF THE FIELDS.
BITS 18-35 ADDRESS OF THE FIRST BYTE OF THE OUTPUT FIELD.
RETURNS:
CALL+1 ALWAYS.
REGISTERS USED:
JAC, CNT, CH, TAC2, TAC3, TAC4, IPTR, OPTR
\
ENTRY MOVE.
ENTRY MVD.AL ;MOVE ALL "LIT" TO DEPENDING VARIABLE
EXTERN SET2. ;ROUTINE TO PICK UP THE PARAMETERS.
EXTERN RET.1 ;RETURNS TO CALL+1.
EXTERN PTIBS. ;POINTER TO THE INPUT BYTE SIZE.
EXTERN PTOBS. ;POINTER OT THE OUTPUT BYTE SIZE.
T1==TAC2
T2==TAC2+1 ;ALSO KNOWN AS TAC3.
T3==TAC4
;MAKE SURE THAT THE REGISTERS DON'T GET SCREWED UP.
CHKREG==0
IFN CNT-SRCCNT,<CHKREG==1>
IFE SRCPT-CNT,<CHKREG==1>
IFE SRCPT-OPTR,<CHKREG==1>
IFE DSTCNT-OPTR,<CHKREG==1>
IFN CHKREG,<
PRINTX ?MOVE IS BROKEN - BAD REGISTER ALLOCATION - CHECK LISTING.
CNT==CNT
SRCCNT==SRCCNT
SRCPT==SRCPT
DSTCNT==DSTCNT
OPTR==OPTR
>
MOVE.: JSP JAC, SET2. ;GO PICK UP THE PARAMETERS.
EXP RET.1 ;RETURN THROUGH HERE ON A NULL STRING.
LDB T3, PTIBS. ;GET THE INPUT BYTE SIZE.
DPB T3, PTOBS. ;MAKE IT THE OUTPUT BYTE SIZE.
CAIG CNT, ^D15 ;WORTH TRYING TO BLT?
JRST MOVE4 ;NO, GO MOVE CHAR'S.
HLRZ T1, IPTR
HLRZ T2, OPTR
CAIE T1, (T2) ;IS A BLT POSSIBLE?
JRST MOVE4 ;NO, GO MOVE CHAR'S.
;THE FOLLOWING LOOP SHOULD BE EXECUTED AT MOST FIVE TIMES.
TRZ T1, 770077 ;BYTE SIZE IN BITS 24-29.
MOVE1: LDB T2, [POINT 12,IPTR,11] ;NUMBER OF BITS LEFT.
CAIG T2, (T1) ;LESS THAN ONE BYTE LEFT?
AOJA IPTR, MOVE2 ;YES, GO MOVE UP TO NEXT WORD AND BLT.
CAIL T2, 4400 ;ARE WE AT A WORD BOUNDARY?
JRST MOVE3 ;YES, GO BLT.
ILDB CH, IPTR ;MOVE UP ONE BYTE.
IDPB CH, OPTR
SOJG CNT, MOVE1 ;LOOP.
IFE DEBUG,<
POPJ PP, ;THIS CAN'T HAPPEN! (BUT JUST IN
; CASE - NO HARM DONE.)
>
IFN DEBUG,<
OUTSTR [ASCIZ /
%MOVE fell through while looking for a word boundary at MOVE1+8 in MOVE.
/]
HALT RET.1
>
;MOVE UP TO THE NEXT WORD BECAUSE THERE IS LESS THAN 1 BYTE LEFT IN
; THIS ONE, THIS SHOULD ONLY HAPPEN FOR ASCII.
MOVE2: ADDI OPTR, 1
MOVEI CH, 44
DPB CH, [POINT 6,IPTR,5]
DPB CH, [POINT 6,OPTR,5]
;WE CAN BLT AT LEAST ONE WORD.
MOVE3: IDIV CNT, CHPRWD-6(T3) ;NUMBER OF WORDS TO TRANSFER (NOTE:
; NUMBER OF CHARACTERS LEFT IS IN CH).
HRRI T2, (OPTR) ;DESTINATION.
HRLI T2, (IPTR) ;SOURCE.
ADDI OPTR, (CNT) ;LAST WORD IN DESTINATION + 1.
BLT T2, -1(OPTR) ;FINALLY!!
JUMPE CH, RET.1 ;ANY MORE BYTES?
ADDI IPTR, (CNT) ;YES, UPDATE THE SOURCE POINTER.
MOVEI CNT, (CH) ;AND THE COUNT.
;COME HERE WHEN ALL ELSE FAILS.
MOVE4: MOVE SRCPT,IPTR ;SET UP THE AC'S FOR THE
MOVE DSTCNT,CNT ; MOVSLJ.
MOVE DSTPT,OPTR
EXTEND CNT,[MOVSLJ] ;DO THE MOVE.
JRST XTND.E
POPJ PP, ;DONE
INTERN XTND.E
XTND.E: OUTSTR [ASCIZ /?Error return from Extend instruction./]
JRST KILL.##
;HERE FOR "MOVE ALL "LIT" TO DEPENDING VARIABLE"
;CALL: AC4/ SIZE OF LIT
; AC7/ COMPUTED SIZE OF "B"
; AC5/ BYTE PTR TO "A"
; AC10/ BYTE PTR TO "B"
; NOTE: THE BYTE SIZES MUST BE EQUAL!!
;RETURNS: .+1 ALWAYS
;THIS ROUTINE SMASHES ACS 4 THRU 12 INCLUSIVE
MVD.AL: CAMLE 7,4 ;JUST 1 OCCURANCE OR LESS?
JRST MVDAL1 ;NO, MORE
JUMPLE 7,RET.1 ;JUMP IF NOTHING TO DO
ILDB 6,5 ;GET A CHAR
IDPB 6,10 ;AND STORE IT
SOJG 7,.-2 ; UNTIL DONE
POPJ PP, ; THEN RETURN
MVDAL1: MOVE 11,10 ;SAVE FIRST BP TO "B"
MOVE 12,4 ;SAVE # CHARS IN LITERAL
ILDB 6,5 ;GET A CHAR
IDPB 6,10 ; AND STORE IT
SOJG 4,.-2 ;LOOP FOR ALL CHARS IN THE LITERAL
SUBI 7,(12) ;GET # CHARS LEFT TO MOVE
MOVE 5,11 ;NOW MOVE FROM THE BEGINNING OF "B"
ILDB 6,5 ;TO WHERE WE LEFT OFF
IDPB 6,10 ;. .
SOJG 7,.-2 ;UNTIL "B" IS FILLED UP
POPJ PP, ; THEN RETURN
;TABLE OF CHARACTERS PER WORD:
CHPRWD: EXP 6
EXP 5
EXP 0
EXP 4
END