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


Groups > comp.lang.forth > #134718

Re: RTUCK

Date 2026-03-18 04:36 +1100
Subject Re: RTUCK
Newsgroups comp.lang.forth
References <nnd$17c84e15$6375b90d@a7e18c8a20cb4588>
From dxf <dxforth@gmail.com>
Message-ID <69b99106$1@news.ausics.net> (permalink)
Organization Ausics - https://newsgroups.ausics.net

Show all headers | View raw


On 18/03/2026 1:31 am, albert@spenarnc.xs4all.nl wrote:
> I recall the definition of coroutine call:
> 
> CO  :
> Return to the caller, suspending interpretation of the current
> definition, such that when the caller exits, this definition is
> resumed
> 
> HEX: " temparily switch to HEX for the duration of the current
> definition."
> 
> A typical use of HEX: is as follows
> 
> ( print BYTE in hex )
>  : B.  HEX: S>D <# # # #>   TYPE ;
>  ( print SINGLE in hex )
>      : 4?  1+ 4 MOD 0= IF &, HOLD THEN ; \ print &, at regular intervals.
>  : H.  HEX: S>D <# 2 CELLS 1- 0 DO # I 4? LOOP # #>   TYPE ;
>  (  print DOUBLE in hex )
>  : DH. HEX: <# 4 CELLS 1- 0 DO # I 4? LOOP # #>   TYPE ;
> 
> HEX: is an example use of the use of CO (coroutine).
> VARIABLE BASE-TEMP
> : HEX:
>     BASE @ BASE-TEMP !
>     HEX CO
>     BASE-TEMP @ BASE !
> ;
> This is ugly so you are tempted to do

go back to regular methods?

: (H.N) ( u +n -- a2 u2 )
  base @ >r  hex  <#  0 tuck ?do  #
  i 1+ 4 mod 0= if  [char] , hold  then  loop  #>
  over c@  [char] , =  1 and /string  r> base ! ;

: (H.)  ( u -- adr len )  [ 2 cells ] literal (h.n) ;
: (HW.) ( u -- adr len )  4 (h.n) ;
: (HB.) ( u -- adr len )  2 (h.n) ;
: (HD.) ( ud -- adr len )  (h.) dup >r holds (h.) r> 1+ negate /string ;

-1 (h.) type FFFF,FFFF,FFFF,FFFF ok
-1 (hw.) type FFFF ok
-1 (hb.) type FF ok
-1 -1 (hd.) type FFFF,FFFF,FFFF,FFFF,FFFF,FFFF,FFFF,FFFF ok

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


Thread

RTUCK albert@spenarnc.xs4all.nl - 2026-03-17 15:31 +0100
  Re: RTUCK Hans Bezemer <the.beez.speaks@gmail.com> - 2026-03-17 16:10 +0100
  Re: RTUCK dxf <dxforth@gmail.com> - 2026-03-18 04:36 +1100
    Re: RTUCK albert@spenarnc.xs4all.nl - 2026-03-18 12:47 +0100
      Re: RTUCK dxf <dxforth@gmail.com> - 2026-03-19 11:51 +1100
        Re: RTUCK dxf <dxforth@gmail.com> - 2026-03-19 14:50 +1100
          Re: RTUCK albert@spenarnc.xs4all.nl - 2026-03-19 12:16 +0100
      Re: RTUCK Hans Bezemer <the.beez.speaks@gmail.com> - 2026-03-19 18:52 +0100
        Re: RTUCK thresh3@fastmail.com (Lev) - 2026-03-19 13:38 -0500
          Re: RTUCK Paul Rubin <no.email@nospam.invalid> - 2026-03-19 16:16 -0700
            Re: RTUCK thresh3@fastmail.com (Lev) - 2026-03-19 23:17 +0000
            Re: RTUCK thresh3@fastmail.com (Lev) - 2026-03-19 20:18 -0500
          Re: RTUCK albert@spenarnc.xs4all.nl - 2026-03-20 12:34 +0100
        Re: RTUCK albert@spenarnc.xs4all.nl - 2026-03-20 12:14 +0100
  Re: RTUCK Paul Rubin <no.email@nospam.invalid> - 2026-03-21 02:31 -0700
    Re: RTUCK minforth <minforth@gmx.net> - 2026-03-21 11:43 +0100
    Re: RTUCK albert@spenarnc.xs4all.nl - 2026-03-21 12:59 +0100
      Re: RTUCK albert@spenarnc.xs4all.nl - 2026-03-22 13:27 +0100

csiph-web