$DEBUG Se$nd: do; /* This is part of the REMOTE-LOGON program. This module called if /* user is going to send a file from the remote computer to the /* NDS 2. */ /* Declare the variables used from Remote$Logon */ Declare buffer$ptr byte external; Declare buffer(128) byte external; Declare file$id byte public; $nolist include(:f3:common.lit) $nolist include(:f1:fileio.ext) $nolist include(:f1:serial.ext) Declare delimit(4) byte data (' TO '); Declare (character, i, match, status, count) byte; Declare (checksum, received$checksum, loop$count) byte; Send: Procedure public; /* Copy a file from the Remote Computer to the NDS 2 */ /* Say HELLO */ call Print$String(.(cr,lf,'Send V2.1',cr,lf,'$')); /* Skip through the command line looking for Remote Computer filename */ loop$count = 0; do i = 0 to buffer$ptr; if buffer(i) = ' ' then do; do while buffer(i) = ' '; i = i + 1; end; file$id = Open$File(.buffer(i),read$only); if file$id = 0ffh then do; call Print$String(.('Local file does not exist',cr,lf,'$')); call Serial$Output(CAN); /* Abort ISIS command */ return; end; /* File OK, activate the ISIS SEND command */ call Serial$Output(cr); /* Skip passed CR,LF sent from ISIS. If no problems at ISIS end of the link then we will be sent a ACK. */ character = Serial$Input; /* CR */ character = Serial$Input; /* LF */ character = Serial$Input; /* ACK? */ if character <> ACK then do; call console$output(character); return; end; /* Get a buffer ready to send */ status = Read$sector(file$id, .buffer); do while status = 0; call Serial$Output(STX); checksum = 0; do i = 0 to 127; character = buffer(i); checksum = checksum + character; call Serial$Output(character); end; call Serial$Output(checksum); call Serial$Output(ETX); /* Buffer sent OK. Was it received OK */ character = Serial$Input; if character = ACK then do; call console$output(loop$count + '0'); loop$count = (loop$count + 1) MOD 10; status = Read$sector(file$id, .buffer); end; else do; call Console$Output('?'); status = 0; /* Retransmit */ end; end; /* File sent */ status = Close$file(file$id); if status <> 0 then call Print$String(.(cr,lf, 'Could not close Local file',cr,lf,'$')); call Serial$Output(ETX); return; end; end; end Send; end Send;