Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #135120

Re: arithmetic shift right

Date 2026-06-01 18:18 +1000
Subject Re: arithmetic shift right
Newsgroups comp.lang.forth
References (3 earlier) <2026May26.094633@mips.complang.tuwien.ac.at> <6a15b394@news.ausics.net> <2026May30.202322@mips.complang.tuwien.ac.at> <6a1ba1a7$1@news.ausics.net> <2026May31.164348@mips.complang.tuwien.ac.at>
From dxf <dxforth@gmail.com>
Message-ID <6a1d403f$1@news.ausics.net> (permalink)
Organization Ausics - https://newsgroups.ausics.net

Show all headers | View raw


On 1/06/2026 12:43 am, Anton Ertl wrote:
> dxf <dxforth@gmail.com> writes:
>> Only reason to support an ASR
>> instruction is division of negative numbers.
> 
> Another common use is sign extension in cases where no more
> specialized sign-extension instruction exists; e.g., if you want to
> sign-extend an 11-bit field.

Interesting.  Of the classic 8-bit micros I believe only the 6800 had
an ASR instruction and that 1 bit at a time.  Sign extension on those
would have required some effort.  In the Forth-79 Reference Word Set
(Kitt Peak Forth stuff that didn't make it in?) there is:

  ASHIFT         n1 n2 -- n3

  Shift  the  value  n1 arithmetically n2 bits left  if  n2  is
  positive,  shifting  zeros  into  the  least-significant   bit
  positions.   If  n2 is negative, n1 is  shifted  right.   Sign
  extension is to be consistent with the processor's  arithmetic
  shift.

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Forth for a balanced ternary machine Matthias Koch <m.cook@gmx.net> - 2026-05-25 14:58 +0200
  Re: Forth for a balanced ternary machine anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-05-25 18:10 +0000
    Re: Forth for a balanced ternary machine dxf <dxforth@gmail.com> - 2026-05-26 15:53 +1000
      Re: Forth for a balanced ternary machine anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-05-26 07:46 +0000
        Re: Forth for a balanced ternary machine dxf <dxforth@gmail.com> - 2026-05-27 00:52 +1000
          Teaching Scenarios [Re: Forth for a balanced ternary machine] Buzz McCool <buzz_mccool@yahoo.com> - 2026-05-26 08:52 -0700
            Re: Teaching Scenarios [Re: Forth for a balanced ternary machine] dxf <dxforth@gmail.com> - 2026-05-28 21:03 +1000
            Re: Teaching Scenarios [Re: Forth for a balanced ternary machine] anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-05-30 20:16 +0000
              Re: Teaching Scenarios [Re: Forth for a balanced ternary machine] minforth <minforth@gmx.net> - 2026-05-31 11:02 +0200
                Re: Teaching Scenarios [Re: Forth for a balanced ternary machine] anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-05-31 14:13 +0000
          Division (was: Forth for a balanced ternary machine) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-05-30 18:23 +0000
            Re: Division dxf <dxforth@gmail.com> - 2026-05-31 12:49 +1000
              Re: Division anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-05-31 14:20 +0000
                Re: Division dxf <dxforth@gmail.com> - 2026-06-01 12:47 +1000
              arithmetic shift right (was: Division) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-05-31 14:43 +0000
                Re: arithmetic shift right dxf <dxforth@gmail.com> - 2026-06-01 18:18 +1000
      Re: Forth for a balanced ternary machine Hans Bezemer <the.beez.speaks@gmail.com> - 2026-06-01 23:23 +0200
        Re: Forth for a balanced ternary machine dxf <dxforth@gmail.com> - 2026-06-03 13:30 +1000
          Re: Forth for a balanced ternary machine Hans Bezemer <the.beez.speaks@gmail.com> - 2026-06-04 11:59 +0200
            Re: Forth for a balanced ternary machine anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-06-04 12:15 +0000
          Re: Forth for a balanced ternary machine anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-06-04 12:08 +0000
            Re: Forth for a balanced ternary machine dxf <dxforth@gmail.com> - 2026-06-05 17:37 +1000
              Re: Forth for a balanced ternary machine anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-06-05 09:22 +0000
    Re: Forth for a balanced ternary machine Matthias Koch <m.cook@gmx.net> - 2026-05-28 13:36 +0200

csiph-web