DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

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

See our Wiki for more about Rational R1000/400 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ L T

⟦1a24fb928⟧ TextFile

    Length: 17084 (0x42bc)
    Types: TextFile
    Names: »LEXICAL_COMPARE_ASM«

Derivation

└─⟦afbc8121e⟧ Bits:30000532 8mm tape, Rational 1000, MC68020_OS2000 7_2_2
    └─ ⟦77aa8350c⟧ »DATA« 
        └─⟦f794ecd1d⟧ 
            └─⟦24d1ddd49⟧ 
                └─⟦this⟧ 

TextFile

;    The use of this system is subject to the software license terms and
;    conditions agreed upon between Rational and the Customer.
;
;                Copyright 1988 by Rational.
;
;                          RESTRICTED RIGHTS LEGEND
;
;    Use, duplication, or disclosure by the Government is subject to
;    restrictions as set forth in subdivision (b)(3)(ii) of the Rights in
;    Technical Data and Computer Software clause at 52.227-7013.
;
;
;                Rational
;                3320 Scott Boulevard
;                Santa Clara, California 95054-3197
;
;   PROPRIETARY AND CONFIDENTIAL INFORMATION OF RATIONAL;
;   USE OR COPYING WITHOUT EXPRESS WRITTEN AUTHORIZATION
;   IS STRICTLY PROHIBITED.  THIS MATERIAL IS PROTECTED AS
;   AN UNPUBLISHED WORK UNDER THE U.S. COPYRIGHT ACT OF
;   1976.  CREATED 1988.  ALL RIGHTS RESERVED.
;
;

        .module         "lexical_compare"
        .include        "^^standard_assembler_include_file"
        .include        "^^common.runtime_definitions"
        comp_unit      runtime_compunit
        .sect           ada_runtime_code,code,relocatable,alignment:=2

        .gbl.a  __compare_8_bit_signed
        .gbl.a  __compare_8_bit_unsigned
        .gbl.a  __compare_16_bit_signed
        .gbl.a  __compare_16_bit_unsigned
        .gbl.a  __compare_32_bit_signed
        .gbl.a  __compare_32_bit_unsigned

;
;       function Compare_8_Bit_Signed (A          : Address;
;                                      B          : Address;
;                                      A_Length   : Integer;
;                                      B_Length   : Integer) return Integer;
;
;
        subprogram sp_rt,sp.compare_8_bit_signed,2#00100000_00000000#
__compare_8_bit_signed:
        .local

        $a'offset       equ 12
        $b'offset       equ 16
        $a_len'offset   equ 20
        $b_len'offset   equ 24

        pea     ($epilog:16,pc)
        link.w  a6,#0                   ; establish frame
        move.l  d2,-(sp)

        statement      stmt.end_prolog,0,0

