?login_element?

Subversion Repositories NedoOS

Rev

Blame | Last modification | View Log | Download

  1.  ifndef included_xmul3
  2.  define included_xmul3
  3.  include "../../common/pushpop.asm"
  4.  include "../../common/mov.asm"
  5.  include "../routines/rr64.asm"
  6.  include "../routines/add64.asm"
  7.  
  8. xmul3:
  9. ;535+{0,7+rr64}+{0,31}+2*mov10+mov8+adc64
  10. ;1365-{0,1}+{0,31}
  11. ;min: 1364scc
  12. ;max: 1396cc
  13. ;avg: 1380cc
  14.   call pushpop
  15.   push bc
  16.   call xmul3pp;+_
  17.   pop de
  18.   ld hl,xOP1
  19.   jp mov10
  20. xmul3pp;_:
  21.   ld de,xOP1
  22.   call mov10
  23.   ld hl,(xOP1+8)
  24.   ld a,h
  25.   or l
  26.   ret z
  27.   ld hl,xOP1
  28.   call mov8
  29.   dec hl : srl (hl)
  30.   dec hl : rr (hl)
  31.   dec hl : rr (hl)
  32.   dec hl : rr (hl)
  33.   dec hl : rr (hl)
  34.   dec hl : rr (hl)
  35.   dec hl : rr (hl)
  36.   dec hl : rr (hl)
  37.   ld de,xOP2
  38.   ex de,hl
  39.   call adc64
  40.   ex de,hl
  41.   push af
  42.   call c,rr64
  43.   ld hl,xOP1+8
  44.   pop af
  45.   ld a,(hl)
  46.   adc a,1
  47.   ld (hl),a
  48.   ret nc
  49.   inc hl
  50.   ld a,(hl)
  51.   inc (hl)
  52.   xor (hl)
  53.   ret p
  54. constmul_overflow:
  55.   xor $80
  56.   ld (hl),a
  57.   ld hl,xOP1+7
  58.   ld (hl),-1
  59.   ret
  60.  endif
  61.