Skip to content

Commit

Permalink
Conversion by Nestor of VCF from 286 to 8088/8086 code.
Browse files Browse the repository at this point in the history
  • Loading branch information
hackerb9 committed Dec 16, 2019
1 parent 1cc1ae2 commit a3a2110
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 54 deletions.
131 changes: 80 additions & 51 deletions 3C509.ASM
Expand Up @@ -3,7 +3,7 @@ version equ 6
;Fri Mar 08 14:48:42 2002 Merge in Peter Tattum's 3c509b changes.
;Mon Jan 22 15:09:36 1996 we were rejecting frames with dribble set and accepting other errored frames.

.286
.8086

; Copyright, 1988-1992, Russell Nelson, Crynwr Software

Expand Down Expand Up @@ -488,16 +488,24 @@ send_pkt_2:
out dx,ax ;output the second reserved word.
mov cx,bx ;output the rest of the packet.

cmp is_386,0 ;can we output dwords?
jne send_pkt_7 ;yes.
; cmp is_386,0 ;can we output dwords?
; jne send_pkt_7 ;yes.
shr cx,1 ;output 16 bits at a time.
rep outsw
jmp short send_pkt_6
send_pkt_7:
.386
shr cx,2 ;already rounded up.
rep outsd ;output 32 bits at a time.
.286
; rep outsw

;start 8086 code
send_8086:
lodsw
out dx,ax
loop send_8086
;end 8086 code

jmp short send_pkt_6
;send_pkt_7:
; .386
; shr cx,2 ;already rounded up.
; rep outsd ;output 32 bits at a time.
; .286
send_pkt_6:

clc
Expand Down Expand Up @@ -637,7 +645,14 @@ read_header:
mov cx,ETHER_BUFF_LEN/4
repinsd:
shl cx,1 ;*** this gets changed into "rep insd"
rep insw ;*** "nop" on a 386 or 486.
; rep insw ;*** "nop" on a 386 or 486.

;start 8086 code
l_rep:
in ax,dx
stosw
loop l_rep
;end 8086 code

mov di,offset ether_type

Expand Down Expand Up @@ -759,15 +774,29 @@ recv_complete_4:
mov cx,bx ;restore the count.
sub cx,ETHER_BUFF_LEN ;but leave off what we've already copied.

cmp is_386,0
jne io_input_386
; cmp is_386,0
; jne io_input_386
io_input_286:
push cx
shr cx,1
rep insw
; rep insw

;start 8086 code
l_input:
in ax, dx
stosw
loop l_input
;end 8086 code

pop cx
jnc io_input_286_1 ;go if the count was even.
insb ;get that last byte.
; insb ;get that last byte.

;start 8086 code
in al, dx
stosb
;end 8086 code

in al,dx ;and get the pad byte.
test cx,2 ;even number of words?
jne io_input_done ;no.
Expand All @@ -779,28 +808,28 @@ io_input_286_1:
in ax,dx ;yes, get the pad word.
jmp short io_input_done

io_input_386:
.386
push eax
push cx ;first, get all the full words.
shr cx,2
rep insd
pop cx
test cx,3 ;even number of dwords?
je io_input_386_one_byte ;yes.
in eax,dx ;no, get the partial word.
test cx,2 ;a full word to be stored?
je io_input_386_one_word
stosw ;yes, store it,
shr eax,16 ;and move over by a word.
io_input_386_one_word:

test cx,1 ;a full byte to be stored?
je io_input_386_one_byte
stosb ;yes, store it.
io_input_386_one_byte:
pop eax
.286
;io_input_386:
; .386
; push eax
; push cx ;first, get all the full words.
; shr cx,2
; rep insd
; pop cx
; test cx,3 ;even number of dwords?
; je io_input_386_one_byte ;yes.
; in eax,dx ;no, get the partial word.
; test cx,2 ;a full word to be stored?
; je io_input_386_one_word
; stosw ;yes, store it,
; shr eax,16 ;and move over by a word.
;io_input_386_one_word:

; test cx,1 ;a full byte to be stored?
; je io_input_386_one_byte
; stosb ;yes, store it.
;io_input_386_one_byte:
; pop eax
; .286

io_input_done:

Expand Down Expand Up @@ -852,8 +881,8 @@ usage_msg db "usage: 3c509 [options] <packet_int_no> [id_port]",CR,LF,'$'

public copyright_msg
copyright_msg db "Packet driver for a 3c509, version ",'0'+(majver / 10),'0'+(majver mod 10),".",'0'+version,CR,LF
db "Portions Copyright 1992, Crynwr Software",CR,LF,'$'
needs_186_msg db "Needs a 186 or higher-numbered processor",CR,LF,'$'
db "Portions Copyright 1992, Crynwr Software",CR,LF
db "8088/8086 support by Nestor a.k.a. DistWave",CR,LF,'$'
no_isa_msg db CR,LF
db "No 3c509 found. Use a different id_port value. Default is 0x110.",CR,LF,'$'
reading_msg db "Reading EEPROM.",'$'
Expand Down Expand Up @@ -917,19 +946,19 @@ etopen:
;initialize the driver. Fill in rom_address with the assigned address of
;the board. Exit with nc if all went well, or cy, dx -> $ terminated error msg.
;if all is okay,
cmp is_186,0 ;this version requires a 186 or better.
jne etopen_1
mov dx,offset needs_186_msg
stc
ret
etopen_1:

cmp is_386,0 ;can we do a real insd?
je etopen_2
; cmp is_186,0 ;this version requires a 186 or better.
; jne etopen_1
; mov dx,offset needs_186_msg
; stc
; ret
;etopen_1:

; cmp is_386,0 ;can we do a real insd?
; je etopen_2
;overlay the repinsd routine with a real "rep insd;nop"
mov word ptr repinsd+0,066h+0f3h*256
mov word ptr repinsd+2,06dh+090h*256
etopen_2:
; mov word ptr repinsd+0,066h+0f3h*256
; mov word ptr repinsd+2,06dh+090h*256
;etopen_2:

cmp is_eisa,0
jne etopen_eisa
Expand Down
Binary file modified 3C509.COM 100644 → 100755
Binary file not shown.
7 changes: 4 additions & 3 deletions MAKEFILE
@@ -1,10 +1,11 @@
.asm.obj:
tasm $*;
tasm $*;

3c509.com: head.obj 3c509.obj tail.obj
tlink /t/m head+3c509+tail,3c509;

zip:
clean:
del *.obj
del *.map
zip -a 3c509
del 3c509.com

0 comments on commit a3a2110

Please sign in to comment.