Starting on test suite, fixing some bugs found via it
This commit is contained in:
parent
e4711f1783
commit
882ee8cba2
1
.gitignore
vendored
1
.gitignore
vendored
@ -9,3 +9,4 @@ stuff/
|
||||
patches/
|
||||
.vamosrc
|
||||
activate
|
||||
test/report.txt
|
||||
|
Binary file not shown.
@ -512,7 +512,7 @@ _SocketLibraryOpen_Finish:
|
||||
;
|
||||
; Turn an IP address and port into a sockaddr_in strucure
|
||||
;
|
||||
; d0 - 0 on success, -1 on failure
|
||||
; d0 - address of sockaddr_in on success, -1 on failure
|
||||
; - - - - - - - -
|
||||
Lib_Def SocketIPAddressPortToSockaddr
|
||||
|
||||
@ -537,6 +537,15 @@ _ToSockaddr_PortOK:
|
||||
MOVE.L D1,A1 ; ip string address
|
||||
MOVE.W (A1)+,D3 ; string length
|
||||
|
||||
BNE _ToSockaddr_StringHasLength
|
||||
MOVEM.L (SP)+,A0-A3/D3
|
||||
MOVEM.L (SP)+,A0/A3/D3
|
||||
|
||||
MOVE.L #-14,D0
|
||||
RTS
|
||||
|
||||
_ToSockaddr_StringHasLength:
|
||||
|
||||
; temporarily store a null-terminated copy of the ip string in A0
|
||||
MOVE.L A0,A2
|
||||
SUBQ #1,D3 ; DBRA loop runs D3 + 1 times
|
||||
@ -656,7 +665,6 @@ _SocketCreateInetSocket_Done:
|
||||
Ret_Int
|
||||
|
||||
_SocketConnect_LibraryOpen:
|
||||
|
||||
MOVE.L D0,-(SP) ; socket id onto stack
|
||||
|
||||
Rbsr L_SocketIPAddressPortToSockaddr
|
||||
@ -674,6 +682,8 @@ _SocketConnect_SockaddrIn:
|
||||
MOVE.L D0,A0
|
||||
MOVE.L (SP)+,D0
|
||||
|
||||
CLR.W $100
|
||||
|
||||
MOVE.L D0,-(SP)
|
||||
MOVEM.L A0/A3,-(SP)
|
||||
Dload A3
|
||||
@ -1946,24 +1956,25 @@ _SocketReuseAddr_LibraryOpen:
|
||||
_DnsGetHostAddressByName_LibraryOpen:
|
||||
; string so you need demande, hichaine, and chvide
|
||||
MOVE.L D3,A0 ; name
|
||||
MOVEQ #0,D0
|
||||
MOVE.W (A0)+,D0 ; d0 contains length
|
||||
MOVE.L D0,D1 ; d1 also has length
|
||||
MOVE.L D0,D2 ; d2 also has length
|
||||
Rjsr L_RamFast ; d0 contains address
|
||||
BNE .StringRamAllocated
|
||||
BNE _DnsGetHostAddressByName_StringRamAllocated
|
||||
|
||||
MOVE.L ChVide(A5),D3
|
||||
|
||||
RestoreStackFunction
|
||||
Ret_String
|
||||
|
||||
.StringRamAllocated:
|
||||
_DnsGetHostAddressByName_StringRamAllocated:
|
||||
MOVE.L D0,A1 ; a1 contains address
|
||||
SUBQ #1,D1 ; reduce by one for DBRA
|
||||
|
||||
.KeepCopyingAMOSString
|
||||
_DnsGetHostAddressByName_KeepCopyingAMOSString
|
||||
MOVE.B (A0)+,(A1)+ ; byte copy
|
||||
DBRA D1,.KeepCopyingAMOSString ; keep copying
|
||||
DBRA D1,_DnsGetHostAddressByName_KeepCopyingAMOSString ; keep copying
|
||||
MOVE.B #0,(A1)+ ; null terminate string
|
||||
MOVE.L D0,A0 ; first param of gethostbyname
|
||||
|
||||
@ -1982,14 +1993,14 @@ _DnsGetHostAddressByName_LibraryOpen:
|
||||
MOVE.L (SP)+,D0
|
||||
|
||||
TST.L D0
|
||||
BNE .GetIPAddress
|
||||
BNE _DnsGetHostAddressByName_GetIPAddress
|
||||
|
||||
RestoreStackFunction
|
||||
|
||||
MOVE.L ChVide(A5),D3
|
||||
Ret_String
|
||||
|
||||
.GetIPAddress:
|
||||
_DnsGetHostAddressByName_GetIPAddress:
|
||||
MOVE.L D0,A0
|
||||
MOVE.L 16(A0),A1 ; **h_addr_list
|
||||
MOVE.L (A1),A1 ; *h_addr_list
|
||||
@ -2156,7 +2167,7 @@ _SocketCloseSocket_LibraryOpen:
|
||||
EndDataStorage
|
||||
|
||||
TST.L D0
|
||||
BEQ .success
|
||||
BEQ _SocketHerrno_success
|
||||
|
||||
; failed
|
||||
MOVE.L #-1,D3
|
||||
@ -2164,7 +2175,7 @@ _SocketCloseSocket_LibraryOpen:
|
||||
RestoreStackFunction
|
||||
Ret_Int
|
||||
|
||||
.success
|
||||
_SocketHerrno_success:
|
||||
MOVE.L (A1),D3
|
||||
|
||||
RestoreStackFunction
|
||||
|
@ -1,5 +1,5 @@
|
||||
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
; BSDSocket.s, list of the library functions on the 25-04-2024 17:02:36
|
||||
; BSDSocket.s, list of the library functions on the 26-04-2024 08:23:46
|
||||
;
|
||||
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
L_Cold: set 0
|
||||
|
@ -1,5 +1,5 @@
|
||||
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
; BSDSocket.s, library size on the 25-04-2024 17:02:36
|
||||
; BSDSocket.s, library size on the 26-04-2024 08:23:46
|
||||
;
|
||||
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Lib_Size equ 39
|
||||
|
BIN
test/TestSuite.amos
Normal file
BIN
test/TestSuite.amos
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user