Subversion Repositories Spectranet

[/] [branches/] [gnubinutils/] [rom/] [w5100_genintfunc.asm] - Diff between revs 371 and 384

Show entire file | Details | Blame | View Log

Rev 371 Rev 384
Line 21... Line 21...
;THE SOFTWARE.
;THE SOFTWARE.
;
;
;
;
; General internal functions for the socket library.
; General internal functions for the socket library.
;
;
 
.include        "w5100_defs.inc"
 
.include        "sysvars.inc"
 
.include        "sockdefs.inc"
;
;
; F_gethwsock:
; F_gethwsock:
; Get the hardware socket for a file descriptor. If no hardware socket
; Get the hardware socket for a file descriptor. If no hardware socket
; is associated with the fd, set the carry flag and return with the error
; is associated with the fd, set the carry flag and return with the error
; code in A. Otherwise, return the hardware socket register area MSB in
; code in A. Otherwise, return the hardware socket register area MSB in
; H.
; H.
F_gethwsock
.text
 
.globl F_gethwsock
 
F_gethwsock:
        ex af, af'
        ex af, af'
        ld a, (v_pga)           ; save current page A
        ld a, (v_pga)           ; save current page A
        ld (v_buf_pga), a
        ld (v_buf_pga), a
        ld a, REGPAGE
        ld a, REGPAGE
        call F_setpageA
        call F_setpageA
Line 40... Line 45...
        ld l, a
        ld l, a
        ld a, (hl)
        ld a, (hl)
        ld h, a                 ; point hl at putative hardware socket
        ld h, a                 ; point hl at putative hardware socket
        and NOTSOCKMASK         ; is this not a hardware socket?
        and NOTSOCKMASK         ; is this not a hardware socket?
        ret z                   ; OK - return with hw sock register in H
        ret z                   ; OK - return with hw sock register in H
.nohwsock
.nohwsock1:
        ld a, ESBADF
        ld a, ESBADF
        scf
        scf
        ret
        ret
 
 
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
; J_leavesockfn - jump point to restore original page A
; J_leavesockfn - jump point to restore original page A
J_leavesockfn
.globl J_leavesockfn
 
J_leavesockfn:
        ex af, af'
        ex af, af'
        ld a, (v_buf_pga)
        ld a, (v_buf_pga)
        call F_setpageA
        call F_setpageA
        ex af, af'
        ex af, af'
        ret
        ret