%include "dkmain.imp-nolist"
%include "readdk.imp-nolist"
%include "writedk.imp-nolist"

%begin
 %integer n, i
 %integer start, end
 %byteinteger ch, v    

{main}
   init

{  do init
{  disk_w2 = 0
{  disk_w3 = 1
  %cycle
    prompt("block no. (FFFFFFFF to end) ($): "); rhex(n); skipsymbol
    %stop %if n = 16_FFFFFFFF
    write(n,0)
    newline
    i = ReadDisk( n )

    %if i <> 0 %start
      %cycle
        prompt("command ( 'z' =>zero; 'c' =>change; 'e' =>end )--")
        readsymbol( ch ); skipsymbol
        %if ch = 'z' %start
           printstring(" start & end byte (1-512 base 10) (<=0 to end) :"); newline
           prompt("start: ");
           read(start); skipsymbol
           %exitif start <= 0
           prompt(" end : ");
           read( end ); skipsymbol
           buffer(i) = 0    %for i= start, 1, end  
        %elseif ch = 'c'
           prompt("byte address (1-512 base 10): ");
           read(i); skipsymbol
           prompt("value ($xx): ");
           rhex(v); skipsymbol
           buffer(i) = v
        %elseif ch = 'e'
           %exit
        %finish
      %repeat
      WriteDisk( n )
      newline
    %finish

  %repeat
  bye
%endofprogram
