!loop
%begin
%option "-low"
%include "inc:util.imp"
%integer a=16_fe0000,k,z
  %onevent 0,9 %start
    %stopif event_event=9
    %stopunless event_sub=2
    printstring("error at "); phex(event_extra)
    newline
  %finish
  printstring("a"); newline; printstring("d"); newline
  printstring("@ "); phex(a); newline
  printstring("=/- value {!}"); newline
  printstring("? {!}"); newline
  printstring(". value"); newline
! set terminalmode(single)
! prompt("")
  %cycle
    readsymbol(k)
    %if k='@' %start
      %if nextsymbol='-' %start
        skipsymbol
        rhex(k); k = -k
      %elseif nextsymbol='+'
        skipsymbol
        rhex(k)
      %else
        rhex(a)
        k = 0
      %finish
      a = a+k
    %elseif k='a'
      a = a&\2
    %elseif k='d'
      a = a!2
    %elseif k='?'
      phex4(shortinteger(a)); newline
      %if nextsymbol='!' %start
        *move.l a,a0
rloop:  *move.w (a0),d0
        *bra rloop
      %finish
    %elseif k='=' %or k='-'
      rhex(k); shortinteger(a) = k
      %if nextsymbol='!' %start
        *move.l a,a0
        *move.l k,d0
wloop:  *move.w d0,(a0)
        *bra wloop
      %finish
    %elseif k='.'
      rhex(k); shortinteger(a) = k
      k = integer(a); phex(k); newline
      %cycle
        %cycle
          z = integer(a)
        %repeatuntil z#k
        phex(z); newline; k = z
      %repeat
    %finish
  %repeat
%end
