?? oporttoram.cpp
字號:
/* Copyright (C) 1995, Tektronix Inc. All Rights Reserved. * * Usage Restrictions * * License is granted to copy, to use, and to make and to use derivative * works for research and evaluation purposes only. * * Disclaimer of Warranty * * These software programs are available to the user without any license * fee or royalty on an "as is" basis. Tektronix Inc. disclaims any and * all warranties, whether express, implied, or statuary, including any * implied warranties or merchantability or of fitness for a particular * purpose. In no event shall the copyright-holder be liable for any * incidental, punitive, or consequential damages of any kind whatsoever * arising from the use of these programs. * * This disclaimer of warranty extends to the user of these programs and * user's customers, employees, agents, transferees, successors, and * assigns. * * The Tektronix Inc. does not represent or warrant that the programs * furnished hereunder are free of infringement of any third-party * patents.*//* OPortToRam implementation */#include "stdafx.h"#include "Utilities.H"#include "OPortToRam.H"OPortToRam::OPortToRam (char* b, int length, int tf) : OutputPort(tf){ bits = b; bits_ptr = 0; bits_length = length; next_out = 0;}void OPortToRam::output_bit (char b){ buf[next_out] = b; next_out++; if (next_out > 7) { output_byte(); next_out = 0; }}void OPortToRam::output_byte (char b){ if (next_out != 0) { sys_error("not on byte boundary in output_byte"); } bits[bits_ptr] = b; bits_ptr++;}void OPortToRam::output_flush (){ if (next_out > 0) output_byte ();}inline char bit (char c){ return (c == '0') ? ((char) 0) : ((char) 1);}void OPortToRam::output_byte (){ for (int i = 0; i < 8 - next_out; i++) write_bit('0'); if (textflag) { for (int i = 0; i < 8; i++) { bits[bits_ptr] = buf[i]; bits_ptr++; } } else { char b = bit(buf[0]) << 7 | bit(buf[1]) << 6 | bit(buf[2]) << 5 | bit(buf[3]) << 4 | bit(buf[4]) << 3 | bit(buf[5]) << 2 | bit(buf[6]) << 1 | bit(buf[7]) << 0; bits[bits_ptr] = b; bits_ptr++; }}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -