home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / ENTERPRS / CPM / UTILS / A / ARC20.ARC / ARCMACS.ARC / SHIFT.MAC < prev    next >
Text File  |  1989-10-17  |  946b  |  55 lines

  1. ; 32-Bit Shift_Long f}r Turbo
  2. ; 151089 Tilmann Reh
  3.  
  4.     .z80
  5.     extrn    n,lw
  6.  
  7.     ld    ix,(lw)        ; Zeiger auf Langwort
  8.     ld    l,(ix)
  9.     ld    h,(ix+1)
  10.     ld    e,(ix+2)
  11.     ld    d,(ix+3)    ; Langwort in DEHL
  12.     ld    bc,(n)        ; Anzahl Schiebungen in BC
  13.     ld    a,b
  14.     or    c
  15.     ret    z        ; nicht schieben: Ende
  16.     bit    7,b
  17.     jr    nz,shrn        ; Anzahl negativ: rechts schieben
  18.  
  19. shln:    inc    b
  20.     dec    b
  21.     jr    nz,nul        ; B<>0: Ergebnis mu~ 0 sein!
  22.     ld    a,c
  23.     and    11100000b
  24.     jr    nz,nul        ; }ber 31 Bit: Ergebnis 0
  25.     ld    b,c
  26. loopl:    sla    l
  27.     rl    h
  28.     rl    e
  29.     rl    d
  30.     djnz    loopl        ; schieben
  31.     jr    ende        ; Ergebnis speichern
  32.  
  33. shrn:    inc    b
  34.     jr    nz,nul        ; B<>FF : Ergebnis 0
  35.     ld    a,c
  36.     neg
  37.     ld    b,a        ; Anzahl nach B
  38.     and    11100000b
  39.     jr    nz,nul        ; }ber 31 : Ergebnis 0
  40. loopr:    srl    d
  41.     rr    e
  42.     rr    h
  43.     rr    l
  44.     djnz    loopr        ; schieben
  45.     jr    ende        ; Ergebnis speichern
  46.  
  47. nul:    ld    de,0        ; Ergebnis 0 zun{chst in Register
  48.     ld    hl,0
  49. ende:    ld    (ix+3),d
  50.     ld    (ix+2),e
  51.     ld    (ix+1),h
  52.     ld    (ix),l        ; Ergebnis speichern
  53.  
  54.     end
  55.