Turbo Assembler Version 2.51 11/21/96 15:03:00 Page 1 RECEIVER.ASM 1 ; receiver.asm 2 3 0000 .MODEL SMALL,C 4 5 JUMPS 6 7 INCLUDE snoop.inc 1 8 ; snoop.inc 1 9 1 10 ;*************************** EQUATES ************************************** 1 11 1 12 ;-------- DRVRINFO.ASM ------ 1 13 = 0000 DRIVER_NOT_FOUND EQU 0 1 14 = 0001 DRIVER_FOUND EQU 1 1 15 1 16 ;-------- PKTFIND.ASM ------- 1 17 = 0000 INTVECT_SEG EQU 0000h 1 18 = 0180 SWI_START EQU 0180h ; Start searching addrs at this offset 1 19 = 0200 SWI_END EQU 0200h ; Quit searching addrs at this offset 1 20 = 0008 PACKET_STR_SZ EQU 0008h ; Size of string 1 21 = 0003 SKIP_BYTES EQU 0003h ; Number of bytes to skip in string 1 22 1 23 ;-------- RECEIVER.ASM ------ 1 24 = 0800 BUFFER_SIZE EQU 2048 ; 2K buffer, ignoring length in CX 1 25 = 0000 IDLE EQU 0 ; receiver is IDLE 1 26 = 0001 BUSY EQU 1 ; receiver is BUSY 1 27 = 0000 FIRST_REQ EQU 0 ; which request is this: 1-fill buf 1 28 = 0001 SECOND_REQ EQU 1 ; 2-display buf 1 29 1 30 1 31 1 32 ;**************************** STRUCTURES ********************************* 1 33 1 34 ; linked list buffer structure 1 35 1 36 *000 PKTBUF_STRUCT STRUC 1 37 *000 01*(????) pktsize_flag dw ? 1 38 *002 01*(????????) buffer dd ? 1 39 *006 01*(????????) next dd ? 1 40 *00A PKTBUF_STRUCT ENDS 1 41 1 42 ;------ DRVRINFO.ASM ------ 1 43 *000 DRVR_INFO_STRUCT STRUC 1 44 *000 01*(??) drvr_functionality db ? 1 45 *001 01*(????) drvr_version dw ? 1 46 *003 01*(??) drvr_class db ? 1 47 *004 01*(??) drvr_number db ? 1 48 *005 01*(????) drvr_type dw ? 1 49 *007 01*(????????) drvr_name dd ? 1 50 *00B DRVR_INFO_STRUCT ENDS 1 51 1 52 ;------ ACCTYPE.ASM ------- 1 53 *000 ACCESS_TYPE_STRUCT STRUC 1 54 *000 01*(??) if_class db ? 1 55 *001 01*(????) if_type dw ? 1 56 *003 01*(??) if_number db ? 1 57 *004 01*(????????) type_acc dd ? Turbo Assembler Version 2.51 11/21/96 15:03:00 Page 2 RECEIVER.ASM 1 58 *008 01*(????) typelen dw ? 1 59 *00A 01*(????????) receiver_ptr dd ? 1 60 *00E ACCESS_TYPE_STRUCT ENDS 1 61 1 62 1 63 ;**************************** MACROS ************************************** 1 64 1 65 66 67 PUBLIC receiver 68 69 EXTRN discarded_pkts:DWORD 70 EXTRN receive_buffer:DWORD 71 EXTRN receiver_busy:BYTE 72 73 74 0000 .CODE 75 76 0000 receiver PROC FAR 77 USES ax,dx,ds 78 1 79 0000 50 PUSH AX 1 80 0001 52 PUSH DX 1 81 0002 1E PUSH DS 1 82 0003 BA 0000s mov dx,@DATA 83 0006 8E DA mov ds,dx 84 85 0008 BA 0001 mov dx,BUSY 86 000B 2E: C4 3E 0000e les di,DWORD PTR [cs:receive_buffer] ; check current buffer + 87 to see if it's 88 0010 26: 39 15 cmp [es:di.pktsize_flag],dx ; currently being displayed 89 0013 7D 43 90 90 90 jge discard_packet 90 91 0018 B2 01 mov dl,BUSY 92 001A 2E: 86 16 0000e xchg [cs:receiver_busy],dl 93 001F 80 FA 01 cmp dl,BUSY + 94 ; check flag 95 0022 74 11 90 90 90 je second_call 96 97 0027 first_call: 98 0027 3C 00 cmp al, FIRST_REQ ; check flag: if 99 + 100 ; FIRST_REQ then fill 101 0029 75 2D 90 90 90 jne discard_packet ; a buffer, otherwise 102 + 103 ; display one 104 105 002E 26: C4 7D 02 les di, DWORD PTR [es:di.buffer] 106 0032 EB 43 90 jmp exit 107 108 0035 second_call: 109 0035 3C 01 cmp al, SECOND_REQ 110 0037 75 1F 90 90 90 jne discard_packet 111 112 ; mov dl, BUSY 113 003C 26: 89 0D mov [es:di.pktsize_flag], cx 114 003F 26: C4 7D 06 les di, DWORD PTR [es:di.next] ; point to next+ Turbo Assembler Version 2.51 11/21/96 15:03:00 Page 3 RECEIVER.ASM 115 buffer in queue 116 0043 2E: 89 3E 0000e mov WORD PTR [cs:receive_buffer], di 117 0048 8C C7 mov di, es 118 004A 2E: 89 3E 0002e mov WORD PTR [cs:receive_buffer+2], di 119 004F B2 00 mov dl, IDLE + 120 ; make receiver_busy = IDLE 121 0051 2E: 88 16 0000e mov [cs:receiver_busy], dl 122 0056 EB 1F jmp short exit 123 124 0058 discard_packet: 125 0058 2E: 8B 16 0000e mov dx, WORD PTR [cs:discarded_pkts] 126 005D 83 C2 01 add dx,1 127 0060 2E: 89 16 0000e mov WORD PTR [cs:discarded_pkts], dx 128 0065 2E: 8B 16 0002e mov dx, WORD PTR [cs:discarded_pkts+2] 129 006A 83 D2 00 adc dx,0 130 006D 2E: 89 16 0002e mov WORD PTR [cs:discarded_pkts+2], dx 131 132 0072 BF 0000 mov di, 0H 133 0075 8E C7 mov es, di 134 135 0077 exit: 1 136 0077 1F POP DS 1 137 0078 5A POP DX 1 138 0079 58 POP AX 1 139 007A CB RET 0000h 140 141 007B ENDP 142 143 144 END Turbo Assembler Version 2.51 11/21/96 15:03:00 Page 4 Symbol Table Symbol Name Type Value ??DATE Text "11/21/96" ??FILENAME Text "RECEIVER" ??TIME Text "15:02:59" ??VERSION Number 0205 @CODE Text _TEXT @CODESIZE Text 0 @CPU Text 0101H @CURSEG Text _TEXT @DATA Text DGROUP @DATASIZE Text 0 @FILENAME Text RECEIVER @MODEL Text 2 @WORDSIZE Text 2 BUFFER_SIZE Number 0800 BUSY Number 0001 DISCARDED_PKTS (_discarded_pkts) Dword ----:---- Extern DISCARD_PACKET Near _TEXT:0058 DRIVER_FOUND Number 0001 DRIVER_NOT_FOUND Number 0000 EXIT Near _TEXT:0077 FIRST_CALL Near _TEXT:0027 FIRST_REQ Number 0000 IDLE Number 0000 INTVECT_SEG Number 0000 PACKET_STR_SZ Number 0008 RECEIVER (_receiver) Far _TEXT:0000 RECEIVER_BUSY (_receiver_busy) Byte ----:---- Extern RECEIVE_BUFFER (_receive_buffer) Dword ----:---- Extern SECOND_CALL Near _TEXT:0035 SECOND_REQ Number 0001 SKIP_BYTES Number 0003 SWI_END Number 0200 SWI_START Number 0180 Structure Name Type Offset ACCESS_TYPE_STRUCT IF_CLASS Byte 0000 IF_TYPE Word 0001 IF_NUMBER Byte 0003 TYPE_ACC Dword 0004 TYPELEN Word 0008 RECEIVER_PTR Dword 000A DRVR_INFO_STRUCT DRVR_FUNCTIONALITY Byte 0000 DRVR_VERSION Word 0001 DRVR_CLASS Byte 0003 DRVR_NUMBER Byte 0004 DRVR_TYPE Word 0005 DRVR_NAME Dword 0007 PKTBUF_STRUCT PKTSIZE_FLAG Word 0000 BUFFER Dword 0002 NEXT Dword 0006 Turbo Assembler Version 2.51 11/21/96 15:03:00 Page 5 Symbol Table Groups & Segments Bit Size Align Combine Class DGROUP Group _DATA 16 0000 Word Public DATA _TEXT 16 007B Word Public CODE