Jump to content


Photo

A Lil Help. Tasm Troubles


  • Please log in to reply
4 replies to this topic

#1 Mię«os∞ft

Mię«os∞ft

    X-S Member

  • Members
  • Pip
  • 147 posts

Posted 03 April 2008 - 10:42 PM

CODE
;
;
;  Usage :
;        -pktentry
;           _pktasminit( void far * buffers, int maxbufs, int buflen)
;
;  (c) 1991 University of Waterloo,
;           Faculty of Engineering,
;           Engineering Microcomputer Network Development Office
;
;  version
;
;    0.1    22-May-1992   E. P. Engelke
;
;
        include masmdefs.hsm
        include model.hsm

codedef ASMPKT
datadef

cstart  ASMPKT

maxbufs    dw    0
maxlen    dw    0
bufs    dw    0
bufseg    dw    0

cproc    _pktentry
    pushf

    cli    ; no interruptions now

    or    AL, AL
    jnz    encue; branch if was a 1 and must encue packet now

; buffer request operation
; to check our buffers we will need the same DS seg, set it now
        push    CX
    push    DS
        mov     DI, CS:bufseg
        mov     DS, DI

; check the packet length
    cmp    CX, cs:maxlen
    jg    no_fnd    ; pretend none were found

    mov    DI, CS:bufs
    mov    CX, CS:maxbufs
    mov    AL, 0ffh

srcloop:
;        test    AL, byte ptr DS:DI            ; 94.11.30 -- fix for tasm4
        test    AL, byte ptr DS:[DI]
    jz    found
    add    DI, CS:maxlen
    add    DI, 2
    loop    srcloop

no_fnd: xor    DI, DI    ; for whatever error, throw away the buffer
    mov    DS, DI    ; by returning 0000:0000
    sub    DI, 2

found:  push    DS
    pop    ES
    add    DI, 2
    pop    DS
    pop    CX
    popf
    retf

; encue packet
;
encue:    or    SI, SI
    jz    no_enqu    ; not a valid pointer, cannot encue
    push    SI
    sub    SI, 2
    mov    AL, 1    ; should be already, but just in case
;        mov     byte ptr DS:SI, AL            ; 94.11.30 -- fix for tasm4
        mov     byte ptr DS:[SI], AL
    pop    SI
no_enqu:
        popf
    retf
cendp    _pktentry

cpublic _pktasminit    ; bufptr, maxbufs, buflen
    mov    AX, +@AB + 0 [BP]; bufptr
    mov    BX, +@AB + 2 [BP]; bufptr segment
    mov    CX, +@AB + 4 [BP]; maxbufs
    mov    DX, +@AB + 6 [BP]; buflen
    mov    CS:bufs, AX
    mov    CS:bufseg, BX
    mov    CS:maxbufs, CX
    mov    CS:maxlen, DX
creturn _pktasminit
cend    ASMPKT
        end



What exactly does _pktentry and _pktasminit do? uhh.gif


#2 openxdkman

openxdkman

    X-S Genius

  • Moderator
  • PipPipPipPip
  • 823 posts
  • Xbox Version:unk
  • 360 version:unknown

Posted 04 April 2008 - 11:16 AM

That's the connection between the stack and the packet driver

It tells a packet driver what are the ring buffers to use to store incoming/outgoing packets.

Since you have my packet driver for xbox1, use that instead.

Don't hesitate to change the stack source so you can call and use my packet driver.

In other word, you don't need to compile the asm that was made for the targeted original packet driver (obviously some msdos packet driver obeying this specification : http://www.crynwr.co...ket_driver.html ).

Actually I had to master stack source first under msdos, then once I fully understood it, I had no problem to port to xbox1 and ps2.

Edited by openxdkman, 04 April 2008 - 11:20 AM.


#3 Mię«os∞ft

Mię«os∞ft

    X-S Member

  • Members
  • Pip
  • 147 posts

Posted 04 April 2008 - 09:54 PM

QUOTE(openxdkman @ Apr 4 2008, 06:52 AM) View Post

That's the connection between the stack and the packet driver

It tells a packet driver what are the ring buffers to use to store incoming/outgoing packets.

Since you have my packet driver for xbox1, use that instead.

Don't hesitate to change the stack source so you can call and use my packet driver.

In other word, you don't need to compile the asm that was made for the targeted original packet driver (obviously some msdos packet driver obeying this specification : http://www.crynwr.co...ket_driver.html ).

Actually I had to master stack source first under msdos, then once I fully understood it, I had no problem to port to xbox1 and ps2.


Very useful info. Thank you. smile.gif



#4 Mię«os∞ft

Mię«os∞ft

    X-S Member

  • Members
  • Pip
  • 147 posts

Posted 05 April 2008 - 04:17 PM

Should I use Ethaddr_reversed or Ethaddr for TCP uses?

I could use PM but this info will help others too, who in future may want to use TCP functions happy.gif

Edited by Mię«os∞ft, 05 April 2008 - 04:17 PM.


#5 openxdkman

openxdkman

    X-S Genius

  • Moderator
  • PipPipPipPip
  • 823 posts
  • Xbox Version:unk
  • 360 version:unknown

Posted 07 April 2008 - 04:56 PM

http://ftp.monash.ed...-standards/rfc/
is one of the available rfc repository

http://www.frameip.com/rfc/
describes the interesting rfc's for tcp/ip understanding

I don't remember and I'm a bit lazzy at the moment to answer your question precisely but understanding the right rfc should avoid any trouble in your development. Compare with my ping listening code in Demo01 pong (it may depend on the physical network adapter and thus depends on packet driver).

Also becareful, I fell in an idiot trap while testing ftp. Sometimes you need to to send in plain text an ip address. In sprintf I didn't cast (unsigned char) and half the times it printed negative numbers.

A code that works randomly half the time is horrible to debug...

Edited by openxdkman, 07 April 2008 - 04:57 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users