;
;       if a'length > b'length then
;           d0 := 1;
;           d1 := b'length        
;       elsif a'length < b'length then
;           d0 := -1;
;           d1 := a'length
;       else
;           d0 := 0;      
;           d1 := a'length
;       end if;
;
        clr.l   d0                      ; assume lengths are equal
        move.l  ($a_len'offset,a6),d1   ; d1 := a'length
        move.l  ($b_len'offset,a6),d2   ; d2 := b'length
        movea.l ($a'offset,a6),a0       ; a0 := a'address
        movea.l ($b'offset,a6),a1       ; a1 := b'address
        cmp.l   d2,d1                   ; compare a'length to b'length
        beq.s   $do_comparison          ; lengths are equal
        blt.s   $a_is_short
$b_is_short:
        addq.l  #2,d0                   ; remember that A'Length > B'Length
        move.l  d2,d1                   ; use B'Length
$a_is_short:
        subq.l  #1,d0                   ; remember that A'Length < B'Length
;
;       if a > b then
;           d0 := d0 + 2;
;       elsif a < b then
;           d0 := d0 - 2;
;       end if;
;
$do_comparison:
        subq.l  #1,d1                   ; adjust for DBcc
        blt.s   $epilog                 ; check for null strings
        move.l  d1,d2                   ; d2 := count
        swap.w  d2                      ; d2 := high bits of count
$loop:  cmpm.b  (a0)+,(a1)+             ; compare two elements
        dbne.w  d1,$loop                ; compare the two vectors
        dbne.w  d2,$loop

$check_comparison_result:
        beq.s   $epilog
        bgt.s   $b_gt_a
        addq.l  #4,d0
$b_gt_a:subq.l  #2,d0

        statement      stmt.begin_epilog,0,0

$epilog:move.l  (-4,a6),d2              ; restore d2
        unlk    a6                      ; pop frame
        addq.l  #4,sp                   ; pop handler address
        rtd     #16                     ; return with result in d0
;
;       function Compare_8_Bit_Unsigned (A          : Address;
;                                        B          : Address;
;                                        A_Length   : Integer;
;                                        B_Length   : Integer) return Integer;
;
;
        subprogram sp_rt,sp.compare_8_bit_unsigned,2#00100000_00000000#
__compare_8_bit_unsigned:
        .local

        $a'offset       equ 12
        $b'offset       equ 16
        $a_len'offset   equ 20
        $b_len'offset   equ 24

        pea     ($epilog:16,pc)
        link.w  a6,#0                   ; establish frame
        move.l  d2,-(sp)

        statement      stmt.end_prolog,0,0

;
;       if a'length > b'length then
;           d0 := 1;
;           d1 := b'length        
;       elsif a'length < b'length then
;           d0 := -1;
;           d1 := a'length
;       else
;           d0 := 0;      
;           d1 := a'length
;       end if;
;
        clr.l   d0                      ; assume lengths are equal
        move.l  ($a_len'offset,a6),d1   ; d1 := a'length
        move.l  ($b_len'offset,a6),d2   ; d2 := b'length
        movea.l ($a'offset,a6),a0       ; a0 := a'address
        movea.l ($b'offset,a6),a1       ; a1 := b'address
        cmp.l   d2,d1                   ; compare a'length to b'length
        beq.s   $do_comparison          ; lengths are equal
        blt.s   $a_is_short
$b_is_short:
        addq.l  #2,d0                   ; remember that A'Length > B'Length
        move.l  d2,d1                   ; use B'Length
$a_is_short:
        subq.l  #1,d0                   ; remember that A'Length < B'Length
;
;       if a > b then
;           d0 := d0 + 2;
;       elsif a < b then
;           d0 := d0 - 2;
;       end if;
;
$do_comparison:
        subq.l  #1,d1                   ; adjust for DBcc
        blt.s   $epilog                 ; check for null strings
        move.l  d1,d2                   ; d2 := count
        swap.w  d2                      ; d2 := high bits of count
$loop:  cmpm.b  (a0)+,(a1)+             ; compare two elements
        dbne.w  d1,$loop                ; compare the two vectors
        dbne.w  d2,$loop

$check_comparison_result:
        beq.s   $epilog
        bhi.s   $b_gt_a
        addq.l  #4,d0
$b_gt_a:subq.l  #2,d0

        statement      stmt.begin_epilog,0,0

$epilog:move.l  (-4,a6),d2              ; restore d2
        unlk    a6                      ; pop frame
        addq.l  #4,sp                   ; pop handler address
        rtd     #16                     ; return with result in d0
;
;       function compare_16_Bit_Signed (A          : Address;
;                                       B          : Address;
;                                       A_Length   : Integer;
;                                       B_Length   : Integer) return Integer;
;
;
        subprogram sp_rt,sp.compare_16_bit_signed,2#00100000_00000000#
__compare_16_bit_signed:
        .local

        $a'offset       equ 12
        $b'offset       equ 16
        $a_len'offset   equ 20
        $b_len'offset   equ 24

        pea     ($epilog:16,pc)
        link.w  a6,#0                   ; establish frame
        move.l  d2,-(sp)

        statement      stmt.end_prolog,0,0

;
;       if a'length > b'length then
;           d0 := 1;
;           d1 := b'length        
;       elsif a'length < b'length then
;           d0 := -1;
;           d1 := a'length
;       else
;           d0 := 0;      
;           d1 := a'length
;       end if;
;
        clr.l   d0                      ; assume lengths are equal
        move.l  ($a_len'offset,a6),d1   ; d1 := a'length
        move.l  ($b_len'offset,a6),d2   ; d2 := b'length
        movea.l ($a'offset,a6),a0       ; a0 := a'address
        movea.l ($b'offset,a6),a1       ; a1 := b'address
        cmp.l   d2,d1                   ; compare a'length to b'length
        beq.s   $do_comparison          ; lengths are equal
        blt.s   $a_is_short
$b_is_short:
        addq.l  #2,d0                   ; remember that A'Length > B'Length
        move.l  d2,d1                   ; use B'Length
$a_is_short:
        subq.l  #1,d0                   ; remember that A'Length < B'Length
;
;       if a > b then
;           d0 := d0 + 2;
;       elsif a < b then
;           d0 := d0 - 2;
;       end if;
;
$do_comparison:
        lsr.l   #1,d1                   ; convert storage units to word count
        subq.l  #1,d1                   ; adjust for DBcc
        blt.s   $epilog                 ; check for null strings
        move.l  d1,d2                   ; d2 := count
        swap.w  d2                      ; d2 := high bits of count
$loop:  cmpm.w  (a0)+,(a1)+             ; compare two elements
        dbne.w  d1,$loop                ; compare the two vectors
        dbne.w  d2,$loop

$check_comparison_result:
        beq.s   $epilog
        bgt.s   $b_gt_a
        addq.l  #4,d0
$b_gt_a:subq.l  #2,d0

        statement      stmt.begin_epilog,0,0

$epilog:move.l  (-4,a6),d2              ; restore d2
        unlk    a6                      ; pop frame
        addq.l  #4,sp                   ; pop handler address
        rtd     #16                     ; return with result in d0
;
;       function Compare_16_Bit_Unsigned (A          : Address;
;                                         B          : Address;
;                                         A_Length   : Integer;
;                                         B_Length   : Integer) return Integer;
;
;
        subprogram sp_rt,sp.compare_16_bit_unsigned,2#00100000_00000000#
__compare_16_bit_unsigned:
        .local

        $a'offset       equ 12
        $b'offset       equ 16
        $a_len'offset   equ 20
        $b_len'offset   equ 24

        pea     ($epilog:16,pc)
        link.w  a6,#0                   ; establish frame
        move.l  d2,-(sp)

        statement      stmt.end_prolog,0,0

;
;       if a'length > b'length then
;           d0 := 1;
;           d1 := b'length        
;       elsif a'length < b'length then
;           d0 := -1;
;           d1 := a'length
;       else
;           d0 := 0;      
;           d1 := a'length
;       end if;
;
        clr.l   d0                      ; assume lengths are equal
        move.l  ($a_len'offset,a6),d1   ; d1 := a'length
        move.l  ($b_len'offset,a6),d2   ; d2 := b'length
        movea.l ($a'offset,a6),a0       ; a0 := a'address
        movea.l ($b'offset,a6),a1       ; a1 := b'address
        cmp.l   d2,d1                   ; compare a'length to b'length
        beq.s   $do_comparison          ; lengths are equal
        blt.s   $a_is_short
$b_is_short:
        addq.l  #2,d0                   ; remember that A'Length > B'Length
        move.l  d2,d1                   ; use B'Length
$a_is_short:
        subq.l  #1,d0                   ; remember that A'Length < B'Length
;
;       if a > b then
;           d0 := d0 + 2;
;       elsif a < b then
;           d0 := d0 - 2;
;       end if;
;
$do_comparison:
        lsr.l   #1,d1                   ; convert storage units to word count
        subq.l  #1,d1                   ; adjust for DBcc
        blt.s   $epilog                 ; check for null strings
        move.l  d1,d2                   ; d2 := count
        swap.w  d2                      ; d2 := high bits of count
$loop:  cmpm.w  (a0)+,(a1)+             ; compare two elements
        dbne.w  d1,$loop                ; compare the two vectors
        dbne.w  d2,$loop

$check_comparison_result:
        beq.s   $epilog
        bhi.s   $b_gt_a
        addq.l  #4,d0
$b_gt_a:subq.l  #2,d0

        statement      stmt.begin_epilog,0,0

$epilog:move.l  (-4,a6),d2              ; restore d2
        unlk    a6                      ; pop frame
        addq.l  #4,sp                   ; pop handler address
        rtd     #16                     ; return with result in d0
;
;       function Compare_32_Bit_Signed (A          : Address;
;                                       B          : Address;
;                                       A_Length   : Integer;
;                                       B_Length   : Integer) return Integer;
;
;
        subprogram sp_rt,sp.compare_32_bit_signed,2#00100000_00000000#
__compare_32_bit_signed:
        .local

        $a'offset       equ 12
        $b'offset       equ 16
        $a_len'offset   equ 20
        $b_len'offset   equ 24

        pea     ($epilog:16,pc)
        link.w  a6,#0                   ; establish frame
        move.l  d2,-(sp)

        statement      stmt.end_prolog,0,0

;
;       if a'length > b'length then
;           d0 := 1;
;           d1 := b'length        
;       elsif a'length < b'length then
;           d0 := -1;
;           d1 := a'length
;       else
;           d0 := 0;      
;           d1 := a'length
;       end if;
;
        clr.l   d0                      ; assume lengths are equal
        move.l  ($a_len'offset,a6),d1   ; d1 := a'length
        move.l  ($b_len'offset,a6),d2   ; d2 := b'length
        movea.l ($a'offset,a6),a0       ; a0 := a'address
        movea.l ($b'offset,a6),a1       ; a1 := b'address
        cmp.l   d2,d1                   ; compare a'length to b'length
        beq.s   $do_comparison          ; lengths are equal
        blt.s   $a_is_short
$b_is_short:
        addq.l  #2,d0                   ; remember that A'Length > B'Length
        move.l  d2,d1                   ; use B'Length
$a_is_short:
        subq.l  #1,d0                   ; remember that A'Length < B'Length
;
;       if a > b then
;           d0 := d0 + 2;
;       elsif a < b then
;           d0 := d0 - 2;
;       end if;
;
$do_comparison:
        lsr.l   #2,d1                   ; convert storage units to long count
        subq.l  #1,d1                   ; adjust for DBcc
        blt.s   $epilog                 ; check for null strings
        move.l  d1,d2                   ; d2 := count
        swap.w  d2                      ; d2 := high bits of count
$loop:  cmpm.l  (a0)+,(a1)+             ; compare two elements
        dbne.w  d1,$loop                ; compare the two vectors
        dbne.w  d2,$loop

$check_comparison_result:
        beq.s   $epilog
        bgt.s   $b_gt_a
        addq.l  #4,d0
$b_gt_a:subq.l  #2,d0

        statement      stmt.begin_epilog,0,0

$epilog:move.l  (-4,a6),d2              ; restore d2
        unlk    a6                      ; pop frame
        addq.l  #4,sp                   ; pop handler address
        rtd     #16                     ; return with result in d0
;
;       function Compare_32_Bit_Unsigned (A          : Address;
;                                         B          : Address;
;                                         A_Length   : Integer;
;                                         B_Length   : Integer) return Integer;
;
;
        subprogram sp_rt,sp.compare_32_bit_unsigned,2#00100000_00000000#
__compare_32_bit_unsigned:
        .local

        $a'offset       equ 12
        $b'offset       equ 16
        $a_len'offset   equ 20
        $b_len'offset   equ 24

        pea     ($epilog:16,pc)
        link.w  a6,#0                   ; establish frame
        move.l  d2,-(sp)

        statement      stmt.end_prolog,0,0

;
;       if a'length > b'length then
;           d0 := 1;
;           d1 := b'length        
;       elsif a'length < b'length then
;           d0 := -1;
;           d1 := a'length
;       else
;           d0 := 0;      
;           d1 := a'length
;       end if;
;
        clr.l   d0                      ; assume lengths are equal
        move.l  ($a_len'offset,a6),d1   ; d1 := a'length
        move.l  ($b_len'offset,a6),d2   ; d2 := b'length
        movea.l ($a'offset,a6),a0       ; a0 := a'address
        movea.l ($b'offset,a6),a1       ; a1 := b'address
        cmp.l   d2,d1                   ; compare a'length to b'length
        beq.s   $do_comparison          ; lengths are equal
        blt.s   $a_is_short
$b_is_short:
        addq.l  #2,d0                   ; remember that A'Length > B'Length
        move.l  d2,d1                   ; use B'Length
$a_is_short:
        subq.l  #1,d0                   ; remember that A'Length < B'Length
;
;       if a > b then
;           d0 := d0 + 2;
;       elsif a < b then
;           d0 := d0 - 2;
;       end if;
;
$do_comparison:
        lsr.l   #2,d1                   ; convert storage units to long count
        subq.l  #1,d1                   ; adjust for DBcc
        blt.s   $epilog                 ; check for null strings
        move.l  d1,d2                   ; d2 := count
        swap.w  d2                      ; d2 := high bits of count
$loop:  cmpm.l  (a0)+,(a1)+             ; compare two elements
        dbne.w  d1,$loop                ; compare the two vectors
        dbne.w  d2,$loop

$check_comparison_result:
        beq.s   $epilog
        bhi.s   $b_gt_a
        addq.l  #4,d0
$b_gt_a:subq.l  #2,d0

        statement      stmt.begin_epilog,0,0

$epilog:move.l  (-4,a6),d2              ; restore d2
        unlk    a6                      ; pop frame
        addq.l  #4,sp                   ; pop handler address
        rtd     #16                     ; return with result in d0

        end_subprograms
        
        .end