%include "inc:util.imp-nolist"
%include "inc:fs.imp-nolist"
%include "fs.cons-noList"

%begin
{   %constinteger START = 16_860000
  %integer START = 16_860000 {as variable => asm code at end of program is OK

  %shortinteger uno
  %integer xno
  %integer startAddr
  %integer i, j
  %integer a {as address of buffer
  %byteintegerarray buffer(1:512)

{main}
  %label loop

  startAddr = START

{  uno = fcomm( LogOn, "u,ddsskk" );
{write(uno,6);space
  uno = userno
  xno = fcomm( OpenR + uno, "boot" );
write(xno,6);newline

  %cycle
printstring("loop: ");
     j = fcommr( ReadSq + xno, "", byteinteger( addr(buffer) ), 512 );
     a = addr(buffer)
     j = j>>2 - 1
write(j,4);space
phex(startAddr); newline
       *move.l  j,d0
       *move.l  a,a1
       *move.l  startAddr,a0
 loop: *move.l  (a1)+,(a0)+
       *dbra    d0,loop
     startAddr = startAddr + 512
  %repeatuntil j < 127
printstring("end !!!");
newline
  xno = fcomm( close + xno, "" );
printstring("to unix--->"); newline
  *move.l START,a0
  *jmp (a0)

%endofprogram
