?? lapm.c
字號:
/* * * Stuff that does lapm (whatever that is!). * * Copyright (c) 1999 Richard J.M. Close * * Can be freely distributed and used under the terms of the GNU GPL. */#include "lapm.h"void lapm_init(void){ mnp_init_variables(); lapm_init_variables(); x_send_mail(0x74, 1, 0, 0); if (x_modem_originate == 1) lapm_state = 1; else lapm_state = 2; lapm_reset_timer();}bool dp_lapm_error_check(void){ unsigned int eax, ecx, edx; eax = x_status[0x22] + (256 * x_status[0x23]); // was word_4aa42 edx = lapm_errors; if (eax != edx){ good_ff56_count = 0; dp_bGoodAuto = false; } if (lapm_local_busy == 1){ if (lapm_counter < 0xc8) lapm_counter = 0x0C8; lapm_errors = eax; eax = x_status[0x20] + (256 * x_status[0x21]); // was word_4aa40 lapm_frames = eax; return false; } if (S_auto_rate != 1) return false; ecx = x_status[0x20] + (256 * x_status[0x21]); // was word_4aa40 if (lapm_frames != ecx) lapm_counter++; if (lapm_counter > 0x190) lapm_counter = 0x190; lapm_frames = ecx; if (edx == eax) return false; lapm_errors = eax; if (lapm_counter < 0x32) return true; lapm_counter = lapm_counter + 0xFFCE; return false;}void dp_lapm_error_check_init (void){ unsigned short ax; ax = x_status[0x22] + (256 * x_status[0x23]); // was word_4aa42 lapm_counter = 0xC8; lapm_errors = ax; ax = x_status[0x20] + (256 * x_status[0x21]); // was word_4aa40 lapm_frames = ax;}void dp_lapm_auto_rate(void){ unsigned int eax; if (!dp_lapm_error_check()) return; if (V34Mode == 0) return; if (cell_active) return; // Not likely! dp_write_dsp_ram(0x825, 0x2000); if (x_line_rate <= 6) return; dp_bFallForward = 2; dp_bV34WkState = 7; dp_rate_change_cmd (1); dp_state = 0x31; dp_timer1 = x_current_time(); eax = (dp_read_dsp_ram(0x821) & 0xFFF7); eax = eax | 0x10; dp_write_dsp_ram(0x821, eax); dp_lapm_error_check_init(); return;}void lapm_reset_timer(void){ io_timer = x_current_time();}bool lapm_timer_expired(int how_long){ if (x_elapsed_time(io_timer) >= how_long) return true; else return false;}void lapm_init_variables(void){ unsigned int i, ecx; unsigned char* byte_ptr; // Set up transmit frame array. byte_ptr = lapm_transmit_frame + 1; for (ecx=9; ecx>0; ecx--) { *(byte_ptr - 1) = 0; *byte_ptr = 0; *(byte_ptr + 3) = 0; byte_ptr = byte_ptr + 0x10b; } // Set up receive queue array. byte_ptr = lapm_receive_queue + 2; for (ecx=6; ecx>0; ecx--) { *(byte_ptr - 2) = 0; *byte_ptr = 0; byte_ptr = byte_ptr + 0x110; } lapm_receive_frame[0] = 0; lapm_receive_frame[2] = 0; lapm_receive_frame[3] = 0; // Fill ecx number of dwords, at edi with eax. for (i=0; i<0x42; i++) { lapm_receive_frame[6 + (i*4)] = 0; } // Store string ?//0003D43C stosb lapm_control_frame[0] = 0; lapm_control_frame[1] = 0; lapm_ui_frame[0] = 0; lapm_ui_frame[1] = 0; { unsigned char al; // Don't know what the hell is going on here! al = ETC_mode; al = al & 3; al--; // 2s comp. al = ~al + 1; // sbb al, al sub with borrow. // Shouldn't this clear al? al = al & 0x40; al = al + 0x40; // What has al now got? lapm_n401 = al; } lapm_data_dlci = 0; lapm_dsvd_dlci = 0x20; lapm_vs = 0; lapm_va = 0; lapm_vr = 0; lapm_ns = 0; lapm_vrb = 0; lapm_vsb = 0; lapm_k = 8; lapm_t401 = 0x7D0; lapm_retransmit = 0; lapm_remote_busy = false; lapm_local_busy = false; lapm_reject_sent = false; lapm_rx_iframe = 0; lapm_iframe_on_queue = 0; lapm_iframe_ptr = NULL; lapm_rx_dte_char = 0; lapm_data_ptr = NULL; lapm_v42b_err = 0; lapm_state = 0; mnp_rx_octet_state = 0; lapm_odp_rptr = io_dce_rx_sptr; }
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -