.TITLE I4CMP .IDENT /V01/ .ENABLE LC ; ; This module allows a FORTRAN or MACRO program to compare two ; doubleword (INTEGER*4) signed integers. ; ; Author: V01 12-Jun-80 Phil Stephensen-Payne ; ; Calling Sequence: ; ; This subroutine is called via the standard FORTRAN calling sequence as: ; ; CALL I4CMP (NUM1,NUM2 [,STATUS]) ; or ; STATUS = I4CMP (NUM1,NUM2) ; ; Where: ; NUM1 = Address of First Doubleword ; NUM2 = Address of Second Doubleword ; STATUS = Optional error return ; ; Errors returned: ; ; STATUS = 1 if the first number was less than the second ; 2 if the first number equalled the second ; 3 if the first number was greater than the second ; = -1 if a parameter error was detected ; ; External references: ; ; This module calls the subroutines PRMCHK ; ; ; I4CMP:: ; ; Specify number of parameters including error return. R5 not affected. ; MOV #3,R0 ; Check Number of Parameters CALL PRMCHK ; BCC 10$ ; If CC parameters OK - carry on JMP END ; Else error - exit immediately ; 10$: TST (R5)+ ;SKIP ARGUMENT COUNT MOV (R5)+,R0 ;GET ADDR OF 1ST NUMBER MOV (R5)+,R1 ;GET ADDR OF 2ND NUMBER CMP 2(R0),2(R1) ;COMPARE HI ORDER WORDS BGT 100$ ;BR IF 1ST>2ND BLT 80$ ;BR IF 1ST<2ND CMP (R0),(R1) ;COMPARE 1ST ORDER WORDS BHI 100$ ;BR IF 1ST>2ND BLO 80$ ;BR IF 1ST<2ND MOV #2,R0 ;1ST=2ND SO COND WORD =2 BR END ;AND EXIT 80$: MOV #1,R0 ;1ST<2ND SO COND WORD =1 BR END ;AND EXIT 100$: MOV #3,R0 ;1ST>2ND SO COND WORD =3 ; END: RETURN .END