Starting on test suite, fixing some bugs found via it

This commit is contained in:
John Bintz 2024-04-26 08:32:52 -04:00
parent e4711f1783
commit 882ee8cba2
6 changed files with 24 additions and 12 deletions

1
.gitignore vendored
View File

@ -9,3 +9,4 @@ stuff/
patches/ patches/
.vamosrc .vamosrc
activate activate
test/report.txt

Binary file not shown.

View File

@ -512,7 +512,7 @@ _SocketLibraryOpen_Finish:
; ;
; Turn an IP address and port into a sockaddr_in strucure ; 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 Lib_Def SocketIPAddressPortToSockaddr
@ -537,6 +537,15 @@ _ToSockaddr_PortOK:
MOVE.L D1,A1 ; ip string address MOVE.L D1,A1 ; ip string address
MOVE.W (A1)+,D3 ; string length 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 ; temporarily store a null-terminated copy of the ip string in A0
MOVE.L A0,A2 MOVE.L A0,A2
SUBQ #1,D3 ; DBRA loop runs D3 + 1 times SUBQ #1,D3 ; DBRA loop runs D3 + 1 times
@ -656,7 +665,6 @@ _SocketCreateInetSocket_Done:
Ret_Int Ret_Int
_SocketConnect_LibraryOpen: _SocketConnect_LibraryOpen:
MOVE.L D0,-(SP) ; socket id onto stack MOVE.L D0,-(SP) ; socket id onto stack
Rbsr L_SocketIPAddressPortToSockaddr Rbsr L_SocketIPAddressPortToSockaddr
@ -674,6 +682,8 @@ _SocketConnect_SockaddrIn:
MOVE.L D0,A0 MOVE.L D0,A0
MOVE.L (SP)+,D0 MOVE.L (SP)+,D0
CLR.W $100
MOVE.L D0,-(SP) MOVE.L D0,-(SP)
MOVEM.L A0/A3,-(SP) MOVEM.L A0/A3,-(SP)
Dload A3 Dload A3
@ -1946,24 +1956,25 @@ _SocketReuseAddr_LibraryOpen:
_DnsGetHostAddressByName_LibraryOpen: _DnsGetHostAddressByName_LibraryOpen:
; string so you need demande, hichaine, and chvide ; string so you need demande, hichaine, and chvide
MOVE.L D3,A0 ; name MOVE.L D3,A0 ; name
MOVEQ #0,D0
MOVE.W (A0)+,D0 ; d0 contains length MOVE.W (A0)+,D0 ; d0 contains length
MOVE.L D0,D1 ; d1 also has length MOVE.L D0,D1 ; d1 also has length
MOVE.L D0,D2 ; d2 also has length MOVE.L D0,D2 ; d2 also has length
Rjsr L_RamFast ; d0 contains address Rjsr L_RamFast ; d0 contains address
BNE .StringRamAllocated BNE _DnsGetHostAddressByName_StringRamAllocated
MOVE.L ChVide(A5),D3 MOVE.L ChVide(A5),D3
RestoreStackFunction RestoreStackFunction
Ret_String Ret_String
.StringRamAllocated: _DnsGetHostAddressByName_StringRamAllocated:
MOVE.L D0,A1 ; a1 contains address MOVE.L D0,A1 ; a1 contains address
SUBQ #1,D1 ; reduce by one for DBRA SUBQ #1,D1 ; reduce by one for DBRA
.KeepCopyingAMOSString _DnsGetHostAddressByName_KeepCopyingAMOSString
MOVE.B (A0)+,(A1)+ ; byte copy 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.B #0,(A1)+ ; null terminate string
MOVE.L D0,A0 ; first param of gethostbyname MOVE.L D0,A0 ; first param of gethostbyname
@ -1982,14 +1993,14 @@ _DnsGetHostAddressByName_LibraryOpen:
MOVE.L (SP)+,D0 MOVE.L (SP)+,D0
TST.L D0 TST.L D0
BNE .GetIPAddress BNE _DnsGetHostAddressByName_GetIPAddress
RestoreStackFunction RestoreStackFunction
MOVE.L ChVide(A5),D3 MOVE.L ChVide(A5),D3
Ret_String Ret_String
.GetIPAddress: _DnsGetHostAddressByName_GetIPAddress:
MOVE.L D0,A0 MOVE.L D0,A0
MOVE.L 16(A0),A1 ; **h_addr_list MOVE.L 16(A0),A1 ; **h_addr_list
MOVE.L (A1),A1 ; *h_addr_list MOVE.L (A1),A1 ; *h_addr_list
@ -2156,7 +2167,7 @@ _SocketCloseSocket_LibraryOpen:
EndDataStorage EndDataStorage
TST.L D0 TST.L D0
BEQ .success BEQ _SocketHerrno_success
; failed ; failed
MOVE.L #-1,D3 MOVE.L #-1,D3
@ -2164,7 +2175,7 @@ _SocketCloseSocket_LibraryOpen:
RestoreStackFunction RestoreStackFunction
Ret_Int Ret_Int
.success _SocketHerrno_success:
MOVE.L (A1),D3 MOVE.L (A1),D3
RestoreStackFunction RestoreStackFunction

View File

@ -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 L_Cold: set 0

View File

@ -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 Lib_Size equ 39

BIN
test/TestSuite.amos Normal file

Binary file not shown.