xboxscene.org forums

Author Topic: A Lil Help. Tasm Troubles  (Read 153 times)

Mios∞ft

  • Archived User
  • Full Member
  • *
  • Posts: 119
A Lil Help. Tasm Troubles
« on: April 03, 2008, 03:42:00 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
Logged

openxdkman

  • Archived User
  • Hero Member
  • *
  • Posts: 550
A Lil Help. Tasm Troubles
« Reply #1 on: April 04, 2008, 04:52:00 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.com/packet_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.

This post has been edited by openxdkman: Apr 4 2008, 11:56 AM
Logged

Mios∞ft

  • Archived User
  • Full Member
  • *
  • Posts: 119
A Lil Help. Tasm Troubles
« Reply #2 on: April 04, 2008, 02:54:00 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

Logged

Mios∞ft

  • Archived User
  • Full Member
  • *
  • Posts: 119
A Lil Help. Tasm Troubles
« Reply #3 on: April 05, 2008, 09:53:00 AM »

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  (IMG:style_emoticons/default/happy.gif)

This post has been edited by Mi©®os∞ft: Apr 5 2008, 04:53 PM
Logged

openxdkman

  • Archived User
  • Hero Member
  • *
  • Posts: 550
A Lil Help. Tasm Troubles
« Reply #4 on: April 07, 2008, 09:56:00 AM »

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...
Logged