anchor.diff:      gd2-spi-init
       gd2-unsel
   
  -    000 hostcmd     \ ACTIVE
  -    PCB_CRYSTAL if
  -        044 hostcmd     \ CLKEXT
  -    else
  -        062 hostcmd     \ CLK48M used for no-crystal parts like Gameduino2
  -    then
  -    068 hostcmd     \ CORERST
  -
  -    PCB_CRYSTAL 0= if
  -        tune
  -    then
  +    000 hostcmd         \ ACTIVE
  +
  +    custom @ execute
  +
  +    unstream
  +
  +    083 GD.REG_GPIO_DIR     GD.c!
  +    080 GD.REG_GPIO         GD.c!
  +    stream
  +;
  +
  +: common-init
  +    \ cr
  +    \ gd2-sel
  +    \     10 spix hex2.
  +    \     24 spix hex2.
  +    \     00 spix hex2.
  +    \     0 spix hex2.
  +    \     0 spix hex2.
  +    \     0 spix hex2.
  +    \ gd2-unsel
   
       0 wp !
       stream
  
positive.code:     GD.Clear
  
      GD.swap
      unstream
  
      1 GD.REG_PCLK_POL       GD.c!
      5 GD.REG_PCLK           GD.c!
  
      PCB_SWIZZLE GD.REG_SWIZZLE  GD.c!
      1 GD.REG_ROTATE         GD.c!
  
      083 GD.REG_GPIO_DIR     GD.c!
      080 GD.REG_GPIO         GD.c!
  
      stream
  ;
  
  decimal
  
negative.code:     
  : getspace  ( -- u )    \ u is the space in the command FIFO
      4092
      wp @ GD.REG_CMD_READ GD.@
      dup 3 and 0<> 124 and throw
      -
      mod4K -
  ;
  
  : gostream
      GD.RAM_CMD wp @ mod4K +
      GD.wa
  ;
  
  