Esempio n. 1
0
  protected short op_sread() {
    byte ch;
    int tsize;
    int tbuf;
    int bufloc;

    tbuf = operands[0] & 0xFFFF;
    zm.update_status_line();
    zm.current_window.flush();
    zm.current_window.reset_line_count();
    // System.err.println("textbuf = " + Integer.toString(tbuf, 16));
    tsize = zm.memory_image[tbuf] & 0xFF;
    if (tsize < 2) zm.fatal("Text Buffer < 3 bytes");
    tsize--; /* reserve a byte for the terminator */
    bufloc = 1;
    while ((tsize != 0) && ((ch = zm.get_input_byte(true)) != 13) && (ch != 10)) {
      // System.err.println("sr_ch @ " + Integer.toString(tbuf+bufloc, 16) +
      // " : " + ch);
      if ((ch >= (byte) 'A') && (ch <= (byte) 'Z')) {
        ch = (byte) (ch - (byte) 'A' + (byte) 'a');
      }
      zm.memory_image[tbuf + bufloc] = ch;
      bufloc++;
      tsize--;
    }
    zm.memory_image[tbuf + bufloc] = 0;
    zm.zd.tokenise(tbuf + 1, bufloc - 1, operands[1] & 0xFFFF);
    return ZFALSE;
  }