anchor.diff:      uart-key? if uart-key emit then
       \ break out of terminal loop when ctrl-x is seen
       key? if key dup 24 = if drop exit then uart-emit then
  -    pause
  +\   pause
     again ;
   
   : x  RST ioc! 1 ms RST ios! ;
  
positive.code:   IMODE-FLOAT SCLK2 io-mode!
    OMODE-AF-PP MISO2 io-mode!
    IMODE-FLOAT MOSI2 io-mode!
    14 bit RCC-APB1ENR bis!  \ set SPI2EN
    %11 SPI2-CR2 !  \ enable TX and RX DMA
    6 bit SPI2-CR1 !  \ clk/2, slave mode, enable
    0 freply c!  \ reply byte is zero, i.e. idle
    $FF SPI2-DR !  \ prime the SPI status reply
  ;
  
  task: disktask
  
negative.code: 
  : firq ( -- )
    12 bit EXTI-PR !
    0 DMA1-CCR5 !
    0 DMA1-CCR4 !
    SPI2-DR @ drop SPI2-SR @ drop  \ clear SPI2 buffers and errors
    0 SPI2-CR1 !  \ disable
    fwrbuf c@ if -1 freply ! disktask wake then
    spi2-setup
    freply @ SPI2-DR !  \ prime the SPI status reply
    dma-setup
    %11 SPI2-CR2 !  \ enable TX and RX DMA
  \ 6 bit SPI2-CR1 !  \ slave mode, enable
    LED iox!
  ;
  
  