Home » Archimedes archive » Acorn User » AU 1997-Xmas B.adf » PD » NetPlex/!Netplex/SocketFS/S/Modmain

NetPlex/!Netplex/SocketFS/S/Modmain

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1997-Xmas B.adf » PD
Filename: NetPlex/!Netplex/SocketFS/S/Modmain
Read OK:
File size: 4F96 bytes
Load address: 0000
Exec address: 0000
File contents
;  Socket.s
;          : Source code to SocketFS
;          : BSD sockets as files!
;
;  Created :  04-07-97
;  Author  :  R G Gammans
;
;  Modified:  18-08-97


;   SocketFS - BSD sockets filing system for RISC-OS.
;   Copyright (C) 1997 Roger G Gammans
;
;   This program is free software; you can redistribute it and/or modify
;   it under the terms of the GNU General Public License as published by
;   the Free Software Foundation; either version 2 of the License, or
;   (at your option) any later version.
;
;
;   This program is distributed in the hope that it will be useful,
;   but WITHOUT ANY WARRANTY; without even the implied warranty of
;   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;   GNU General Public License for more details.
;
;   You should have received a copy of the GNU General Public License
;   along with this program; if not, write to the Free Software
;   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
;
;   Author: R Gammans <rgammans@compsurg,demon.co.uk>
;   Snailmail  : 20 Trenches Rd, Crowborough, E Sussex, TN6 1ES UK.
;


          GET   AsmLib:s.DebugHdr

 ;Debug     SETL  {TRUE}
Debug     SETL  {FALSE}

		GET		AsmLib:h.SWINames
                GET    	 	AsmLib:h.FSControls
                GET		AsmLib:h.psrFlags
		GET		AsmLib:h.sockConsts

 		IMPORT  	|__RelocCode|
		IMPORT		|_clib_initialisemodule|
		IMPORT		|_clib_finalisemodule|
		IMPORT		|malloc|
		IMPORT		|memcpy|
		IMPORT		|makeSocket|
		IMPORT		|inithandlerlist|
		IMPORT		|_Lib$Reloc$Off$DP|

	 	AREA 		|!!Module$Header|, CODE, READONLY

Pc		RN		R15
pc		RN		R15
PC		RN		R15


tempbyte	*		0	;Use first byte of workspace as dumping ground.



SocketFSMod_BaseAddr

		DCD		0
		DCD		Socket_Init    - SocketFSMod_BaseAddr
		DCD     	Socket_Die     - SocketFSMod_BaseAddr
		DCD		0			;Later version will probaly
							;handle services
		DCD		Socket_Title   - SocketFSMod_BaseAddr
		DCD		Socket_HelpStr - SocketFSMod_BaseAddr
		DCD		Socket_HC_Table- SocketFSMod_BaseAddr
		DCD		0
		DCD		0
		DCD		0
                DCD     	0

Socket_DoSWI
Socket_SWITable
                DCD     	0,0
Socket_Title
		DCB		"SocketFS",0
Socket_HelpStr	DCB		"SocketFS",9,"0.01 (18 Aug 1997) � Roger Gammans. Distribute as per GPL V2",0
		ALIGN
Socket_HC_Table	DCB 		"SocketFS",0
 		ALIGN
		DCD		socket_selectfs- SocketFSMod_BaseAddr
		DCD		0
		DCD		0
		DCD		socket_selectfs_help- SocketFSMod_BaseAddr
		DCD		0


socket_selectfs_help
                DCB     	&1b,1,13,13,"This command ",&1b,28,"s",&1b,2,"socket ",&1b,4,0

socket_selectfs                                 ;Nicked form PRMs (RO3) P.2-524
                STMFD   	R13!,{R14}
		MOV     	R0,#FSControl_selectFS  ;14
		ADR		R1,socket_fsname
                SWI		XOS_FSControl
		LDMFD		R13!, {PC}

Socket_Init
		STMFD		R13!,{R7-R11,r14}
		MOV		R10,R13,LSR #20			;Which MB boundary is the stack on...
		MOV		R10,R10,LSL #20			;point R10 directly at booundary...
		LDMIA		R10,{R4,R5}			;Get relocation for other C SVC modules....
		STMFD		R13!,{R4,R5}			;hold it safley on top of stack!
		STMFD		R13!,{R12}			;R12 corruptable under APCS-R....
              ;	BL  		__RelocCode			;Do any relocations and return.
		BL 		_clib_initialisemodule		;We use 'C' functions so...
                DBSET           DebugOn :OR: UseTracker
          	DBF             "\fStarting\n-sp = &%dw\n"
                MOV     	R0,#12				;12 bytes ws.
                BL		malloc				;Allocate it!
		MOVS		R6,R0				;Set flags from R0
                BEQ		socket_nomem			;Can't alloc ret eith error
		LDMFD		R13!,{r12}			;Get R12 Back..
		LDR		R12,[R12]			;Get ws frm private word...
		STR		R12,[R6,#4]			;Store stub's ws ptr.
		DBF		"Doing AF_INIT (sic)  ws@ %4w, %cw\n"
	        BL		inithandlerlist			;Initialise list of known address families
 		DBF             "Done AF_INIT ws's @ %4w, %cw\n"
		BL		socket_clibstackunmunge         ;Return stack to SVC std..
		DBF             "Done Stack unmunge...sp = &%dw\n"
                MOV		R3,R6				;Pass our ws to FS_control as ws ptr
                MOV    		R0,#FSControl_AddFS
                ADR   		R1,SocketFSMod_BaseAddr
		MOV    		R2,# socket_FSinfo - SocketFSMod_BaseAddr
                DBF		"About to call SWI...\n"
                SWI    		XOS_FSControl                  ;Add FS info to RISC-OS
		DBF		"Done SWI ADDFS\n"
                LDMFD  		R13!,{R7-r11,pc}

Socket_Die
                LDR 		R12,[R12]			;Get pointer to workspace.
       		STMFD		R13!,{R14}			;Save R14 on stack so we can use SWIs
		MOV		R0,#FSControl_removeFS
		ADR		R1,socket_fsname
		SWI 		XOS_FSControl                   ;Tell RISC-OS FS is going...
		BL		socket_clibstackmunge
		MOV		R0,R12
                BL		_clib_finalisemodule
                BL		socket_clibstackunmunge
                CMP		PC,#0				;Clear V flag.
                LDMFD		R13!,{pc}			;Done go home.

socket_nomem
		LDMFD		R13!,{R12}
		LDMFD		R13!,{R7-R11,R14}
		ADR		R0,socket_nomemmsg
		ORRS		PC,R14,#V_Bit
socket_nomemmsg
		DCD		&001FF01
		DCB		"No memory for filing system",13,0
		ALIGN


  ;Need to find I bettr way of commenting these bit fields.
  ;socket_info_word EQU		1   << 31+
;				1   << 30	+      		;Streams are interactive
;				0   << 29	+		;FS does support null length names;
;				1   << 28	+		;FS should be asked to open Non-existent files
;				0   << 27       +		;Use FSEntry Args 255 to flush
;				1   << 26	+		;We support FS_File 9
;				1   << 25	+		;We support FS_Func 20
;				0   << 24	+		;Currently reserved.
;				0   << 23	+		;we don't support ImageFS extension
;				0   << 22	+		;Do  pass & and % in path
;				1   << 21	+		;Need not store dira
;				1   << 20	+		;Use Open/Get/Close in pref to File 255
;				1   << 19	+		;Use Open/Get/Close in pref to File 0
;				1   << 18	+		;Use FS_entry 9 instead of FS_Entry File
;				0   << 17	+		;Extra info word not present
;				0   << 16	+		;FS writable
;				&0 << 8	+			;No defititnve limit to open files.
;		1   << 31+\

socket_info_word  	EQU	1   << 31+\
 1   << 30+\
 0   << 29+\
 1   << 28+\
 0   << 27+\
 1   << 26+\
 1   << 25+\
 0   << 24+\
 0   << 23+\
 0   << 22+\
 &F  << 18+\
 0   << 17+\
 0   << 16+\
 0  << 8+\
  &00FF			;SocketFS Number


socket_FSinfo
	  	DCD		socket_fsname	 - SocketFSMod_BaseAddr
	  	DCD		startup_msg	 - SocketFSMod_BaseAddr
		DCD  		socket_open	 - SocketFSMod_BaseAddr
		DCD 		socket_read	 - SocketFSMod_BaseAddr
  		DCD     	socket_write	 - SocketFSMod_BaseAddr
  		DCD     	socket_args	 - SocketFSMod_BaseAddr
  		DCD     	socket_close	 - SocketFSMod_BaseAddr
  		DCD   		socket_file	 - SocketFSMod_BaseAddr
		DCD     	socket_info_word
		DCD     	socket_Func	 - SocketFSMod_BaseAddr
		DCD     	socket_GBPB	 - SocketFSMod_BaseAddr
		DCD     	0

socket_fsname
		DCB		"SocketFS",0
		ALIGN
startup_msg
	        DCB     	"Internet Filesystem",0

		ALIGN


socket_open
                STMFD   	R13!,{R14}
		DBF		"File open entry called\n"
		MOVS		R0,R6				;Copy special field over
		DBF		" - spcf = %0s\n" , NE
		DBF		" - no special field\n", EQ
		DBF		" - fname -= %1s\n"		;reason code...
		LDR		R12,[R12,#4]			;Get stubs ws.
		BL		socket_clibstackmunge		;Set stack up for Clib.
                BL      	makeSocket			;Call C filename processor
 								;This give socket in R0
		BL		socket_clibstackunmunge
 								; or -1 if no socket opened
 	        ADD     	R1,R0,#1         		;Make my handle the socket number +1
 	                                       		 	; conveiently 0 now indicates file not found

 	        MOV     	R2,#0                  		;Unbuffered...(actually internet mod
 	                                        		;will buffer).
 	        MOV     	R3,#0                    	;File extent not used...
 	        MOV     	R4,#0                    	;No buffer space allocated..
 	        MOV     	R0,#&D8000000           	;File Info word

 	        ;File set as readablr,writeable,Stream device and interactive

 	        LDMFD   	R13!,{PC}^               	;Finish...


socket_read
                STMFD   	R13!,{R14}
		DBF		"File read entry called for socket %1w\n"
                SUB     	R0,R1,#1                   	;Put socket number in R0.
		SUB             R13,R13,#4			;resevre 1w ws on stack.
                MOV     	R1,R13		        	;Put buffer in R1..
                MOV     	R2,#1                   	;Put buff size in R2

                                ;Ignore file offset as we have streams...
                SWI     	XSocket_Read            	;Call Internet module..
      		LDRVC   	R0,[R13] 		     	;If no error get byte from buff
		ADD		R13,R13,#4			;Release ws.
                LDMVCFD 	R13!,{PC}^

		LDR		R1,[R0]				;Get Errno
		DBF		"Socket Err %1w\n"
		CMP		R1,#EWOULDBLOCK			;Is Rx/Tx limits.
		LDMEQFD		R13!,{R14}			;Get lr early so we can set flags
		MOV		R0,#0                           ;Retrun 0 char - t
		ORREQ		PC,R14,#C_Bit
		;Now we have to work out what to do in the case of other errs!.
		LDMFD 		R13!,{R14}			;Return with V set!., m
		ORR		PC,R14,#V_Bit			;Set V flag
socket_write
                STMFD   	R13!,{R1-R2,R14}
		DBF		"File write entry called\n  - R0 %0b\n - R1 %1w\n"
		SUB		R13,R13,#4			;Resevre 1 w one stack.
                STR    	 	R0,[R13]		      	;Store byte to send
                SUB     	R0,R1,#1                   	;Put socket number in R0.
                MOV     	R1,R13       			;Put buffer in R1..
                MOV     	R2,#1                   	;Put buff size in R2
                SWI     	XSocket_Write           	;Call Internet module..
		ADD		R13,R13,#4			;Release stack ws.
                LDMFD   	R13!,{R1-R2,PC}


socket_close    STMFD   	R13!,{R14}
		DBF		"File close entry called\n"
                SUB     	R0,R1,#1                   	;Put Socket in R0

                ;Ignore other stuff as meaningless.
                SWI     	XSocket_Close           	;Call internet module
                LDMFD   	R13!,{PC}

socket_GBPB     ;Optimized multibyte get and put routines.....
                ;In fact in our case almost simpler than the single byte
                ;ones

                STMFD   	R13!,{R0-R4,R14}
		DBF		"File gpbp entry called op no - %0w\n"

                CMP    	 	R0,#3                   	;Check reason code...
                BGE     	socket_multiget         	;Do get mutliple..

                  ;put multiple . move regs to place for socket call
                SUB     	R0,R1,#1
                MOV     	R1,R2
                MOV     	R2,R3
                SWI     	XSocket_Write
		BVS		socket_gbpb_handError
		MOV		R5,R0
		LDMFD		R13!,{R0-R4,R14}
		ADD		R2,R2,R5			;Compute new buff ptr
		SUB		R3,R3,R5			;Compute new buff free size
		ADD		R4,R4,R5			;Compute new file pointer!
		MOVS		PC,R14				;Return to caller

socket_multiget

                  ;get multiple . move regs to place for socket call
                SUB     	R0,R1,#1
                MOV     	R1,R2
                MOV     	R2,R3
                SWI     	XSocket_Read
		BVS		socket_gbpb_handError
		MOV		R5,R0
		LDMFD		R13!,{R0-R4,R14}
		ADD		R2,R2,R5			;Compute new buff ptr
		SUB		R3,R3,R5			;Compute new buff free size
		ADD		R4,R4,R5			;Compute new file pointer!
		MOVS		PC,R14				;Return to caller

socket_gbpb_handError
		LDR		R1,[R0]				;Get Errno
		CMP		R1,#EWOULDBLOCK			;Is Rx/Tx limits.
		LDMEQFD		R13!,{R0-R4,PC}^		;Return doing nothing
		;Fileswitch will work out what to tell client!

		;Now we have to work out what to do in the case of other errs!.
		MOV		R5,R0				;Save errrblk ptr..
		LDMFD		R13!,{R0-R4,R14}		;get orignal regs..
		MOV		R0,R5				;restore errblk ptr
		ORRS		PC,R14,#V_Bit			;return with V set.


socket_args	;Handle wodges of OS_Args codes here!
		STMFD	        R13!,{R0-R4,R14}		;Store Registers!
		DBF 		"FS_Entry Args %0w called\n"
		CMP		R0,#10
		ADDLE		PC,PC,R0,LSL #2			;Use old fashionned
								;Swi dispatch trick
		B 		socket_unknownCall

		B		socket_returnZero
		LDMFD		R13!,{r0-R4,PC}			;Ignore ARgs 1
		B		socket_returnZero
		LDMFD		R13!,{R0-R4,PC}			;Ignore Args 3
		B		socket_allocedsize
		B		socket_EOFcheck			;Is TCP connection open?
		B		socket_Flush			;Not called but triv to code!
		B  		socket_Extent
		LDMFD		R13!,{R0-R4,PC}			;Not suported .. unbuffered
		B		socket_returnZeros
		LDMFD		R13!,{R0-R4,PC}			;If you've implemented an imagefs over socketfs I'd be shocked!

socket_allocedsize
		LDMFD		R13!,{R0-R4,R14}
		MOV		R2,#1
		MOV		PC,R14

socket_Extent
		LDMFD		R13!,{R0-R4,R14}
		;What do we need to tell Fileswitch
		MOV   	    	R2,#1
		MOV		PC,R14

socket_returnZero
		LDMFD		R13!,{R0-R4,R14}
		MOV		R2,#0				;Return R2=0
                MOV 		Pc,R14

socket_returnZeros
		LDMFD		R13!,{R0-R4,R14}
		MOV		R2,#0				;Return R2-R3=0.
		MOV		R3,R2
                MOV 		Pc,R14

socket_Flush
    		LDMFD		R13!,{R0-R4,R14}
		STMFD		R13!,{R1-R4,R14}
 		SUB		R0,R1,#1			;Get File handle
		ADD		R1,R12,#tempbyte
		MOV		R2,#0				;Send 0 octets
		SWI		XSocket_Send
		LDMFD		R13!,{R1-R4,PC}

socket_EOFcheck
    		LDMFD		R13!,{R0-R4,R14}
		STMFD		R13!,{R14}
               	SUB		R0,R1,#1			;Get socket handle
                ADD		R1,R12,#tempbyte
		MOV		R2,#1				;Get a byte
		MOV		R3,#(MSG_PEEK + MSG_DONTWAIT)	;but don't remove it from the queue
                SWI		XSocket_Recv
                LDRVS		R1,[R0]				;If err get ErrNo
		MOVS		R0,R0				;IF read()==0
		CMPNE		R1,#ECONNRESET			;  || ==ECONNRESET
		MOV		R2,#0				; then R2=0
		SUBEQ		R2,R2,#1			; else R2=-1
		LDMFD		R13!,{PC}^			;return!

socket_unknownCall
		ADR		R0,socket_unknownCallMsg
		ORRS		PC,PC,#V_Bit
		LDMFD		R13,{R0-R4,PC}

socket_unknownCallMsg
		DCD		&0001FFEE
		DCB		"Socketfs doesn't support this call",13
		ALIGN

socket_Func
		STMFD	        R13!,{R0-R4,R14}		;Store Registers!
		DBF		"FS_Entry Func %0w called\n"
		CMP		R0,#34
		ADDLE		PC,PC,R0,LSL #2			;Use old fashionned
								;Swi dispatch trick
		B 		socket_unknownCall

		B		socket_DoNothing		;FsEntry_Func 0
		B		socket_DoNothing		;FsEntry_Func 1
		B		socket_DoNothing		;FsEntry_Func 2
		B		socket_DoNothing		;FsEntry_Func 3
		B		socket_DoNothing		;FsEntry_Func 4
		B		socket_DoNothing		;FsEntry_Func 5
		B		socket_DoNothing		;FsEntry_Func 6
		B		socket_DoNothing		;FsEntry_Func 7
		B		socket_rename			;FsEntry_Func 8
		B		socket_DoNothing		;FsEntry_Func 9
		B		socket_DoNothing		;FsEntry_Func 10
		B		socket_readBoot			;FsEntry_Func 11
		B		socket_readDirName		;FsEntry_Func 12
		B		socket_readDirName		;FsEntry_Func 13
		B		socket_readDir			;FsEntry_Func 14
		B		socket_readDir			;FsEntry_Func 15
		B		socket_DoNothing		;FsEntry_Func 16
		B		socket_annouce			;FsEntry_Func 17
		B		socket_DoNothing		;FsEntry_Func 18
		B		socket_readDir			;FsEntry_Func 19
		B		socket_DoNothing		;FsEntry_Func 20
		B		socket_DoNothing		;FsEntry_Func 21
		B		socket_DoNothing		;FsEntry_Func 22
		B		socket_DoNothing		;FsEntry_Func 23
		B		socket_DoNothing		;FsEntry_Func 24
		B		socket_readDefects		;FsEntry_Func 25
		B		socket_DoNothing		;FsEntry_Func 26
		B		socket_readBoot			;FsEntry_Func 27
		B		socket_DoNothing		;FsEntry_Func 28
		B		socket_DoNothing		;FsEntry_Func 29
		B		socket_readFree			;FsEntry_Func 30
		B		socket_DoNothing		;FsEntry_Func 31
		B		socket_DoNothing		;FsEntry_Func 32
		B		socket_readUsage		;FsEntry_Func 33
		B		socket_DoNothing		;FsEntry_Func 34


	;Some of the calls that seem to come here should never be called anyway.
        ;(at least assuming the PRMs are correct!)
socket_DoNothing
		LDMFD		R13!,{R0-R4,PC}^		;Return to fileswitch.

socket_rename
	;Can't Rename sockets so return with error
		LDMFD		R13!,{R0-R4,R14} 		;Tidy stack
		MOV		R0,#1				;mark rename failed.
		MOVS		pc,r14				;return

socket_DiscBoot
	;Here we use the 'C' libs memcpy to move our data to Fileswicth
        ;It's overkill for 5 bytes but there an outside chance it
	;will validate the address for us.
		MOV		R1,R2
		ADR		R0,socket_DiscMsg
		MOV		R2,#socket_DiscMsg - socket_DiscMsgEnd
		BL		memcpy
		LDMFD		R13!,{R0-R4,PC}
socket_DiscMsg
		DCB		3,"tcp",0
socket_DiscMsgEnd
		ALIGN
socket_readDirName
	;Will need to implement to support RO2
		B		socket_DoNothing

socket_readDir
 	;We essentially show an emtpy directry with
	;these calls so they can all share a routine.
		LDMFD		R13!,{R0-R4,R14}		;Tidy stack,
		MOV		R3,#0				;No records read
		STR		R3,[R2]				;Use 0 to terminate buffer
		MVN		R4,#0				;End of directory
		MOVS		Pc,R14				;Return

socket_annouce
		SWI		XOS_WriteS
		DCB		"Erk! SocketFS",13,0		;if socketfs is default at
		ALIGN						;boot then you're being clever
								;or have just hung!
		LDMFD		R13!,{R0-R4,PC}

socket_readDefects
	;OK so the internet has them, but not quite in the way
	;fileswtich means. So we return an empty defect list.
		MOV		R0,#&20000000			;Load the list terminator
		STR		R0,[R2]				;Terminate the list's first word
		LDMFD		R13!,{R0-R4,PC}^		;Preserve regs and return.

socket_readBoot
		LDMFD		R13!,{R0-R4,R14}		;Tidy stack
		MOV		R2,#0				;Boot opt=0
		MOVS		pc,R14				;Return.

socket_readFree
		LDMFD		R13!,{R0-R4,R14}		;Tidy stack
		MOV		R0,#0				;0 free space
		MOV		R1,#0				;0 cont. free space
		MOV		R2,#0				;0 disc size
		MOVS		pc,R14				;Return.

socket_readUsage
		LDMFD		R13!,{R0-R4,R14}		;Tidy stack
		MOV		R2,#2				;Streams have unique address space
		MOVS		pc,R14				;Return.



socket_file     DBF		"FS_Entry File %0w called\n"
		TEQ             r0, #255
                MOVEQ           r0, #10
                CMP             r0, #(socket_FileTabEnd - socket_FileTab) / 4
                ADDLE           pc, pc, r0, LSL #2
                BICS            pc, lr, #V_Bit

socket_FileTab  B               socket_Save 	          	; Save file
                BICS            pc, lr, #V_Bit       		; Write catalogue info
                BICS            pc, lr, #V_Bit       		; Write load address
                BICS            pc, lr, #V_Bit       		; Write execution address
                BICS            pc, lr, #V_Bit       		; Write attributes
                B		socket_readCat		       	; Read catalogue info
                BICS            pc, lr, #V_Bit       		; Delete object
                BICS		pc, lr, #V_Bit             	; Create file
                BICS            pc, lr, #V_Bit       		; Create directory
                BICS            pc, lr, #V_Bit       		; Read catalogue info
                BICS            pc, lr, #V_Bit       		; Load file
socket_FileTabEnd


socket_Save     STMFD           R13!, {R0-R1, R4, R14}
                BL              socket_open
                BEQ             socket_saveErr
		MOV		R6,R5
		MOV		R1,R0
		MOV		R0,#1
		MOV		R2,R4
		SUB		R3,R5,R4
socket_saveloop
                BGE             socket_saveend

                BL              socket_GBPB
                BVS             socket_saveErr
		MOVS		R3,R3
                BEQ             socket_saveloop
socket_saveend  MOV             R0, R1
                B		socket_close
socket_saveErr
                LDMFD           sp!, {R0-R1, r4, R14}
		ADR		R0, socket_saveErrMsg
		ORRS		pc, lr, #V_Bit


socket_saveErrMsg
		DCD 		&1006702
		DCB		"An error ocurring while saving",13,0
		ALIGN

socket_readCat  ;Currently we don't check wether this is a fully specified address
		;with sockets in use (eg. an open file - tcp/udp connection)
		MOV		R0,#0				;File not Found
		BICS		R15,R14,#V_Bit			;Return no err.


socket_clibstackmunge
		MOV		R10,R13,LSR #20			;Which MB boundary is the stack on...
		MOV		R10,R10,LSL #20			;point R10 directly at booundary...
		LDMIA		R10,{R4,R5}			;Get relocation for other C SVC modules....
                STMFD           R13!,{R4,R5}    		;save old reloc modifiers over fn call
		DBF		"Stubs stores relocs @ &%cw\n"
                LDMIB           R12, {R4, R5}  			;new relocation modifiers
		DBF		"C lib reloc directives are &%4w,&%5w\n"
                STMIA           R10, {R4, R5}   		;set by module init
                MOV             fp, #0          		;halt C backtrace here!

                DCD             |_Lib$Reloc$Off$DP| + &E28AA000  ; This is equivalent of 'ADD r10, r10, #0' + |_Lib$Reloc$Off$DP|
		MOVS		Pc,R14

socket_clibstackunmunge
		MOV		R10,R13,LSR #20			;Which MB boundary is the stack on...
		MOV		R10,R10,LSL #20			;point R10 directly at booundary...
		LDMIA		R10,{R4,R5}			;Check so we can match later!
		DBF		"C lib reloc directives are &%4w,&%5w\n"
		LDMFD		R13!,{R4,R5}			;Get relocation for other C SVC modules....
		STMIA		R10,{R4,R5}			;put it back where it came from!
		MOVS		Pc,R14

		END
00000000  3b 20 20 53 6f 63 6b 65  74 2e 73 0a 3b 20 20 20  |;  Socket.s.;   |
00000010  20 20 20 20 20 20 20 3a  20 53 6f 75 72 63 65 20  |       : Source |
00000020  63 6f 64 65 20 74 6f 20  53 6f 63 6b 65 74 46 53  |code to SocketFS|
00000030  0a 3b 20 20 20 20 20 20  20 20 20 20 3a 20 42 53  |.;          : BS|
00000040  44 20 73 6f 63 6b 65 74  73 20 61 73 20 66 69 6c  |D sockets as fil|
00000050  65 73 21 0a 3b 0a 3b 20  20 43 72 65 61 74 65 64  |es!.;.;  Created|
00000060  20 3a 20 20 30 34 2d 30  37 2d 39 37 0a 3b 20 20  | :  04-07-97.;  |
00000070  41 75 74 68 6f 72 20 20  3a 20 20 52 20 47 20 47  |Author  :  R G G|
00000080  61 6d 6d 61 6e 73 0a 3b  0a 3b 20 20 4d 6f 64 69  |ammans.;.;  Modi|
00000090  66 69 65 64 3a 20 20 31  38 2d 30 38 2d 39 37 0a  |fied:  18-08-97.|
000000a0  0a 0a 3b 20 20 20 53 6f  63 6b 65 74 46 53 20 2d  |..;   SocketFS -|
000000b0  20 42 53 44 20 73 6f 63  6b 65 74 73 20 66 69 6c  | BSD sockets fil|
000000c0  69 6e 67 20 73 79 73 74  65 6d 20 66 6f 72 20 52  |ing system for R|
000000d0  49 53 43 2d 4f 53 2e 0a  3b 20 20 20 43 6f 70 79  |ISC-OS..;   Copy|
000000e0  72 69 67 68 74 20 28 43  29 20 31 39 39 37 20 52  |right (C) 1997 R|
000000f0  6f 67 65 72 20 47 20 47  61 6d 6d 61 6e 73 0a 3b  |oger G Gammans.;|
00000100  0a 3b 20 20 20 54 68 69  73 20 70 72 6f 67 72 61  |.;   This progra|
00000110  6d 20 69 73 20 66 72 65  65 20 73 6f 66 74 77 61  |m is free softwa|
00000120  72 65 3b 20 79 6f 75 20  63 61 6e 20 72 65 64 69  |re; you can redi|
00000130  73 74 72 69 62 75 74 65  20 69 74 20 61 6e 64 2f  |stribute it and/|
00000140  6f 72 20 6d 6f 64 69 66  79 0a 3b 20 20 20 69 74  |or modify.;   it|
00000150  20 75 6e 64 65 72 20 74  68 65 20 74 65 72 6d 73  | under the terms|
00000160  20 6f 66 20 74 68 65 20  47 4e 55 20 47 65 6e 65  | of the GNU Gene|
00000170  72 61 6c 20 50 75 62 6c  69 63 20 4c 69 63 65 6e  |ral Public Licen|
00000180  73 65 20 61 73 20 70 75  62 6c 69 73 68 65 64 20  |se as published |
00000190  62 79 0a 3b 20 20 20 74  68 65 20 46 72 65 65 20  |by.;   the Free |
000001a0  53 6f 66 74 77 61 72 65  20 46 6f 75 6e 64 61 74  |Software Foundat|
000001b0  69 6f 6e 3b 20 65 69 74  68 65 72 20 76 65 72 73  |ion; either vers|
000001c0  69 6f 6e 20 32 20 6f 66  20 74 68 65 20 4c 69 63  |ion 2 of the Lic|
000001d0  65 6e 73 65 2c 20 6f 72  0a 3b 20 20 20 28 61 74  |ense, or.;   (at|
000001e0  20 79 6f 75 72 20 6f 70  74 69 6f 6e 29 20 61 6e  | your option) an|
000001f0  79 20 6c 61 74 65 72 20  76 65 72 73 69 6f 6e 2e  |y later version.|
00000200  0a 3b 0a 3b 0a 3b 20 20  20 54 68 69 73 20 70 72  |.;.;.;   This pr|
00000210  6f 67 72 61 6d 20 69 73  20 64 69 73 74 72 69 62  |ogram is distrib|
00000220  75 74 65 64 20 69 6e 20  74 68 65 20 68 6f 70 65  |uted in the hope|
00000230  20 74 68 61 74 20 69 74  20 77 69 6c 6c 20 62 65  | that it will be|
00000240  20 75 73 65 66 75 6c 2c  0a 3b 20 20 20 62 75 74  | useful,.;   but|
00000250  20 57 49 54 48 4f 55 54  20 41 4e 59 20 57 41 52  | WITHOUT ANY WAR|
00000260  52 41 4e 54 59 3b 20 77  69 74 68 6f 75 74 20 65  |RANTY; without e|
00000270  76 65 6e 20 74 68 65 20  69 6d 70 6c 69 65 64 20  |ven the implied |
00000280  77 61 72 72 61 6e 74 79  20 6f 66 0a 3b 20 20 20  |warranty of.;   |
00000290  4d 45 52 43 48 41 4e 54  41 42 49 4c 49 54 59 20  |MERCHANTABILITY |
000002a0  6f 72 20 46 49 54 4e 45  53 53 20 46 4f 52 20 41  |or FITNESS FOR A|
000002b0  20 50 41 52 54 49 43 55  4c 41 52 20 50 55 52 50  | PARTICULAR PURP|
000002c0  4f 53 45 2e 20 20 53 65  65 20 74 68 65 0a 3b 20  |OSE.  See the.; |
000002d0  20 20 47 4e 55 20 47 65  6e 65 72 61 6c 20 50 75  |  GNU General Pu|
000002e0  62 6c 69 63 20 4c 69 63  65 6e 73 65 20 66 6f 72  |blic License for|
000002f0  20 6d 6f 72 65 20 64 65  74 61 69 6c 73 2e 0a 3b  | more details..;|
00000300  0a 3b 20 20 20 59 6f 75  20 73 68 6f 75 6c 64 20  |.;   You should |
00000310  68 61 76 65 20 72 65 63  65 69 76 65 64 20 61 20  |have received a |
00000320  63 6f 70 79 20 6f 66 20  74 68 65 20 47 4e 55 20  |copy of the GNU |
00000330  47 65 6e 65 72 61 6c 20  50 75 62 6c 69 63 20 4c  |General Public L|
00000340  69 63 65 6e 73 65 0a 3b  20 20 20 61 6c 6f 6e 67  |icense.;   along|
00000350  20 77 69 74 68 20 74 68  69 73 20 70 72 6f 67 72  | with this progr|
00000360  61 6d 3b 20 69 66 20 6e  6f 74 2c 20 77 72 69 74  |am; if not, writ|
00000370  65 20 74 6f 20 74 68 65  20 46 72 65 65 20 53 6f  |e to the Free So|
00000380  66 74 77 61 72 65 0a 3b  20 20 20 46 6f 75 6e 64  |ftware.;   Found|
00000390  61 74 69 6f 6e 2c 20 49  6e 63 2e 2c 20 36 37 35  |ation, Inc., 675|
000003a0  20 4d 61 73 73 20 41 76  65 2c 20 43 61 6d 62 72  | Mass Ave, Cambr|
000003b0  69 64 67 65 2c 20 4d 41  20 30 32 31 33 39 2c 20  |idge, MA 02139, |
000003c0  55 53 41 2e 0a 3b 0a 3b  20 20 20 41 75 74 68 6f  |USA..;.;   Autho|
000003d0  72 3a 20 52 20 47 61 6d  6d 61 6e 73 20 3c 72 67  |r: R Gammans <rg|
000003e0  61 6d 6d 61 6e 73 40 63  6f 6d 70 73 75 72 67 2c  |ammans@compsurg,|
000003f0  64 65 6d 6f 6e 2e 63 6f  2e 75 6b 3e 0a 3b 20 20  |demon.co.uk>.;  |
00000400  20 53 6e 61 69 6c 6d 61  69 6c 20 20 3a 20 32 30  | Snailmail  : 20|
00000410  20 54 72 65 6e 63 68 65  73 20 52 64 2c 20 43 72  | Trenches Rd, Cr|
00000420  6f 77 62 6f 72 6f 75 67  68 2c 20 45 20 53 75 73  |owborough, E Sus|
00000430  73 65 78 2c 20 54 4e 36  20 31 45 53 20 55 4b 2e  |sex, TN6 1ES UK.|
00000440  0a 3b 0a 0a 0a 20 20 20  20 20 20 20 20 20 20 47  |.;...          G|
00000450  45 54 20 20 20 41 73 6d  4c 69 62 3a 73 2e 44 65  |ET   AsmLib:s.De|
00000460  62 75 67 48 64 72 0a 0a  20 3b 44 65 62 75 67 20  |bugHdr.. ;Debug |
00000470  20 20 20 20 53 45 54 4c  20 20 7b 54 52 55 45 7d  |    SETL  {TRUE}|
00000480  0a 44 65 62 75 67 20 20  20 20 20 53 45 54 4c 20  |.Debug     SETL |
00000490  20 7b 46 41 4c 53 45 7d  0a 0a 09 09 47 45 54 09  | {FALSE}....GET.|
000004a0  09 41 73 6d 4c 69 62 3a  68 2e 53 57 49 4e 61 6d  |.AsmLib:h.SWINam|
000004b0  65 73 0a 20 20 20 20 20  20 20 20 20 20 20 20 20  |es.             |
000004c0  20 20 20 47 45 54 20 20  20 20 09 20 09 41 73 6d  |   GET    . .Asm|
000004d0  4c 69 62 3a 68 2e 46 53  43 6f 6e 74 72 6f 6c 73  |Lib:h.FSControls|
000004e0  0a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
000004f0  20 47 45 54 09 09 41 73  6d 4c 69 62 3a 68 2e 70  | GET..AsmLib:h.p|
00000500  73 72 46 6c 61 67 73 0a  09 09 47 45 54 09 09 41  |srFlags...GET..A|
00000510  73 6d 4c 69 62 3a 68 2e  73 6f 63 6b 43 6f 6e 73  |smLib:h.sockCons|
00000520  74 73 0a 0a 20 09 09 49  4d 50 4f 52 54 20 20 09  |ts.. ..IMPORT  .|
00000530  7c 5f 5f 52 65 6c 6f 63  43 6f 64 65 7c 0a 09 09  ||__RelocCode|...|
00000540  49 4d 50 4f 52 54 09 09  7c 5f 63 6c 69 62 5f 69  |IMPORT..|_clib_i|
00000550  6e 69 74 69 61 6c 69 73  65 6d 6f 64 75 6c 65 7c  |nitialisemodule||
00000560  0a 09 09 49 4d 50 4f 52  54 09 09 7c 5f 63 6c 69  |...IMPORT..|_cli|
00000570  62 5f 66 69 6e 61 6c 69  73 65 6d 6f 64 75 6c 65  |b_finalisemodule|
00000580  7c 0a 09 09 49 4d 50 4f  52 54 09 09 7c 6d 61 6c  ||...IMPORT..|mal|
00000590  6c 6f 63 7c 0a 09 09 49  4d 50 4f 52 54 09 09 7c  |loc|...IMPORT..||
000005a0  6d 65 6d 63 70 79 7c 0a  09 09 49 4d 50 4f 52 54  |memcpy|...IMPORT|
000005b0  09 09 7c 6d 61 6b 65 53  6f 63 6b 65 74 7c 0a 09  |..|makeSocket|..|
000005c0  09 49 4d 50 4f 52 54 09  09 7c 69 6e 69 74 68 61  |.IMPORT..|initha|
000005d0  6e 64 6c 65 72 6c 69 73  74 7c 0a 09 09 49 4d 50  |ndlerlist|...IMP|
000005e0  4f 52 54 09 09 7c 5f 4c  69 62 24 52 65 6c 6f 63  |ORT..|_Lib$Reloc|
000005f0  24 4f 66 66 24 44 50 7c  0a 0a 09 20 09 41 52 45  |$Off$DP|... .ARE|
00000600  41 20 09 09 7c 21 21 4d  6f 64 75 6c 65 24 48 65  |A ..|!!Module$He|
00000610  61 64 65 72 7c 2c 20 43  4f 44 45 2c 20 52 45 41  |ader|, CODE, REA|
00000620  44 4f 4e 4c 59 0a 0a 50  63 09 09 52 4e 09 09 52  |DONLY..Pc..RN..R|
00000630  31 35 0a 70 63 09 09 52  4e 09 09 52 31 35 0a 50  |15.pc..RN..R15.P|
00000640  43 09 09 52 4e 09 09 52  31 35 0a 0a 0a 74 65 6d  |C..RN..R15...tem|
00000650  70 62 79 74 65 09 2a 09  09 30 09 3b 55 73 65 20  |pbyte.*..0.;Use |
00000660  66 69 72 73 74 20 62 79  74 65 20 6f 66 20 77 6f  |first byte of wo|
00000670  72 6b 73 70 61 63 65 20  61 73 20 64 75 6d 70 69  |rkspace as dumpi|
00000680  6e 67 20 67 72 6f 75 6e  64 2e 0a 0a 0a 0a 53 6f  |ng ground.....So|
00000690  63 6b 65 74 46 53 4d 6f  64 5f 42 61 73 65 41 64  |cketFSMod_BaseAd|
000006a0  64 72 0a 0a 09 09 44 43  44 09 09 30 0a 09 09 44  |dr....DCD..0...D|
000006b0  43 44 09 09 53 6f 63 6b  65 74 5f 49 6e 69 74 20  |CD..Socket_Init |
000006c0  20 20 20 2d 20 53 6f 63  6b 65 74 46 53 4d 6f 64  |   - SocketFSMod|
000006d0  5f 42 61 73 65 41 64 64  72 0a 09 09 44 43 44 20  |_BaseAddr...DCD |
000006e0  20 20 20 20 09 53 6f 63  6b 65 74 5f 44 69 65 20  |    .Socket_Die |
000006f0  20 20 20 20 2d 20 53 6f  63 6b 65 74 46 53 4d 6f  |    - SocketFSMo|
00000700  64 5f 42 61 73 65 41 64  64 72 0a 09 09 44 43 44  |d_BaseAddr...DCD|
00000710  09 09 30 09 09 09 3b 4c  61 74 65 72 20 76 65 72  |..0...;Later ver|
00000720  73 69 6f 6e 20 77 69 6c  6c 20 70 72 6f 62 61 6c  |sion will probal|
00000730  79 0a 09 09 09 09 09 09  09 3b 68 61 6e 64 6c 65  |y........;handle|
00000740  20 73 65 72 76 69 63 65  73 0a 09 09 44 43 44 09  | services...DCD.|
00000750  09 53 6f 63 6b 65 74 5f  54 69 74 6c 65 20 20 20  |.Socket_Title   |
00000760  2d 20 53 6f 63 6b 65 74  46 53 4d 6f 64 5f 42 61  |- SocketFSMod_Ba|
00000770  73 65 41 64 64 72 0a 09  09 44 43 44 09 09 53 6f  |seAddr...DCD..So|
00000780  63 6b 65 74 5f 48 65 6c  70 53 74 72 20 2d 20 53  |cket_HelpStr - S|
00000790  6f 63 6b 65 74 46 53 4d  6f 64 5f 42 61 73 65 41  |ocketFSMod_BaseA|
000007a0  64 64 72 0a 09 09 44 43  44 09 09 53 6f 63 6b 65  |ddr...DCD..Socke|
000007b0  74 5f 48 43 5f 54 61 62  6c 65 2d 20 53 6f 63 6b  |t_HC_Table- Sock|
000007c0  65 74 46 53 4d 6f 64 5f  42 61 73 65 41 64 64 72  |etFSMod_BaseAddr|
000007d0  0a 09 09 44 43 44 09 09  30 0a 09 09 44 43 44 09  |...DCD..0...DCD.|
000007e0  09 30 0a 09 09 44 43 44  09 09 30 0a 20 20 20 20  |.0...DCD..0.    |
000007f0  20 20 20 20 20 20 20 20  20 20 20 20 44 43 44 20  |            DCD |
00000800  20 20 20 20 09 30 0a 0a  53 6f 63 6b 65 74 5f 44  |    .0..Socket_D|
00000810  6f 53 57 49 0a 53 6f 63  6b 65 74 5f 53 57 49 54  |oSWI.Socket_SWIT|
00000820  61 62 6c 65 0a 20 20 20  20 20 20 20 20 20 20 20  |able.           |
00000830  20 20 20 20 20 44 43 44  20 20 20 20 20 09 30 2c  |     DCD     .0,|
00000840  30 0a 53 6f 63 6b 65 74  5f 54 69 74 6c 65 0a 09  |0.Socket_Title..|
00000850  09 44 43 42 09 09 22 53  6f 63 6b 65 74 46 53 22  |.DCB.."SocketFS"|
00000860  2c 30 0a 53 6f 63 6b 65  74 5f 48 65 6c 70 53 74  |,0.Socket_HelpSt|
00000870  72 09 44 43 42 09 09 22  53 6f 63 6b 65 74 46 53  |r.DCB.."SocketFS|
00000880  22 2c 39 2c 22 30 2e 30  31 20 28 31 38 20 41 75  |",9,"0.01 (18 Au|
00000890  67 20 31 39 39 37 29 20  a9 20 52 6f 67 65 72 20  |g 1997) . Roger |
000008a0  47 61 6d 6d 61 6e 73 2e  20 44 69 73 74 72 69 62  |Gammans. Distrib|
000008b0  75 74 65 20 61 73 20 70  65 72 20 47 50 4c 20 56  |ute as per GPL V|
000008c0  32 22 2c 30 0a 09 09 41  4c 49 47 4e 0a 53 6f 63  |2",0...ALIGN.Soc|
000008d0  6b 65 74 5f 48 43 5f 54  61 62 6c 65 09 44 43 42  |ket_HC_Table.DCB|
000008e0  20 09 09 22 53 6f 63 6b  65 74 46 53 22 2c 30 0a  | .."SocketFS",0.|
000008f0  20 09 09 41 4c 49 47 4e  0a 09 09 44 43 44 09 09  | ..ALIGN...DCD..|
00000900  73 6f 63 6b 65 74 5f 73  65 6c 65 63 74 66 73 2d  |socket_selectfs-|
00000910  20 53 6f 63 6b 65 74 46  53 4d 6f 64 5f 42 61 73  | SocketFSMod_Bas|
00000920  65 41 64 64 72 0a 09 09  44 43 44 09 09 30 0a 09  |eAddr...DCD..0..|
00000930  09 44 43 44 09 09 30 0a  09 09 44 43 44 09 09 73  |.DCD..0...DCD..s|
00000940  6f 63 6b 65 74 5f 73 65  6c 65 63 74 66 73 5f 68  |ocket_selectfs_h|
00000950  65 6c 70 2d 20 53 6f 63  6b 65 74 46 53 4d 6f 64  |elp- SocketFSMod|
00000960  5f 42 61 73 65 41 64 64  72 0a 09 09 44 43 44 09  |_BaseAddr...DCD.|
00000970  09 30 0a 0a 0a 73 6f 63  6b 65 74 5f 73 65 6c 65  |.0...socket_sele|
00000980  63 74 66 73 5f 68 65 6c  70 0a 20 20 20 20 20 20  |ctfs_help.      |
00000990  20 20 20 20 20 20 20 20  20 20 44 43 42 20 20 20  |          DCB   |
000009a0  20 20 09 26 31 62 2c 31  2c 31 33 2c 31 33 2c 22  |  .&1b,1,13,13,"|
000009b0  54 68 69 73 20 63 6f 6d  6d 61 6e 64 20 22 2c 26  |This command ",&|
000009c0  31 62 2c 32 38 2c 22 73  22 2c 26 31 62 2c 32 2c  |1b,28,"s",&1b,2,|
000009d0  22 73 6f 63 6b 65 74 20  22 2c 26 31 62 2c 34 2c  |"socket ",&1b,4,|
000009e0  30 0a 0a 73 6f 63 6b 65  74 5f 73 65 6c 65 63 74  |0..socket_select|
000009f0  66 73 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |fs              |
00000a00  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000a10  20 20 20 3b 4e 69 63 6b  65 64 20 66 6f 72 6d 20  |   ;Nicked form |
00000a20  50 52 4d 73 20 28 52 4f  33 29 20 50 2e 32 2d 35  |PRMs (RO3) P.2-5|
00000a30  32 34 0a 20 20 20 20 20  20 20 20 20 20 20 20 20  |24.             |
00000a40  20 20 20 53 54 4d 46 44  20 20 20 09 52 31 33 21  |   STMFD   .R13!|
00000a50  2c 7b 52 31 34 7d 0a 09  09 4d 4f 56 20 20 20 20  |,{R14}...MOV    |
00000a60  20 09 52 30 2c 23 46 53  43 6f 6e 74 72 6f 6c 5f  | .R0,#FSControl_|
00000a70  73 65 6c 65 63 74 46 53  20 20 3b 31 34 0a 09 09  |selectFS  ;14...|
00000a80  41 44 52 09 09 52 31 2c  73 6f 63 6b 65 74 5f 66  |ADR..R1,socket_f|
00000a90  73 6e 61 6d 65 0a 20 20  20 20 20 20 20 20 20 20  |sname.          |
00000aa0  20 20 20 20 20 20 53 57  49 09 09 58 4f 53 5f 46  |      SWI..XOS_F|
00000ab0  53 43 6f 6e 74 72 6f 6c  0a 09 09 4c 44 4d 46 44  |SControl...LDMFD|
00000ac0  09 09 52 31 33 21 2c 20  7b 50 43 7d 0a 0a 53 6f  |..R13!, {PC}..So|
00000ad0  63 6b 65 74 5f 49 6e 69  74 0a 09 09 53 54 4d 46  |cket_Init...STMF|
00000ae0  44 09 09 52 31 33 21 2c  7b 52 37 2d 52 31 31 2c  |D..R13!,{R7-R11,|
00000af0  72 31 34 7d 0a 09 09 4d  4f 56 09 09 52 31 30 2c  |r14}...MOV..R10,|
00000b00  52 31 33 2c 4c 53 52 20  23 32 30 09 09 09 3b 57  |R13,LSR #20...;W|
00000b10  68 69 63 68 20 4d 42 20  62 6f 75 6e 64 61 72 79  |hich MB boundary|
00000b20  20 69 73 20 74 68 65 20  73 74 61 63 6b 20 6f 6e  | is the stack on|
00000b30  2e 2e 2e 0a 09 09 4d 4f  56 09 09 52 31 30 2c 52  |......MOV..R10,R|
00000b40  31 30 2c 4c 53 4c 20 23  32 30 09 09 09 3b 70 6f  |10,LSL #20...;po|
00000b50  69 6e 74 20 52 31 30 20  64 69 72 65 63 74 6c 79  |int R10 directly|
00000b60  20 61 74 20 62 6f 6f 75  6e 64 61 72 79 2e 2e 2e  | at booundary...|
00000b70  0a 09 09 4c 44 4d 49 41  09 09 52 31 30 2c 7b 52  |...LDMIA..R10,{R|
00000b80  34 2c 52 35 7d 09 09 09  3b 47 65 74 20 72 65 6c  |4,R5}...;Get rel|
00000b90  6f 63 61 74 69 6f 6e 20  66 6f 72 20 6f 74 68 65  |ocation for othe|
00000ba0  72 20 43 20 53 56 43 20  6d 6f 64 75 6c 65 73 2e  |r C SVC modules.|
00000bb0  2e 2e 2e 0a 09 09 53 54  4d 46 44 09 09 52 31 33  |......STMFD..R13|
00000bc0  21 2c 7b 52 34 2c 52 35  7d 09 09 09 3b 68 6f 6c  |!,{R4,R5}...;hol|
00000bd0  64 20 69 74 20 73 61 66  6c 65 79 20 6f 6e 20 74  |d it safley on t|
00000be0  6f 70 20 6f 66 20 73 74  61 63 6b 21 0a 09 09 53  |op of stack!...S|
00000bf0  54 4d 46 44 09 09 52 31  33 21 2c 7b 52 31 32 7d  |TMFD..R13!,{R12}|
00000c00  09 09 09 3b 52 31 32 20  63 6f 72 72 75 70 74 61  |...;R12 corrupta|
00000c10  62 6c 65 20 75 6e 64 65  72 20 41 50 43 53 2d 52  |ble under APCS-R|
00000c20  2e 2e 2e 2e 0a 20 20 20  20 20 20 20 20 20 20 20  |.....           |
00000c30  20 20 20 3b 09 42 4c 20  20 09 09 5f 5f 52 65 6c  |   ;.BL  ..__Rel|
00000c40  6f 63 43 6f 64 65 09 09  09 3b 44 6f 20 61 6e 79  |ocCode...;Do any|
00000c50  20 72 65 6c 6f 63 61 74  69 6f 6e 73 20 61 6e 64  | relocations and|
00000c60  20 72 65 74 75 72 6e 2e  0a 09 09 42 4c 20 09 09  | return....BL ..|
00000c70  5f 63 6c 69 62 5f 69 6e  69 74 69 61 6c 69 73 65  |_clib_initialise|
00000c80  6d 6f 64 75 6c 65 09 09  3b 57 65 20 75 73 65 20  |module..;We use |
00000c90  27 43 27 20 66 75 6e 63  74 69 6f 6e 73 20 73 6f  |'C' functions so|
00000ca0  2e 2e 2e 0a 20 20 20 20  20 20 20 20 20 20 20 20  |....            |
00000cb0  20 20 20 20 44 42 53 45  54 20 20 20 20 20 20 20  |    DBSET       |
00000cc0  20 20 20 20 44 65 62 75  67 4f 6e 20 3a 4f 52 3a  |    DebugOn :OR:|
00000cd0  20 55 73 65 54 72 61 63  6b 65 72 0a 20 20 20 20  | UseTracker.    |
00000ce0  20 20 20 20 20 20 09 44  42 46 20 20 20 20 20 20  |      .DBF      |
00000cf0  20 20 20 20 20 20 20 22  5c 66 53 74 61 72 74 69  |       "\fStarti|
00000d00  6e 67 5c 6e 2d 73 70 20  3d 20 26 25 64 77 5c 6e  |ng\n-sp = &%dw\n|
00000d10  22 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |".              |
00000d20  20 20 4d 4f 56 20 20 20  20 20 09 52 30 2c 23 31  |  MOV     .R0,#1|
00000d30  32 09 09 09 09 3b 31 32  20 62 79 74 65 73 20 77  |2....;12 bytes w|
00000d40  73 2e 0a 20 20 20 20 20  20 20 20 20 20 20 20 20  |s..             |
00000d50  20 20 20 42 4c 09 09 6d  61 6c 6c 6f 63 09 09 09  |   BL..malloc...|
00000d60  09 3b 41 6c 6c 6f 63 61  74 65 20 69 74 21 0a 09  |.;Allocate it!..|
00000d70  09 4d 4f 56 53 09 09 52  36 2c 52 30 09 09 09 09  |.MOVS..R6,R0....|
00000d80  3b 53 65 74 20 66 6c 61  67 73 20 66 72 6f 6d 20  |;Set flags from |
00000d90  52 30 0a 20 20 20 20 20  20 20 20 20 20 20 20 20  |R0.             |
00000da0  20 20 20 42 45 51 09 09  73 6f 63 6b 65 74 5f 6e  |   BEQ..socket_n|
00000db0  6f 6d 65 6d 09 09 09 3b  43 61 6e 27 74 20 61 6c  |omem...;Can't al|
00000dc0  6c 6f 63 20 72 65 74 20  65 69 74 68 20 65 72 72  |loc ret eith err|
00000dd0  6f 72 0a 09 09 4c 44 4d  46 44 09 09 52 31 33 21  |or...LDMFD..R13!|
00000de0  2c 7b 72 31 32 7d 09 09  09 3b 47 65 74 20 52 31  |,{r12}...;Get R1|
00000df0  32 20 42 61 63 6b 2e 2e  0a 09 09 4c 44 52 09 09  |2 Back.....LDR..|
00000e00  52 31 32 2c 5b 52 31 32  5d 09 09 09 3b 47 65 74  |R12,[R12]...;Get|
00000e10  20 77 73 20 66 72 6d 20  70 72 69 76 61 74 65 20  | ws frm private |
00000e20  77 6f 72 64 2e 2e 2e 0a  09 09 53 54 52 09 09 52  |word......STR..R|
00000e30  31 32 2c 5b 52 36 2c 23  34 5d 09 09 09 3b 53 74  |12,[R6,#4]...;St|
00000e40  6f 72 65 20 73 74 75 62  27 73 20 77 73 20 70 74  |ore stub's ws pt|
00000e50  72 2e 0a 09 09 44 42 46  09 09 22 44 6f 69 6e 67  |r....DBF.."Doing|
00000e60  20 41 46 5f 49 4e 49 54  20 28 73 69 63 29 20 20  | AF_INIT (sic)  |
00000e70  77 73 40 20 25 34 77 2c  20 25 63 77 5c 6e 22 0a  |ws@ %4w, %cw\n".|
00000e80  09 20 20 20 20 20 20 20  20 42 4c 09 09 69 6e 69  |.        BL..ini|
00000e90  74 68 61 6e 64 6c 65 72  6c 69 73 74 09 09 09 3b  |thandlerlist...;|
00000ea0  49 6e 69 74 69 61 6c 69  73 65 20 6c 69 73 74 20  |Initialise list |
00000eb0  6f 66 20 6b 6e 6f 77 6e  20 61 64 64 72 65 73 73  |of known address|
00000ec0  20 66 61 6d 69 6c 69 65  73 0a 20 09 09 44 42 46  | families. ..DBF|
00000ed0  20 20 20 20 20 20 20 20  20 20 20 20 20 22 44 6f  |             "Do|
00000ee0  6e 65 20 41 46 5f 49 4e  49 54 20 77 73 27 73 20  |ne AF_INIT ws's |
00000ef0  40 20 25 34 77 2c 20 25  63 77 5c 6e 22 0a 09 09  |@ %4w, %cw\n"...|
00000f00  42 4c 09 09 73 6f 63 6b  65 74 5f 63 6c 69 62 73  |BL..socket_clibs|
00000f10  74 61 63 6b 75 6e 6d 75  6e 67 65 20 20 20 20 20  |tackunmunge     |
00000f20  20 20 20 20 3b 52 65 74  75 72 6e 20 73 74 61 63  |    ;Return stac|
00000f30  6b 20 74 6f 20 53 56 43  20 73 74 64 2e 2e 0a 09  |k to SVC std....|
00000f40  09 44 42 46 20 20 20 20  20 20 20 20 20 20 20 20  |.DBF            |
00000f50  20 22 44 6f 6e 65 20 53  74 61 63 6b 20 75 6e 6d  | "Done Stack unm|
00000f60  75 6e 67 65 2e 2e 2e 73  70 20 3d 20 26 25 64 77  |unge...sp = &%dw|
00000f70  5c 6e 22 0a 20 20 20 20  20 20 20 20 20 20 20 20  |\n".            |
00000f80  20 20 20 20 4d 4f 56 09  09 52 33 2c 52 36 09 09  |    MOV..R3,R6..|
00000f90  09 09 3b 50 61 73 73 20  6f 75 72 20 77 73 20 74  |..;Pass our ws t|
00000fa0  6f 20 46 53 5f 63 6f 6e  74 72 6f 6c 20 61 73 20  |o FS_control as |
00000fb0  77 73 20 70 74 72 0a 20  20 20 20 20 20 20 20 20  |ws ptr.         |
00000fc0  20 20 20 20 20 20 20 4d  4f 56 20 20 20 20 09 09  |       MOV    ..|
00000fd0  52 30 2c 23 46 53 43 6f  6e 74 72 6f 6c 5f 41 64  |R0,#FSControl_Ad|
00000fe0  64 46 53 0a 20 20 20 20  20 20 20 20 20 20 20 20  |dFS.            |
00000ff0  20 20 20 20 41 44 52 20  20 20 09 09 52 31 2c 53  |    ADR   ..R1,S|
00001000  6f 63 6b 65 74 46 53 4d  6f 64 5f 42 61 73 65 41  |ocketFSMod_BaseA|
00001010  64 64 72 0a 09 09 4d 4f  56 20 20 20 20 09 09 52  |ddr...MOV    ..R|
00001020  32 2c 23 20 73 6f 63 6b  65 74 5f 46 53 69 6e 66  |2,# socket_FSinf|
00001030  6f 20 2d 20 53 6f 63 6b  65 74 46 53 4d 6f 64 5f  |o - SocketFSMod_|
00001040  42 61 73 65 41 64 64 72  0a 20 20 20 20 20 20 20  |BaseAddr.       |
00001050  20 20 20 20 20 20 20 20  20 44 42 46 09 09 22 41  |         DBF.."A|
00001060  62 6f 75 74 20 74 6f 20  63 61 6c 6c 20 53 57 49  |bout to call SWI|
00001070  2e 2e 2e 5c 6e 22 0a 20  20 20 20 20 20 20 20 20  |...\n".         |
00001080  20 20 20 20 20 20 20 53  57 49 20 20 20 20 09 09  |       SWI    ..|
00001090  58 4f 53 5f 46 53 43 6f  6e 74 72 6f 6c 20 20 20  |XOS_FSControl   |
000010a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
000010b0  41 64 64 20 46 53 20 69  6e 66 6f 20 74 6f 20 52  |Add FS info to R|
000010c0  49 53 43 2d 4f 53 0a 09  09 44 42 46 09 09 22 44  |ISC-OS...DBF.."D|
000010d0  6f 6e 65 20 53 57 49 20  41 44 44 46 53 5c 6e 22  |one SWI ADDFS\n"|
000010e0  0a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
000010f0  20 4c 44 4d 46 44 20 20  09 09 52 31 33 21 2c 7b  | LDMFD  ..R13!,{|
00001100  52 37 2d 72 31 31 2c 70  63 7d 0a 0a 53 6f 63 6b  |R7-r11,pc}..Sock|
00001110  65 74 5f 44 69 65 0a 20  20 20 20 20 20 20 20 20  |et_Die.         |
00001120  20 20 20 20 20 20 20 4c  44 52 20 09 09 52 31 32  |       LDR ..R12|
00001130  2c 5b 52 31 32 5d 09 09  09 3b 47 65 74 20 70 6f  |,[R12]...;Get po|
00001140  69 6e 74 65 72 20 74 6f  20 77 6f 72 6b 73 70 61  |inter to workspa|
00001150  63 65 2e 0a 20 20 20 20  20 20 20 09 09 53 54 4d  |ce..       ..STM|
00001160  46 44 09 09 52 31 33 21  2c 7b 52 31 34 7d 09 09  |FD..R13!,{R14}..|
00001170  09 3b 53 61 76 65 20 52  31 34 20 6f 6e 20 73 74  |.;Save R14 on st|
00001180  61 63 6b 20 73 6f 20 77  65 20 63 61 6e 20 75 73  |ack so we can us|
00001190  65 20 53 57 49 73 0a 09  09 4d 4f 56 09 09 52 30  |e SWIs...MOV..R0|
000011a0  2c 23 46 53 43 6f 6e 74  72 6f 6c 5f 72 65 6d 6f  |,#FSControl_remo|
000011b0  76 65 46 53 0a 09 09 41  44 52 09 09 52 31 2c 73  |veFS...ADR..R1,s|
000011c0  6f 63 6b 65 74 5f 66 73  6e 61 6d 65 0a 09 09 53  |ocket_fsname...S|
000011d0  57 49 20 09 09 58 4f 53  5f 46 53 43 6f 6e 74 72  |WI ..XOS_FSContr|
000011e0  6f 6c 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |ol              |
000011f0  20 20 20 20 20 3b 54 65  6c 6c 20 52 49 53 43 2d  |     ;Tell RISC-|
00001200  4f 53 20 46 53 20 69 73  20 67 6f 69 6e 67 2e 2e  |OS FS is going..|
00001210  2e 0a 09 09 42 4c 09 09  73 6f 63 6b 65 74 5f 63  |....BL..socket_c|
00001220  6c 69 62 73 74 61 63 6b  6d 75 6e 67 65 0a 09 09  |libstackmunge...|
00001230  4d 4f 56 09 09 52 30 2c  52 31 32 0a 20 20 20 20  |MOV..R0,R12.    |
00001240  20 20 20 20 20 20 20 20  20 20 20 20 42 4c 09 09  |            BL..|
00001250  5f 63 6c 69 62 5f 66 69  6e 61 6c 69 73 65 6d 6f  |_clib_finalisemo|
00001260  64 75 6c 65 0a 20 20 20  20 20 20 20 20 20 20 20  |dule.           |
00001270  20 20 20 20 20 42 4c 09  09 73 6f 63 6b 65 74 5f  |     BL..socket_|
00001280  63 6c 69 62 73 74 61 63  6b 75 6e 6d 75 6e 67 65  |clibstackunmunge|
00001290  0a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
000012a0  20 43 4d 50 09 09 50 43  2c 23 30 09 09 09 09 3b  | CMP..PC,#0....;|
000012b0  43 6c 65 61 72 20 56 20  66 6c 61 67 2e 0a 20 20  |Clear V flag..  |
000012c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 4c 44  |              LD|
000012d0  4d 46 44 09 09 52 31 33  21 2c 7b 70 63 7d 09 09  |MFD..R13!,{pc}..|
000012e0  09 3b 44 6f 6e 65 20 67  6f 20 68 6f 6d 65 2e 0a  |.;Done go home..|
000012f0  0a 73 6f 63 6b 65 74 5f  6e 6f 6d 65 6d 0a 09 09  |.socket_nomem...|
00001300  4c 44 4d 46 44 09 09 52  31 33 21 2c 7b 52 31 32  |LDMFD..R13!,{R12|
00001310  7d 0a 09 09 4c 44 4d 46  44 09 09 52 31 33 21 2c  |}...LDMFD..R13!,|
00001320  7b 52 37 2d 52 31 31 2c  52 31 34 7d 0a 09 09 41  |{R7-R11,R14}...A|
00001330  44 52 09 09 52 30 2c 73  6f 63 6b 65 74 5f 6e 6f  |DR..R0,socket_no|
00001340  6d 65 6d 6d 73 67 0a 09  09 4f 52 52 53 09 09 50  |memmsg...ORRS..P|
00001350  43 2c 52 31 34 2c 23 56  5f 42 69 74 0a 73 6f 63  |C,R14,#V_Bit.soc|
00001360  6b 65 74 5f 6e 6f 6d 65  6d 6d 73 67 0a 09 09 44  |ket_nomemmsg...D|
00001370  43 44 09 09 26 30 30 31  46 46 30 31 0a 09 09 44  |CD..&001FF01...D|
00001380  43 42 09 09 22 4e 6f 20  6d 65 6d 6f 72 79 20 66  |CB.."No memory f|
00001390  6f 72 20 66 69 6c 69 6e  67 20 73 79 73 74 65 6d  |or filing system|
000013a0  22 2c 31 33 2c 30 0a 09  09 41 4c 49 47 4e 0a 0a  |",13,0...ALIGN..|
000013b0  0a 20 20 3b 4e 65 65 64  20 74 6f 20 66 69 6e 64  |.  ;Need to find|
000013c0  20 49 20 62 65 74 74 72  20 77 61 79 20 6f 66 20  | I bettr way of |
000013d0  63 6f 6d 6d 65 6e 74 69  6e 67 20 74 68 65 73 65  |commenting these|
000013e0  20 62 69 74 20 66 69 65  6c 64 73 2e 0a 20 20 3b  | bit fields..  ;|
000013f0  73 6f 63 6b 65 74 5f 69  6e 66 6f 5f 77 6f 72 64  |socket_info_word|
00001400  20 45 51 55 09 09 31 20  20 20 3c 3c 20 33 31 2b  | EQU..1   << 31+|
00001410  0a 3b 09 09 09 09 31 20  20 20 3c 3c 20 33 30 09  |.;....1   << 30.|
00001420  2b 20 20 20 20 20 20 09  09 3b 53 74 72 65 61 6d  |+      ..;Stream|
00001430  73 20 61 72 65 20 69 6e  74 65 72 61 63 74 69 76  |s are interactiv|
00001440  65 0a 3b 09 09 09 09 30  20 20 20 3c 3c 20 32 39  |e.;....0   << 29|
00001450  09 2b 09 09 3b 46 53 20  64 6f 65 73 20 73 75 70  |.+..;FS does sup|
00001460  70 6f 72 74 20 6e 75 6c  6c 20 6c 65 6e 67 74 68  |port null length|
00001470  20 6e 61 6d 65 73 3b 0a  3b 09 09 09 09 31 20 20  | names;.;....1  |
00001480  20 3c 3c 20 32 38 09 2b  09 09 3b 46 53 20 73 68  | << 28.+..;FS sh|
00001490  6f 75 6c 64 20 62 65 20  61 73 6b 65 64 20 74 6f  |ould be asked to|
000014a0  20 6f 70 65 6e 20 4e 6f  6e 2d 65 78 69 73 74 65  | open Non-existe|
000014b0  6e 74 20 66 69 6c 65 73  0a 3b 09 09 09 09 30 20  |nt files.;....0 |
000014c0  20 20 3c 3c 20 32 37 20  20 20 20 20 20 20 2b 09  |  << 27       +.|
000014d0  09 3b 55 73 65 20 46 53  45 6e 74 72 79 20 41 72  |.;Use FSEntry Ar|
000014e0  67 73 20 32 35 35 20 74  6f 20 66 6c 75 73 68 0a  |gs 255 to flush.|
000014f0  3b 09 09 09 09 31 20 20  20 3c 3c 20 32 36 09 2b  |;....1   << 26.+|
00001500  09 09 3b 57 65 20 73 75  70 70 6f 72 74 20 46 53  |..;We support FS|
00001510  5f 46 69 6c 65 20 39 0a  3b 09 09 09 09 31 20 20  |_File 9.;....1  |
00001520  20 3c 3c 20 32 35 09 2b  09 09 3b 57 65 20 73 75  | << 25.+..;We su|
00001530  70 70 6f 72 74 20 46 53  5f 46 75 6e 63 20 32 30  |pport FS_Func 20|
00001540  0a 3b 09 09 09 09 30 20  20 20 3c 3c 20 32 34 09  |.;....0   << 24.|
00001550  2b 09 09 3b 43 75 72 72  65 6e 74 6c 79 20 72 65  |+..;Currently re|
00001560  73 65 72 76 65 64 2e 0a  3b 09 09 09 09 30 20 20  |served..;....0  |
00001570  20 3c 3c 20 32 33 09 2b  09 09 3b 77 65 20 64 6f  | << 23.+..;we do|
00001580  6e 27 74 20 73 75 70 70  6f 72 74 20 49 6d 61 67  |n't support Imag|
00001590  65 46 53 20 65 78 74 65  6e 73 69 6f 6e 0a 3b 09  |eFS extension.;.|
000015a0  09 09 09 30 20 20 20 3c  3c 20 32 32 09 2b 09 09  |...0   << 22.+..|
000015b0  3b 44 6f 20 20 70 61 73  73 20 26 20 61 6e 64 20  |;Do  pass & and |
000015c0  25 20 69 6e 20 70 61 74  68 0a 3b 09 09 09 09 31  |% in path.;....1|
000015d0  20 20 20 3c 3c 20 32 31  09 2b 09 09 3b 4e 65 65  |   << 21.+..;Nee|
000015e0  64 20 6e 6f 74 20 73 74  6f 72 65 20 64 69 72 61  |d not store dira|
000015f0  0a 3b 09 09 09 09 31 20  20 20 3c 3c 20 32 30 09  |.;....1   << 20.|
00001600  2b 09 09 3b 55 73 65 20  4f 70 65 6e 2f 47 65 74  |+..;Use Open/Get|
00001610  2f 43 6c 6f 73 65 20 69  6e 20 70 72 65 66 20 74  |/Close in pref t|
00001620  6f 20 46 69 6c 65 20 32  35 35 0a 3b 09 09 09 09  |o File 255.;....|
00001630  31 20 20 20 3c 3c 20 31  39 09 2b 09 09 3b 55 73  |1   << 19.+..;Us|
00001640  65 20 4f 70 65 6e 2f 47  65 74 2f 43 6c 6f 73 65  |e Open/Get/Close|
00001650  20 69 6e 20 70 72 65 66  20 74 6f 20 46 69 6c 65  | in pref to File|
00001660  20 30 0a 3b 09 09 09 09  31 20 20 20 3c 3c 20 31  | 0.;....1   << 1|
00001670  38 09 2b 09 09 3b 55 73  65 20 46 53 5f 65 6e 74  |8.+..;Use FS_ent|
00001680  72 79 20 39 20 69 6e 73  74 65 61 64 20 6f 66 20  |ry 9 instead of |
00001690  46 53 5f 45 6e 74 72 79  20 46 69 6c 65 0a 3b 09  |FS_Entry File.;.|
000016a0  09 09 09 30 20 20 20 3c  3c 20 31 37 09 2b 09 09  |...0   << 17.+..|
000016b0  3b 45 78 74 72 61 20 69  6e 66 6f 20 77 6f 72 64  |;Extra info word|
000016c0  20 6e 6f 74 20 70 72 65  73 65 6e 74 0a 3b 09 09  | not present.;..|
000016d0  09 09 30 20 20 20 3c 3c  20 31 36 09 2b 09 09 3b  |..0   << 16.+..;|
000016e0  46 53 20 77 72 69 74 61  62 6c 65 0a 3b 09 09 09  |FS writable.;...|
000016f0  09 26 30 20 3c 3c 20 38  09 2b 09 09 09 3b 4e 6f  |.&0 << 8.+...;No|
00001700  20 64 65 66 69 74 69 74  6e 76 65 20 6c 69 6d 69  | defititnve limi|
00001710  74 20 74 6f 20 6f 70 65  6e 20 66 69 6c 65 73 2e  |t to open files.|
00001720  0a 3b 09 09 31 20 20 20  3c 3c 20 33 31 2b 5c 0a  |.;..1   << 31+\.|
00001730  0a 73 6f 63 6b 65 74 5f  69 6e 66 6f 5f 77 6f 72  |.socket_info_wor|
00001740  64 20 20 09 45 51 55 09  31 20 20 20 3c 3c 20 33  |d  .EQU.1   << 3|
00001750  31 2b 5c 0a 20 31 20 20  20 3c 3c 20 33 30 2b 5c  |1+\. 1   << 30+\|
00001760  0a 20 30 20 20 20 3c 3c  20 32 39 2b 5c 0a 20 31  |. 0   << 29+\. 1|
00001770  20 20 20 3c 3c 20 32 38  2b 5c 0a 20 30 20 20 20  |   << 28+\. 0   |
00001780  3c 3c 20 32 37 2b 5c 0a  20 31 20 20 20 3c 3c 20  |<< 27+\. 1   << |
00001790  32 36 2b 5c 0a 20 31 20  20 20 3c 3c 20 32 35 2b  |26+\. 1   << 25+|
000017a0  5c 0a 20 30 20 20 20 3c  3c 20 32 34 2b 5c 0a 20  |\. 0   << 24+\. |
000017b0  30 20 20 20 3c 3c 20 32  33 2b 5c 0a 20 30 20 20  |0   << 23+\. 0  |
000017c0  20 3c 3c 20 32 32 2b 5c  0a 20 26 46 20 20 3c 3c  | << 22+\. &F  <<|
000017d0  20 31 38 2b 5c 0a 20 30  20 20 20 3c 3c 20 31 37  | 18+\. 0   << 17|
000017e0  2b 5c 0a 20 30 20 20 20  3c 3c 20 31 36 2b 5c 0a  |+\. 0   << 16+\.|
000017f0  20 30 20 20 3c 3c 20 38  2b 5c 0a 20 20 26 30 30  | 0  << 8+\.  &00|
00001800  46 46 09 09 09 3b 53 6f  63 6b 65 74 46 53 20 4e  |FF...;SocketFS N|
00001810  75 6d 62 65 72 0a 0a 0a  73 6f 63 6b 65 74 5f 46  |umber...socket_F|
00001820  53 69 6e 66 6f 0a 09 20  20 09 44 43 44 09 09 73  |Sinfo..  .DCD..s|
00001830  6f 63 6b 65 74 5f 66 73  6e 61 6d 65 09 20 2d 20  |ocket_fsname. - |
00001840  53 6f 63 6b 65 74 46 53  4d 6f 64 5f 42 61 73 65  |SocketFSMod_Base|
00001850  41 64 64 72 0a 09 20 20  09 44 43 44 09 09 73 74  |Addr..  .DCD..st|
00001860  61 72 74 75 70 5f 6d 73  67 09 20 2d 20 53 6f 63  |artup_msg. - Soc|
00001870  6b 65 74 46 53 4d 6f 64  5f 42 61 73 65 41 64 64  |ketFSMod_BaseAdd|
00001880  72 0a 09 09 44 43 44 20  20 09 09 73 6f 63 6b 65  |r...DCD  ..socke|
00001890  74 5f 6f 70 65 6e 09 20  2d 20 53 6f 63 6b 65 74  |t_open. - Socket|
000018a0  46 53 4d 6f 64 5f 42 61  73 65 41 64 64 72 0a 09  |FSMod_BaseAddr..|
000018b0  09 44 43 44 20 09 09 73  6f 63 6b 65 74 5f 72 65  |.DCD ..socket_re|
000018c0  61 64 09 20 2d 20 53 6f  63 6b 65 74 46 53 4d 6f  |ad. - SocketFSMo|
000018d0  64 5f 42 61 73 65 41 64  64 72 0a 20 20 09 09 44  |d_BaseAddr.  ..D|
000018e0  43 44 20 20 20 20 20 09  73 6f 63 6b 65 74 5f 77  |CD     .socket_w|
000018f0  72 69 74 65 09 20 2d 20  53 6f 63 6b 65 74 46 53  |rite. - SocketFS|
00001900  4d 6f 64 5f 42 61 73 65  41 64 64 72 0a 20 20 09  |Mod_BaseAddr.  .|
00001910  09 44 43 44 20 20 20 20  20 09 73 6f 63 6b 65 74  |.DCD     .socket|
00001920  5f 61 72 67 73 09 20 2d  20 53 6f 63 6b 65 74 46  |_args. - SocketF|
00001930  53 4d 6f 64 5f 42 61 73  65 41 64 64 72 0a 20 20  |SMod_BaseAddr.  |
00001940  09 09 44 43 44 20 20 20  20 20 09 73 6f 63 6b 65  |..DCD     .socke|
00001950  74 5f 63 6c 6f 73 65 09  20 2d 20 53 6f 63 6b 65  |t_close. - Socke|
00001960  74 46 53 4d 6f 64 5f 42  61 73 65 41 64 64 72 0a  |tFSMod_BaseAddr.|
00001970  20 20 09 09 44 43 44 20  20 20 09 09 73 6f 63 6b  |  ..DCD   ..sock|
00001980  65 74 5f 66 69 6c 65 09  20 2d 20 53 6f 63 6b 65  |et_file. - Socke|
00001990  74 46 53 4d 6f 64 5f 42  61 73 65 41 64 64 72 0a  |tFSMod_BaseAddr.|
000019a0  09 09 44 43 44 20 20 20  20 20 09 73 6f 63 6b 65  |..DCD     .socke|
000019b0  74 5f 69 6e 66 6f 5f 77  6f 72 64 0a 09 09 44 43  |t_info_word...DC|
000019c0  44 20 20 20 20 20 09 73  6f 63 6b 65 74 5f 46 75  |D     .socket_Fu|
000019d0  6e 63 09 20 2d 20 53 6f  63 6b 65 74 46 53 4d 6f  |nc. - SocketFSMo|
000019e0  64 5f 42 61 73 65 41 64  64 72 0a 09 09 44 43 44  |d_BaseAddr...DCD|
000019f0  20 20 20 20 20 09 73 6f  63 6b 65 74 5f 47 42 50  |     .socket_GBP|
00001a00  42 09 20 2d 20 53 6f 63  6b 65 74 46 53 4d 6f 64  |B. - SocketFSMod|
00001a10  5f 42 61 73 65 41 64 64  72 0a 09 09 44 43 44 20  |_BaseAddr...DCD |
00001a20  20 20 20 20 09 30 0a 0a  73 6f 63 6b 65 74 5f 66  |    .0..socket_f|
00001a30  73 6e 61 6d 65 0a 09 09  44 43 42 09 09 22 53 6f  |sname...DCB.."So|
00001a40  63 6b 65 74 46 53 22 2c  30 0a 09 09 41 4c 49 47  |cketFS",0...ALIG|
00001a50  4e 0a 73 74 61 72 74 75  70 5f 6d 73 67 0a 09 20  |N.startup_msg.. |
00001a60  20 20 20 20 20 20 20 44  43 42 20 20 20 20 20 09  |       DCB     .|
00001a70  22 49 6e 74 65 72 6e 65  74 20 46 69 6c 65 73 79  |"Internet Filesy|
00001a80  73 74 65 6d 22 2c 30 0a  0a 09 09 41 4c 49 47 4e  |stem",0....ALIGN|
00001a90  0a 0a 0a 73 6f 63 6b 65  74 5f 6f 70 65 6e 0a 20  |...socket_open. |
00001aa0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 53  |               S|
00001ab0  54 4d 46 44 20 20 20 09  52 31 33 21 2c 7b 52 31  |TMFD   .R13!,{R1|
00001ac0  34 7d 0a 09 09 44 42 46  09 09 22 46 69 6c 65 20  |4}...DBF.."File |
00001ad0  6f 70 65 6e 20 65 6e 74  72 79 20 63 61 6c 6c 65  |open entry calle|
00001ae0  64 5c 6e 22 0a 09 09 4d  4f 56 53 09 09 52 30 2c  |d\n"...MOVS..R0,|
00001af0  52 36 09 09 09 09 3b 43  6f 70 79 20 73 70 65 63  |R6....;Copy spec|
00001b00  69 61 6c 20 66 69 65 6c  64 20 6f 76 65 72 0a 09  |ial field over..|
00001b10  09 44 42 46 09 09 22 20  2d 20 73 70 63 66 20 3d  |.DBF.." - spcf =|
00001b20  20 25 30 73 5c 6e 22 20  2c 20 4e 45 0a 09 09 44  | %0s\n" , NE...D|
00001b30  42 46 09 09 22 20 2d 20  6e 6f 20 73 70 65 63 69  |BF.." - no speci|
00001b40  61 6c 20 66 69 65 6c 64  5c 6e 22 2c 20 45 51 0a  |al field\n", EQ.|
00001b50  09 09 44 42 46 09 09 22  20 2d 20 66 6e 61 6d 65  |..DBF.." - fname|
00001b60  20 2d 3d 20 25 31 73 5c  6e 22 09 09 3b 72 65 61  | -= %1s\n"..;rea|
00001b70  73 6f 6e 20 63 6f 64 65  2e 2e 2e 0a 09 09 4c 44  |son code......LD|
00001b80  52 09 09 52 31 32 2c 5b  52 31 32 2c 23 34 5d 09  |R..R12,[R12,#4].|
00001b90  09 09 3b 47 65 74 20 73  74 75 62 73 20 77 73 2e  |..;Get stubs ws.|
00001ba0  0a 09 09 42 4c 09 09 73  6f 63 6b 65 74 5f 63 6c  |...BL..socket_cl|
00001bb0  69 62 73 74 61 63 6b 6d  75 6e 67 65 09 09 3b 53  |ibstackmunge..;S|
00001bc0  65 74 20 73 74 61 63 6b  20 75 70 20 66 6f 72 20  |et stack up for |
00001bd0  43 6c 69 62 2e 0a 20 20  20 20 20 20 20 20 20 20  |Clib..          |
00001be0  20 20 20 20 20 20 42 4c  20 20 20 20 20 20 09 6d  |      BL      .m|
00001bf0  61 6b 65 53 6f 63 6b 65  74 09 09 09 3b 43 61 6c  |akeSocket...;Cal|
00001c00  6c 20 43 20 66 69 6c 65  6e 61 6d 65 20 70 72 6f  |l C filename pro|
00001c10  63 65 73 73 6f 72 0a 20  09 09 09 09 09 09 09 09  |cessor. ........|
00001c20  3b 54 68 69 73 20 67 69  76 65 20 73 6f 63 6b 65  |;This give socke|
00001c30  74 20 69 6e 20 52 30 0a  09 09 42 4c 09 09 73 6f  |t in R0...BL..so|
00001c40  63 6b 65 74 5f 63 6c 69  62 73 74 61 63 6b 75 6e  |cket_clibstackun|
00001c50  6d 75 6e 67 65 0a 20 09  09 09 09 09 09 09 09 3b  |munge. ........;|
00001c60  20 6f 72 20 2d 31 20 69  66 20 6e 6f 20 73 6f 63  | or -1 if no soc|
00001c70  6b 65 74 20 6f 70 65 6e  65 64 0a 20 09 20 20 20  |ket opened. .   |
00001c80  20 20 20 20 20 41 44 44  20 20 20 20 20 09 52 31  |     ADD     .R1|
00001c90  2c 52 30 2c 23 31 20 20  20 20 20 20 20 20 20 09  |,R0,#1         .|
00001ca0  09 3b 4d 61 6b 65 20 6d  79 20 68 61 6e 64 6c 65  |.;Make my handle|
00001cb0  20 74 68 65 20 73 6f 63  6b 65 74 20 6e 75 6d 62  | the socket numb|
00001cc0  65 72 20 2b 31 0a 20 09  20 20 20 20 20 20 20 20  |er +1. .        |
00001cd0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001ce0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 09  |               .|
00001cf0  09 20 09 3b 20 63 6f 6e  76 65 69 65 6e 74 6c 79  |. .; conveiently|
00001d00  20 30 20 6e 6f 77 20 69  6e 64 69 63 61 74 65 73  | 0 now indicates|
00001d10  20 66 69 6c 65 20 6e 6f  74 20 66 6f 75 6e 64 0a  | file not found.|
00001d20  0a 20 09 20 20 20 20 20  20 20 20 4d 4f 56 20 20  |. .        MOV  |
00001d30  20 20 20 09 52 32 2c 23  30 20 20 20 20 20 20 20  |   .R2,#0       |
00001d40  20 20 20 20 20 20 20 20  20 20 20 09 09 3b 55 6e  |           ..;Un|
00001d50  62 75 66 66 65 72 65 64  2e 2e 2e 28 61 63 74 75  |buffered...(actu|
00001d60  61 6c 6c 79 20 69 6e 74  65 72 6e 65 74 20 6d 6f  |ally internet mo|
00001d70  64 0a 20 09 20 20 20 20  20 20 20 20 20 20 20 20  |d. .            |
00001d80  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001d90  20 20 20 20 20 20 20 20  20 20 20 20 09 09 3b 77  |            ..;w|
00001da0  69 6c 6c 20 62 75 66 66  65 72 29 2e 0a 20 09 20  |ill buffer).. . |
00001db0  20 20 20 20 20 20 20 4d  4f 56 20 20 20 20 20 09  |       MOV     .|
00001dc0  52 33 2c 23 30 20 20 20  20 20 20 20 20 20 20 20  |R3,#0           |
00001dd0  20 20 20 20 20 20 20 20  20 09 3b 46 69 6c 65 20  |         .;File |
00001de0  65 78 74 65 6e 74 20 6e  6f 74 20 75 73 65 64 2e  |extent not used.|
00001df0  2e 2e 0a 20 09 20 20 20  20 20 20 20 20 4d 4f 56  |... .        MOV|
00001e00  20 20 20 20 20 09 52 34  2c 23 30 20 20 20 20 20  |     .R4,#0     |
00001e10  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 09  |               .|
00001e20  3b 4e 6f 20 62 75 66 66  65 72 20 73 70 61 63 65  |;No buffer space|
00001e30  20 61 6c 6c 6f 63 61 74  65 64 2e 2e 0a 20 09 20  | allocated... . |
00001e40  20 20 20 20 20 20 20 4d  4f 56 20 20 20 20 20 09  |       MOV     .|
00001e50  52 30 2c 23 26 44 38 30  30 30 30 30 30 20 20 20  |R0,#&D8000000   |
00001e60  20 20 20 20 20 20 20 20  09 3b 46 69 6c 65 20 49  |        .;File I|
00001e70  6e 66 6f 20 77 6f 72 64  0a 0a 20 09 20 20 20 20  |nfo word.. .    |
00001e80  20 20 20 20 3b 46 69 6c  65 20 73 65 74 20 61 73  |    ;File set as|
00001e90  20 72 65 61 64 61 62 6c  72 2c 77 72 69 74 65 61  | readablr,writea|
00001ea0  62 6c 65 2c 53 74 72 65  61 6d 20 64 65 76 69 63  |ble,Stream devic|
00001eb0  65 20 61 6e 64 20 69 6e  74 65 72 61 63 74 69 76  |e and interactiv|
00001ec0  65 0a 0a 20 09 20 20 20  20 20 20 20 20 4c 44 4d  |e.. .        LDM|
00001ed0  46 44 20 20 20 09 52 31  33 21 2c 7b 50 43 7d 5e  |FD   .R13!,{PC}^|
00001ee0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 09  |               .|
00001ef0  3b 46 69 6e 69 73 68 2e  2e 2e 0a 0a 0a 73 6f 63  |;Finish......soc|
00001f00  6b 65 74 5f 72 65 61 64  0a 20 20 20 20 20 20 20  |ket_read.       |
00001f10  20 20 20 20 20 20 20 20  20 53 54 4d 46 44 20 20  |         STMFD  |
00001f20  20 09 52 31 33 21 2c 7b  52 31 34 7d 0a 09 09 44  | .R13!,{R14}...D|
00001f30  42 46 09 09 22 46 69 6c  65 20 72 65 61 64 20 65  |BF.."File read e|
00001f40  6e 74 72 79 20 63 61 6c  6c 65 64 20 66 6f 72 20  |ntry called for |
00001f50  73 6f 63 6b 65 74 20 25  31 77 5c 6e 22 0a 20 20  |socket %1w\n".  |
00001f60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 53 55  |              SU|
00001f70  42 20 20 20 20 20 09 52  30 2c 52 31 2c 23 31 20  |B     .R0,R1,#1 |
00001f80  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001f90  20 20 09 3b 50 75 74 20  73 6f 63 6b 65 74 20 6e  |  .;Put socket n|
00001fa0  75 6d 62 65 72 20 69 6e  20 52 30 2e 0a 09 09 53  |umber in R0....S|
00001fb0  55 42 20 20 20 20 20 20  20 20 20 20 20 20 20 52  |UB             R|
00001fc0  31 33 2c 52 31 33 2c 23  34 09 09 09 3b 72 65 73  |13,R13,#4...;res|
00001fd0  65 76 72 65 20 31 77 20  77 73 20 6f 6e 20 73 74  |evre 1w ws on st|
00001fe0  61 63 6b 2e 0a 20 20 20  20 20 20 20 20 20 20 20  |ack..           |
00001ff0  20 20 20 20 20 4d 4f 56  20 20 20 20 20 09 52 31  |     MOV     .R1|
00002000  2c 52 31 33 09 09 20 20  20 20 20 20 20 20 09 3b  |,R13..        .;|
00002010  50 75 74 20 62 75 66 66  65 72 20 69 6e 20 52 31  |Put buffer in R1|
00002020  2e 2e 0a 20 20 20 20 20  20 20 20 20 20 20 20 20  |...             |
00002030  20 20 20 4d 4f 56 20 20  20 20 20 09 52 32 2c 23  |   MOV     .R2,#|
00002040  31 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |1               |
00002050  20 20 20 20 09 3b 50 75  74 20 62 75 66 66 20 73  |    .;Put buff s|
00002060  69 7a 65 20 69 6e 20 52  32 0a 0a 20 20 20 20 20  |ize in R2..     |
00002070  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002080  20 20 20 20 20 20 20 20  20 20 20 3b 49 67 6e 6f  |           ;Igno|
00002090  72 65 20 66 69 6c 65 20  6f 66 66 73 65 74 20 61  |re file offset a|
000020a0  73 20 77 65 20 68 61 76  65 20 73 74 72 65 61 6d  |s we have stream|
000020b0  73 2e 2e 2e 0a 20 20 20  20 20 20 20 20 20 20 20  |s....           |
000020c0  20 20 20 20 20 53 57 49  20 20 20 20 20 09 58 53  |     SWI     .XS|
000020d0  6f 63 6b 65 74 5f 52 65  61 64 20 20 20 20 20 20  |ocket_Read      |
000020e0  20 20 20 20 20 20 09 3b  43 61 6c 6c 20 49 6e 74  |      .;Call Int|
000020f0  65 72 6e 65 74 20 6d 6f  64 75 6c 65 2e 2e 0a 20  |ernet module... |
00002100  20 20 20 20 20 09 09 4c  44 52 56 43 20 20 20 09  |     ..LDRVC   .|
00002110  52 30 2c 5b 52 31 33 5d  20 09 09 20 20 20 20 20  |R0,[R13] ..     |
00002120  09 3b 49 66 20 6e 6f 20  65 72 72 6f 72 20 67 65  |.;If no error ge|
00002130  74 20 62 79 74 65 20 66  72 6f 6d 20 62 75 66 66  |t byte from buff|
00002140  0a 09 09 41 44 44 09 09  52 31 33 2c 52 31 33 2c  |...ADD..R13,R13,|
00002150  23 34 09 09 09 3b 52 65  6c 65 61 73 65 20 77 73  |#4...;Release ws|
00002160  2e 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |..              |
00002170  20 20 4c 44 4d 56 43 46  44 20 09 52 31 33 21 2c  |  LDMVCFD .R13!,|
00002180  7b 50 43 7d 5e 0a 0a 09  09 4c 44 52 09 09 52 31  |{PC}^....LDR..R1|
00002190  2c 5b 52 30 5d 09 09 09  09 3b 47 65 74 20 45 72  |,[R0]....;Get Er|
000021a0  72 6e 6f 0a 09 09 44 42  46 09 09 22 53 6f 63 6b  |rno...DBF.."Sock|
000021b0  65 74 20 45 72 72 20 25  31 77 5c 6e 22 0a 09 09  |et Err %1w\n"...|
000021c0  43 4d 50 09 09 52 31 2c  23 45 57 4f 55 4c 44 42  |CMP..R1,#EWOULDB|
000021d0  4c 4f 43 4b 09 09 09 3b  49 73 20 52 78 2f 54 78  |LOCK...;Is Rx/Tx|
000021e0  20 6c 69 6d 69 74 73 2e  0a 09 09 4c 44 4d 45 51  | limits....LDMEQ|
000021f0  46 44 09 09 52 31 33 21  2c 7b 52 31 34 7d 09 09  |FD..R13!,{R14}..|
00002200  09 3b 47 65 74 20 6c 72  20 65 61 72 6c 79 20 73  |.;Get lr early s|
00002210  6f 20 77 65 20 63 61 6e  20 73 65 74 20 66 6c 61  |o we can set fla|
00002220  67 73 0a 09 09 4d 4f 56  09 09 52 30 2c 23 30 20  |gs...MOV..R0,#0 |
00002230  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002240  20 20 20 20 20 20 20 20  20 20 3b 52 65 74 72 75  |          ;Retru|
00002250  6e 20 30 20 63 68 61 72  20 2d 20 74 0a 09 09 4f  |n 0 char - t...O|
00002260  52 52 45 51 09 09 50 43  2c 52 31 34 2c 23 43 5f  |RREQ..PC,R14,#C_|
00002270  42 69 74 0a 09 09 3b 4e  6f 77 20 77 65 20 68 61  |Bit...;Now we ha|
00002280  76 65 20 74 6f 20 77 6f  72 6b 20 6f 75 74 20 77  |ve to work out w|
00002290  68 61 74 20 74 6f 20 64  6f 20 69 6e 20 74 68 65  |hat to do in the|
000022a0  20 63 61 73 65 20 6f 66  20 6f 74 68 65 72 20 65  | case of other e|
000022b0  72 72 73 21 2e 0a 09 09  4c 44 4d 46 44 20 09 09  |rrs!....LDMFD ..|
000022c0  52 31 33 21 2c 7b 52 31  34 7d 09 09 09 3b 52 65  |R13!,{R14}...;Re|
000022d0  74 75 72 6e 20 77 69 74  68 20 56 20 73 65 74 21  |turn with V set!|
000022e0  2e 2c 20 6d 0a 09 09 4f  52 52 09 09 50 43 2c 52  |., m...ORR..PC,R|
000022f0  31 34 2c 23 56 5f 42 69  74 09 09 09 3b 53 65 74  |14,#V_Bit...;Set|
00002300  20 56 20 66 6c 61 67 0a  73 6f 63 6b 65 74 5f 77  | V flag.socket_w|
00002310  72 69 74 65 0a 20 20 20  20 20 20 20 20 20 20 20  |rite.           |
00002320  20 20 20 20 20 53 54 4d  46 44 20 20 20 09 52 31  |     STMFD   .R1|
00002330  33 21 2c 7b 52 31 2d 52  32 2c 52 31 34 7d 0a 09  |3!,{R1-R2,R14}..|
00002340  09 44 42 46 09 09 22 46  69 6c 65 20 77 72 69 74  |.DBF.."File writ|
00002350  65 20 65 6e 74 72 79 20  63 61 6c 6c 65 64 5c 6e  |e entry called\n|
00002360  20 20 2d 20 52 30 20 25  30 62 5c 6e 20 2d 20 52  |  - R0 %0b\n - R|
00002370  31 20 25 31 77 5c 6e 22  0a 09 09 53 55 42 09 09  |1 %1w\n"...SUB..|
00002380  52 31 33 2c 52 31 33 2c  23 34 09 09 09 3b 52 65  |R13,R13,#4...;Re|
00002390  73 65 76 72 65 20 31 20  77 20 6f 6e 65 20 73 74  |sevre 1 w one st|
000023a0  61 63 6b 2e 0a 20 20 20  20 20 20 20 20 20 20 20  |ack..           |
000023b0  20 20 20 20 20 53 54 52  20 20 20 20 09 20 09 52  |     STR    . .R|
000023c0  30 2c 5b 52 31 33 5d 09  09 20 20 20 20 20 20 09  |0,[R13]..      .|
000023d0  3b 53 74 6f 72 65 20 62  79 74 65 20 74 6f 20 73  |;Store byte to s|
000023e0  65 6e 64 0a 20 20 20 20  20 20 20 20 20 20 20 20  |end.            |
000023f0  20 20 20 20 53 55 42 20  20 20 20 20 09 52 30 2c  |    SUB     .R0,|
00002400  52 31 2c 23 31 20 20 20  20 20 20 20 20 20 20 20  |R1,#1           |
00002410  20 20 20 20 20 20 20 20  09 3b 50 75 74 20 73 6f  |        .;Put so|
00002420  63 6b 65 74 20 6e 75 6d  62 65 72 20 69 6e 20 52  |cket number in R|
00002430  30 2e 0a 20 20 20 20 20  20 20 20 20 20 20 20 20  |0..             |
00002440  20 20 20 4d 4f 56 20 20  20 20 20 09 52 31 2c 52  |   MOV     .R1,R|
00002450  31 33 20 20 20 20 20 20  20 09 09 09 3b 50 75 74  |13       ...;Put|
00002460  20 62 75 66 66 65 72 20  69 6e 20 52 31 2e 2e 0a  | buffer in R1...|
00002470  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002480  4d 4f 56 20 20 20 20 20  09 52 32 2c 23 31 20 20  |MOV     .R2,#1  |
00002490  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000024a0  20 09 3b 50 75 74 20 62  75 66 66 20 73 69 7a 65  | .;Put buff size|
000024b0  20 69 6e 20 52 32 0a 20  20 20 20 20 20 20 20 20  | in R2.         |
000024c0  20 20 20 20 20 20 20 53  57 49 20 20 20 20 20 09  |       SWI     .|
000024d0  58 53 6f 63 6b 65 74 5f  57 72 69 74 65 20 20 20  |XSocket_Write   |
000024e0  20 20 20 20 20 20 20 20  09 3b 43 61 6c 6c 20 49  |        .;Call I|
000024f0  6e 74 65 72 6e 65 74 20  6d 6f 64 75 6c 65 2e 2e  |nternet module..|
00002500  0a 09 09 41 44 44 09 09  52 31 33 2c 52 31 33 2c  |...ADD..R13,R13,|
00002510  23 34 09 09 09 3b 52 65  6c 65 61 73 65 20 73 74  |#4...;Release st|
00002520  61 63 6b 20 77 73 2e 0a  20 20 20 20 20 20 20 20  |ack ws..        |
00002530  20 20 20 20 20 20 20 20  4c 44 4d 46 44 20 20 20  |        LDMFD   |
00002540  09 52 31 33 21 2c 7b 52  31 2d 52 32 2c 50 43 7d  |.R13!,{R1-R2,PC}|
00002550  0a 0a 0a 73 6f 63 6b 65  74 5f 63 6c 6f 73 65 20  |...socket_close |
00002560  20 20 20 53 54 4d 46 44  20 20 20 09 52 31 33 21  |   STMFD   .R13!|
00002570  2c 7b 52 31 34 7d 0a 09  09 44 42 46 09 09 22 46  |,{R14}...DBF.."F|
00002580  69 6c 65 20 63 6c 6f 73  65 20 65 6e 74 72 79 20  |ile close entry |
00002590  63 61 6c 6c 65 64 5c 6e  22 0a 20 20 20 20 20 20  |called\n".      |
000025a0  20 20 20 20 20 20 20 20  20 20 53 55 42 20 20 20  |          SUB   |
000025b0  20 20 09 52 30 2c 52 31  2c 23 31 20 20 20 20 20  |  .R0,R1,#1     |
000025c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 09 3b  |              .;|
000025d0  50 75 74 20 53 6f 63 6b  65 74 20 69 6e 20 52 30  |Put Socket in R0|
000025e0  0a 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |..              |
000025f0  20 20 3b 49 67 6e 6f 72  65 20 6f 74 68 65 72 20  |  ;Ignore other |
00002600  73 74 75 66 66 20 61 73  20 6d 65 61 6e 69 6e 67  |stuff as meaning|
00002610  6c 65 73 73 2e 0a 20 20  20 20 20 20 20 20 20 20  |less..          |
00002620  20 20 20 20 20 20 53 57  49 20 20 20 20 20 09 58  |      SWI     .X|
00002630  53 6f 63 6b 65 74 5f 43  6c 6f 73 65 20 20 20 20  |Socket_Close    |
00002640  20 20 20 20 20 20 20 09  3b 43 61 6c 6c 20 69 6e  |       .;Call in|
00002650  74 65 72 6e 65 74 20 6d  6f 64 75 6c 65 0a 20 20  |ternet module.  |
00002660  20 20 20 20 20 20 20 20  20 20 20 20 20 20 4c 44  |              LD|
00002670  4d 46 44 20 20 20 09 52  31 33 21 2c 7b 50 43 7d  |MFD   .R13!,{PC}|
00002680  0a 0a 73 6f 63 6b 65 74  5f 47 42 50 42 20 20 20  |..socket_GBPB   |
00002690  20 20 3b 4f 70 74 69 6d  69 7a 65 64 20 6d 75 6c  |  ;Optimized mul|
000026a0  74 69 62 79 74 65 20 67  65 74 20 61 6e 64 20 70  |tibyte get and p|
000026b0  75 74 20 72 6f 75 74 69  6e 65 73 2e 2e 2e 2e 2e  |ut routines.....|
000026c0  0a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
000026d0  20 3b 49 6e 20 66 61 63  74 20 69 6e 20 6f 75 72  | ;In fact in our|
000026e0  20 63 61 73 65 20 61 6c  6d 6f 73 74 20 73 69 6d  | case almost sim|
000026f0  70 6c 65 72 20 74 68 61  6e 20 74 68 65 20 73 69  |pler than the si|
00002700  6e 67 6c 65 20 62 79 74  65 0a 20 20 20 20 20 20  |ngle byte.      |
00002710  20 20 20 20 20 20 20 20  20 20 3b 6f 6e 65 73 0a  |          ;ones.|
00002720  0a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00002730  20 53 54 4d 46 44 20 20  20 09 52 31 33 21 2c 7b  | STMFD   .R13!,{|
00002740  52 30 2d 52 34 2c 52 31  34 7d 0a 09 09 44 42 46  |R0-R4,R14}...DBF|
00002750  09 09 22 46 69 6c 65 20  67 70 62 70 20 65 6e 74  |.."File gpbp ent|
00002760  72 79 20 63 61 6c 6c 65  64 20 6f 70 20 6e 6f 20  |ry called op no |
00002770  2d 20 25 30 77 5c 6e 22  0a 0a 20 20 20 20 20 20  |- %0w\n"..      |
00002780  20 20 20 20 20 20 20 20  20 20 43 4d 50 20 20 20  |          CMP   |
00002790  20 09 20 09 52 30 2c 23  33 20 20 20 20 20 20 20  | . .R0,#3       |
000027a0  20 20 20 20 20 20 20 20  20 20 20 20 09 3b 43 68  |            .;Ch|
000027b0  65 63 6b 20 72 65 61 73  6f 6e 20 63 6f 64 65 2e  |eck reason code.|
000027c0  2e 2e 0a 20 20 20 20 20  20 20 20 20 20 20 20 20  |...             |
000027d0  20 20 20 42 47 45 20 20  20 20 20 09 73 6f 63 6b  |   BGE     .sock|
000027e0  65 74 5f 6d 75 6c 74 69  67 65 74 20 20 20 20 20  |et_multiget     |
000027f0  20 20 20 20 09 3b 44 6f  20 67 65 74 20 6d 75 74  |    .;Do get mut|
00002800  6c 69 70 6c 65 2e 2e 0a  0a 20 20 20 20 20 20 20  |liple....       |
00002810  20 20 20 20 20 20 20 20  20 20 20 3b 70 75 74 20  |           ;put |
00002820  6d 75 6c 74 69 70 6c 65  20 2e 20 6d 6f 76 65 20  |multiple . move |
00002830  72 65 67 73 20 74 6f 20  70 6c 61 63 65 20 66 6f  |regs to place fo|
00002840  72 20 73 6f 63 6b 65 74  20 63 61 6c 6c 0a 20 20  |r socket call.  |
00002850  20 20 20 20 20 20 20 20  20 20 20 20 20 20 53 55  |              SU|
00002860  42 20 20 20 20 20 09 52  30 2c 52 31 2c 23 31 0a  |B     .R0,R1,#1.|
00002870  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002880  4d 4f 56 20 20 20 20 20  09 52 31 2c 52 32 0a 20  |MOV     .R1,R2. |
00002890  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 4d  |               M|
000028a0  4f 56 20 20 20 20 20 09  52 32 2c 52 33 0a 20 20  |OV     .R2,R3.  |
000028b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 53 57  |              SW|
000028c0  49 20 20 20 20 20 09 58  53 6f 63 6b 65 74 5f 57  |I     .XSocket_W|
000028d0  72 69 74 65 0a 09 09 42  56 53 09 09 73 6f 63 6b  |rite...BVS..sock|
000028e0  65 74 5f 67 62 70 62 5f  68 61 6e 64 45 72 72 6f  |et_gbpb_handErro|
000028f0  72 0a 09 09 4d 4f 56 09  09 52 35 2c 52 30 0a 09  |r...MOV..R5,R0..|
00002900  09 4c 44 4d 46 44 09 09  52 31 33 21 2c 7b 52 30  |.LDMFD..R13!,{R0|
00002910  2d 52 34 2c 52 31 34 7d  0a 09 09 41 44 44 09 09  |-R4,R14}...ADD..|
00002920  52 32 2c 52 32 2c 52 35  09 09 09 3b 43 6f 6d 70  |R2,R2,R5...;Comp|
00002930  75 74 65 20 6e 65 77 20  62 75 66 66 20 70 74 72  |ute new buff ptr|
00002940  0a 09 09 53 55 42 09 09  52 33 2c 52 33 2c 52 35  |...SUB..R3,R3,R5|
00002950  09 09 09 3b 43 6f 6d 70  75 74 65 20 6e 65 77 20  |...;Compute new |
00002960  62 75 66 66 20 66 72 65  65 20 73 69 7a 65 0a 09  |buff free size..|
00002970  09 41 44 44 09 09 52 34  2c 52 34 2c 52 35 09 09  |.ADD..R4,R4,R5..|
00002980  09 3b 43 6f 6d 70 75 74  65 20 6e 65 77 20 66 69  |.;Compute new fi|
00002990  6c 65 20 70 6f 69 6e 74  65 72 21 0a 09 09 4d 4f  |le pointer!...MO|
000029a0  56 53 09 09 50 43 2c 52  31 34 09 09 09 09 3b 52  |VS..PC,R14....;R|
000029b0  65 74 75 72 6e 20 74 6f  20 63 61 6c 6c 65 72 0a  |eturn to caller.|
000029c0  0a 73 6f 63 6b 65 74 5f  6d 75 6c 74 69 67 65 74  |.socket_multiget|
000029d0  0a 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |..              |
000029e0  20 20 20 20 3b 67 65 74  20 6d 75 6c 74 69 70 6c  |    ;get multipl|
000029f0  65 20 2e 20 6d 6f 76 65  20 72 65 67 73 20 74 6f  |e . move regs to|
00002a00  20 70 6c 61 63 65 20 66  6f 72 20 73 6f 63 6b 65  | place for socke|
00002a10  74 20 63 61 6c 6c 0a 20  20 20 20 20 20 20 20 20  |t call.         |
00002a20  20 20 20 20 20 20 20 53  55 42 20 20 20 20 20 09  |       SUB     .|
00002a30  52 30 2c 52 31 2c 23 31  0a 20 20 20 20 20 20 20  |R0,R1,#1.       |
00002a40  20 20 20 20 20 20 20 20  20 4d 4f 56 20 20 20 20  |         MOV    |
00002a50  20 09 52 31 2c 52 32 0a  20 20 20 20 20 20 20 20  | .R1,R2.        |
00002a60  20 20 20 20 20 20 20 20  4d 4f 56 20 20 20 20 20  |        MOV     |
00002a70  09 52 32 2c 52 33 0a 20  20 20 20 20 20 20 20 20  |.R2,R3.         |
00002a80  20 20 20 20 20 20 20 53  57 49 20 20 20 20 20 09  |       SWI     .|
00002a90  58 53 6f 63 6b 65 74 5f  52 65 61 64 0a 09 09 42  |XSocket_Read...B|
00002aa0  56 53 09 09 73 6f 63 6b  65 74 5f 67 62 70 62 5f  |VS..socket_gbpb_|
00002ab0  68 61 6e 64 45 72 72 6f  72 0a 09 09 4d 4f 56 09  |handError...MOV.|
00002ac0  09 52 35 2c 52 30 0a 09  09 4c 44 4d 46 44 09 09  |.R5,R0...LDMFD..|
00002ad0  52 31 33 21 2c 7b 52 30  2d 52 34 2c 52 31 34 7d  |R13!,{R0-R4,R14}|
00002ae0  0a 09 09 41 44 44 09 09  52 32 2c 52 32 2c 52 35  |...ADD..R2,R2,R5|
00002af0  09 09 09 3b 43 6f 6d 70  75 74 65 20 6e 65 77 20  |...;Compute new |
00002b00  62 75 66 66 20 70 74 72  0a 09 09 53 55 42 09 09  |buff ptr...SUB..|
00002b10  52 33 2c 52 33 2c 52 35  09 09 09 3b 43 6f 6d 70  |R3,R3,R5...;Comp|
00002b20  75 74 65 20 6e 65 77 20  62 75 66 66 20 66 72 65  |ute new buff fre|
00002b30  65 20 73 69 7a 65 0a 09  09 41 44 44 09 09 52 34  |e size...ADD..R4|
00002b40  2c 52 34 2c 52 35 09 09  09 3b 43 6f 6d 70 75 74  |,R4,R5...;Comput|
00002b50  65 20 6e 65 77 20 66 69  6c 65 20 70 6f 69 6e 74  |e new file point|
00002b60  65 72 21 0a 09 09 4d 4f  56 53 09 09 50 43 2c 52  |er!...MOVS..PC,R|
00002b70  31 34 09 09 09 09 3b 52  65 74 75 72 6e 20 74 6f  |14....;Return to|
00002b80  20 63 61 6c 6c 65 72 0a  0a 73 6f 63 6b 65 74 5f  | caller..socket_|
00002b90  67 62 70 62 5f 68 61 6e  64 45 72 72 6f 72 0a 09  |gbpb_handError..|
00002ba0  09 4c 44 52 09 09 52 31  2c 5b 52 30 5d 09 09 09  |.LDR..R1,[R0]...|
00002bb0  09 3b 47 65 74 20 45 72  72 6e 6f 0a 09 09 43 4d  |.;Get Errno...CM|
00002bc0  50 09 09 52 31 2c 23 45  57 4f 55 4c 44 42 4c 4f  |P..R1,#EWOULDBLO|
00002bd0  43 4b 09 09 09 3b 49 73  20 52 78 2f 54 78 20 6c  |CK...;Is Rx/Tx l|
00002be0  69 6d 69 74 73 2e 0a 09  09 4c 44 4d 45 51 46 44  |imits....LDMEQFD|
00002bf0  09 09 52 31 33 21 2c 7b  52 30 2d 52 34 2c 50 43  |..R13!,{R0-R4,PC|
00002c00  7d 5e 09 09 3b 52 65 74  75 72 6e 20 64 6f 69 6e  |}^..;Return doin|
00002c10  67 20 6e 6f 74 68 69 6e  67 0a 09 09 3b 46 69 6c  |g nothing...;Fil|
00002c20  65 73 77 69 74 63 68 20  77 69 6c 6c 20 77 6f 72  |eswitch will wor|
00002c30  6b 20 6f 75 74 20 77 68  61 74 20 74 6f 20 74 65  |k out what to te|
00002c40  6c 6c 20 63 6c 69 65 6e  74 21 0a 0a 09 09 3b 4e  |ll client!....;N|
00002c50  6f 77 20 77 65 20 68 61  76 65 20 74 6f 20 77 6f  |ow we have to wo|
00002c60  72 6b 20 6f 75 74 20 77  68 61 74 20 74 6f 20 64  |rk out what to d|
00002c70  6f 20 69 6e 20 74 68 65  20 63 61 73 65 20 6f 66  |o in the case of|
00002c80  20 6f 74 68 65 72 20 65  72 72 73 21 2e 0a 09 09  | other errs!....|
00002c90  4d 4f 56 09 09 52 35 2c  52 30 09 09 09 09 3b 53  |MOV..R5,R0....;S|
00002ca0  61 76 65 20 65 72 72 72  62 6c 6b 20 70 74 72 2e  |ave errrblk ptr.|
00002cb0  2e 0a 09 09 4c 44 4d 46  44 09 09 52 31 33 21 2c  |....LDMFD..R13!,|
00002cc0  7b 52 30 2d 52 34 2c 52  31 34 7d 09 09 3b 67 65  |{R0-R4,R14}..;ge|
00002cd0  74 20 6f 72 69 67 6e 61  6c 20 72 65 67 73 2e 2e  |t orignal regs..|
00002ce0  0a 09 09 4d 4f 56 09 09  52 30 2c 52 35 09 09 09  |...MOV..R0,R5...|
00002cf0  09 3b 72 65 73 74 6f 72  65 20 65 72 72 62 6c 6b  |.;restore errblk|
00002d00  20 70 74 72 0a 09 09 4f  52 52 53 09 09 50 43 2c  | ptr...ORRS..PC,|
00002d10  52 31 34 2c 23 56 5f 42  69 74 09 09 09 3b 72 65  |R14,#V_Bit...;re|
00002d20  74 75 72 6e 20 77 69 74  68 20 56 20 73 65 74 2e  |turn with V set.|
00002d30  0a 0a 0a 73 6f 63 6b 65  74 5f 61 72 67 73 09 3b  |...socket_args.;|
00002d40  48 61 6e 64 6c 65 20 77  6f 64 67 65 73 20 6f 66  |Handle wodges of|
00002d50  20 4f 53 5f 41 72 67 73  20 63 6f 64 65 73 20 68  | OS_Args codes h|
00002d60  65 72 65 21 0a 09 09 53  54 4d 46 44 09 20 20 20  |ere!...STMFD.   |
00002d70  20 20 20 20 20 52 31 33  21 2c 7b 52 30 2d 52 34  |     R13!,{R0-R4|
00002d80  2c 52 31 34 7d 09 09 3b  53 74 6f 72 65 20 52 65  |,R14}..;Store Re|
00002d90  67 69 73 74 65 72 73 21  0a 09 09 44 42 46 20 09  |gisters!...DBF .|
00002da0  09 22 46 53 5f 45 6e 74  72 79 20 41 72 67 73 20  |."FS_Entry Args |
00002db0  25 30 77 20 63 61 6c 6c  65 64 5c 6e 22 0a 09 09  |%0w called\n"...|
00002dc0  43 4d 50 09 09 52 30 2c  23 31 30 0a 09 09 41 44  |CMP..R0,#10...AD|
00002dd0  44 4c 45 09 09 50 43 2c  50 43 2c 52 30 2c 4c 53  |DLE..PC,PC,R0,LS|
00002de0  4c 20 23 32 09 09 09 3b  55 73 65 20 6f 6c 64 20  |L #2...;Use old |
00002df0  66 61 73 68 69 6f 6e 6e  65 64 0a 09 09 09 09 09  |fashionned......|
00002e00  09 09 09 3b 53 77 69 20  64 69 73 70 61 74 63 68  |...;Swi dispatch|
00002e10  20 74 72 69 63 6b 0a 09  09 42 20 09 09 73 6f 63  | trick...B ..soc|
00002e20  6b 65 74 5f 75 6e 6b 6e  6f 77 6e 43 61 6c 6c 0a  |ket_unknownCall.|
00002e30  0a 09 09 42 09 09 73 6f  63 6b 65 74 5f 72 65 74  |...B..socket_ret|
00002e40  75 72 6e 5a 65 72 6f 0a  09 09 4c 44 4d 46 44 09  |urnZero...LDMFD.|
00002e50  09 52 31 33 21 2c 7b 72  30 2d 52 34 2c 50 43 7d  |.R13!,{r0-R4,PC}|
00002e60  09 09 09 3b 49 67 6e 6f  72 65 20 41 52 67 73 20  |...;Ignore ARgs |
00002e70  31 0a 09 09 42 09 09 73  6f 63 6b 65 74 5f 72 65  |1...B..socket_re|
00002e80  74 75 72 6e 5a 65 72 6f  0a 09 09 4c 44 4d 46 44  |turnZero...LDMFD|
00002e90  09 09 52 31 33 21 2c 7b  52 30 2d 52 34 2c 50 43  |..R13!,{R0-R4,PC|
00002ea0  7d 09 09 09 3b 49 67 6e  6f 72 65 20 41 72 67 73  |}...;Ignore Args|
00002eb0  20 33 0a 09 09 42 09 09  73 6f 63 6b 65 74 5f 61  | 3...B..socket_a|
00002ec0  6c 6c 6f 63 65 64 73 69  7a 65 0a 09 09 42 09 09  |llocedsize...B..|
00002ed0  73 6f 63 6b 65 74 5f 45  4f 46 63 68 65 63 6b 09  |socket_EOFcheck.|
00002ee0  09 09 3b 49 73 20 54 43  50 20 63 6f 6e 6e 65 63  |..;Is TCP connec|
00002ef0  74 69 6f 6e 20 6f 70 65  6e 3f 0a 09 09 42 09 09  |tion open?...B..|
00002f00  73 6f 63 6b 65 74 5f 46  6c 75 73 68 09 09 09 3b  |socket_Flush...;|
00002f10  4e 6f 74 20 63 61 6c 6c  65 64 20 62 75 74 20 74  |Not called but t|
00002f20  72 69 76 20 74 6f 20 63  6f 64 65 21 0a 09 09 42  |riv to code!...B|
00002f30  20 20 09 09 73 6f 63 6b  65 74 5f 45 78 74 65 6e  |  ..socket_Exten|
00002f40  74 0a 09 09 4c 44 4d 46  44 09 09 52 31 33 21 2c  |t...LDMFD..R13!,|
00002f50  7b 52 30 2d 52 34 2c 50  43 7d 09 09 09 3b 4e 6f  |{R0-R4,PC}...;No|
00002f60  74 20 73 75 70 6f 72 74  65 64 20 2e 2e 20 75 6e  |t suported .. un|
00002f70  62 75 66 66 65 72 65 64  0a 09 09 42 09 09 73 6f  |buffered...B..so|
00002f80  63 6b 65 74 5f 72 65 74  75 72 6e 5a 65 72 6f 73  |cket_returnZeros|
00002f90  0a 09 09 4c 44 4d 46 44  09 09 52 31 33 21 2c 7b  |...LDMFD..R13!,{|
00002fa0  52 30 2d 52 34 2c 50 43  7d 09 09 09 3b 49 66 20  |R0-R4,PC}...;If |
00002fb0  79 6f 75 27 76 65 20 69  6d 70 6c 65 6d 65 6e 74  |you've implement|
00002fc0  65 64 20 61 6e 20 69 6d  61 67 65 66 73 20 6f 76  |ed an imagefs ov|
00002fd0  65 72 20 73 6f 63 6b 65  74 66 73 20 49 27 64 20  |er socketfs I'd |
00002fe0  62 65 20 73 68 6f 63 6b  65 64 21 0a 0a 73 6f 63  |be shocked!..soc|
00002ff0  6b 65 74 5f 61 6c 6c 6f  63 65 64 73 69 7a 65 0a  |ket_allocedsize.|
00003000  09 09 4c 44 4d 46 44 09  09 52 31 33 21 2c 7b 52  |..LDMFD..R13!,{R|
00003010  30 2d 52 34 2c 52 31 34  7d 0a 09 09 4d 4f 56 09  |0-R4,R14}...MOV.|
00003020  09 52 32 2c 23 31 0a 09  09 4d 4f 56 09 09 50 43  |.R2,#1...MOV..PC|
00003030  2c 52 31 34 0a 0a 73 6f  63 6b 65 74 5f 45 78 74  |,R14..socket_Ext|
00003040  65 6e 74 0a 09 09 4c 44  4d 46 44 09 09 52 31 33  |ent...LDMFD..R13|
00003050  21 2c 7b 52 30 2d 52 34  2c 52 31 34 7d 0a 09 09  |!,{R0-R4,R14}...|
00003060  3b 57 68 61 74 20 64 6f  20 77 65 20 6e 65 65 64  |;What do we need|
00003070  20 74 6f 20 74 65 6c 6c  20 46 69 6c 65 73 77 69  | to tell Fileswi|
00003080  74 63 68 0a 09 09 4d 4f  56 20 20 20 09 20 20 20  |tch...MOV   .   |
00003090  20 09 52 32 2c 23 31 0a  09 09 4d 4f 56 09 09 50  | .R2,#1...MOV..P|
000030a0  43 2c 52 31 34 0a 0a 73  6f 63 6b 65 74 5f 72 65  |C,R14..socket_re|
000030b0  74 75 72 6e 5a 65 72 6f  0a 09 09 4c 44 4d 46 44  |turnZero...LDMFD|
000030c0  09 09 52 31 33 21 2c 7b  52 30 2d 52 34 2c 52 31  |..R13!,{R0-R4,R1|
000030d0  34 7d 0a 09 09 4d 4f 56  09 09 52 32 2c 23 30 09  |4}...MOV..R2,#0.|
000030e0  09 09 09 3b 52 65 74 75  72 6e 20 52 32 3d 30 0a  |...;Return R2=0.|
000030f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003100  4d 4f 56 20 09 09 50 63  2c 52 31 34 0a 0a 73 6f  |MOV ..Pc,R14..so|
00003110  63 6b 65 74 5f 72 65 74  75 72 6e 5a 65 72 6f 73  |cket_returnZeros|
00003120  0a 09 09 4c 44 4d 46 44  09 09 52 31 33 21 2c 7b  |...LDMFD..R13!,{|
00003130  52 30 2d 52 34 2c 52 31  34 7d 0a 09 09 4d 4f 56  |R0-R4,R14}...MOV|
00003140  09 09 52 32 2c 23 30 09  09 09 09 3b 52 65 74 75  |..R2,#0....;Retu|
00003150  72 6e 20 52 32 2d 52 33  3d 30 2e 0a 09 09 4d 4f  |rn R2-R3=0....MO|
00003160  56 09 09 52 33 2c 52 32  0a 20 20 20 20 20 20 20  |V..R3,R2.       |
00003170  20 20 20 20 20 20 20 20  20 4d 4f 56 20 09 09 50  |         MOV ..P|
00003180  63 2c 52 31 34 0a 0a 73  6f 63 6b 65 74 5f 46 6c  |c,R14..socket_Fl|
00003190  75 73 68 0a 20 20 20 20  09 09 4c 44 4d 46 44 09  |ush.    ..LDMFD.|
000031a0  09 52 31 33 21 2c 7b 52  30 2d 52 34 2c 52 31 34  |.R13!,{R0-R4,R14|
000031b0  7d 0a 09 09 53 54 4d 46  44 09 09 52 31 33 21 2c  |}...STMFD..R13!,|
000031c0  7b 52 31 2d 52 34 2c 52  31 34 7d 0a 20 09 09 53  |{R1-R4,R14}. ..S|
000031d0  55 42 09 09 52 30 2c 52  31 2c 23 31 09 09 09 3b  |UB..R0,R1,#1...;|
000031e0  47 65 74 20 46 69 6c 65  20 68 61 6e 64 6c 65 0a  |Get File handle.|
000031f0  09 09 41 44 44 09 09 52  31 2c 52 31 32 2c 23 74  |..ADD..R1,R12,#t|
00003200  65 6d 70 62 79 74 65 0a  09 09 4d 4f 56 09 09 52  |empbyte...MOV..R|
00003210  32 2c 23 30 09 09 09 09  3b 53 65 6e 64 20 30 20  |2,#0....;Send 0 |
00003220  6f 63 74 65 74 73 0a 09  09 53 57 49 09 09 58 53  |octets...SWI..XS|
00003230  6f 63 6b 65 74 5f 53 65  6e 64 0a 09 09 4c 44 4d  |ocket_Send...LDM|
00003240  46 44 09 09 52 31 33 21  2c 7b 52 31 2d 52 34 2c  |FD..R13!,{R1-R4,|
00003250  50 43 7d 0a 0a 73 6f 63  6b 65 74 5f 45 4f 46 63  |PC}..socket_EOFc|
00003260  68 65 63 6b 0a 20 20 20  20 09 09 4c 44 4d 46 44  |heck.    ..LDMFD|
00003270  09 09 52 31 33 21 2c 7b  52 30 2d 52 34 2c 52 31  |..R13!,{R0-R4,R1|
00003280  34 7d 0a 09 09 53 54 4d  46 44 09 09 52 31 33 21  |4}...STMFD..R13!|
00003290  2c 7b 52 31 34 7d 0a 20  20 20 20 20 20 20 20 20  |,{R14}.         |
000032a0  20 20 20 20 20 20 09 53  55 42 09 09 52 30 2c 52  |      .SUB..R0,R|
000032b0  31 2c 23 31 09 09 09 3b  47 65 74 20 73 6f 63 6b  |1,#1...;Get sock|
000032c0  65 74 20 68 61 6e 64 6c  65 0a 20 20 20 20 20 20  |et handle.      |
000032d0  20 20 20 20 20 20 20 20  20 20 41 44 44 09 09 52  |          ADD..R|
000032e0  31 2c 52 31 32 2c 23 74  65 6d 70 62 79 74 65 0a  |1,R12,#tempbyte.|
000032f0  09 09 4d 4f 56 09 09 52  32 2c 23 31 09 09 09 09  |..MOV..R2,#1....|
00003300  3b 47 65 74 20 61 20 62  79 74 65 0a 09 09 4d 4f  |;Get a byte...MO|
00003310  56 09 09 52 33 2c 23 28  4d 53 47 5f 50 45 45 4b  |V..R3,#(MSG_PEEK|
00003320  20 2b 20 4d 53 47 5f 44  4f 4e 54 57 41 49 54 29  | + MSG_DONTWAIT)|
00003330  09 3b 62 75 74 20 64 6f  6e 27 74 20 72 65 6d 6f  |.;but don't remo|
00003340  76 65 20 69 74 20 66 72  6f 6d 20 74 68 65 20 71  |ve it from the q|
00003350  75 65 75 65 0a 20 20 20  20 20 20 20 20 20 20 20  |ueue.           |
00003360  20 20 20 20 20 53 57 49  09 09 58 53 6f 63 6b 65  |     SWI..XSocke|
00003370  74 5f 52 65 63 76 0a 20  20 20 20 20 20 20 20 20  |t_Recv.         |
00003380  20 20 20 20 20 20 20 4c  44 52 56 53 09 09 52 31  |       LDRVS..R1|
00003390  2c 5b 52 30 5d 09 09 09  09 3b 49 66 20 65 72 72  |,[R0]....;If err|
000033a0  20 67 65 74 20 45 72 72  4e 6f 0a 09 09 4d 4f 56  | get ErrNo...MOV|
000033b0  53 09 09 52 30 2c 52 30  09 09 09 09 3b 49 46 20  |S..R0,R0....;IF |
000033c0  72 65 61 64 28 29 3d 3d  30 0a 09 09 43 4d 50 4e  |read()==0...CMPN|
000033d0  45 09 09 52 31 2c 23 45  43 4f 4e 4e 52 45 53 45  |E..R1,#ECONNRESE|
000033e0  54 09 09 09 3b 20 20 7c  7c 20 3d 3d 45 43 4f 4e  |T...;  || ==ECON|
000033f0  4e 52 45 53 45 54 0a 09  09 4d 4f 56 09 09 52 32  |NRESET...MOV..R2|
00003400  2c 23 30 09 09 09 09 3b  20 74 68 65 6e 20 52 32  |,#0....; then R2|
00003410  3d 30 0a 09 09 53 55 42  45 51 09 09 52 32 2c 52  |=0...SUBEQ..R2,R|
00003420  32 2c 23 31 09 09 09 3b  20 65 6c 73 65 20 52 32  |2,#1...; else R2|
00003430  3d 2d 31 0a 09 09 4c 44  4d 46 44 09 09 52 31 33  |=-1...LDMFD..R13|
00003440  21 2c 7b 50 43 7d 5e 09  09 09 3b 72 65 74 75 72  |!,{PC}^...;retur|
00003450  6e 21 0a 0a 73 6f 63 6b  65 74 5f 75 6e 6b 6e 6f  |n!..socket_unkno|
00003460  77 6e 43 61 6c 6c 0a 09  09 41 44 52 09 09 52 30  |wnCall...ADR..R0|
00003470  2c 73 6f 63 6b 65 74 5f  75 6e 6b 6e 6f 77 6e 43  |,socket_unknownC|
00003480  61 6c 6c 4d 73 67 0a 09  09 4f 52 52 53 09 09 50  |allMsg...ORRS..P|
00003490  43 2c 50 43 2c 23 56 5f  42 69 74 0a 09 09 4c 44  |C,PC,#V_Bit...LD|
000034a0  4d 46 44 09 09 52 31 33  2c 7b 52 30 2d 52 34 2c  |MFD..R13,{R0-R4,|
000034b0  50 43 7d 0a 0a 73 6f 63  6b 65 74 5f 75 6e 6b 6e  |PC}..socket_unkn|
000034c0  6f 77 6e 43 61 6c 6c 4d  73 67 0a 09 09 44 43 44  |ownCallMsg...DCD|
000034d0  09 09 26 30 30 30 31 46  46 45 45 0a 09 09 44 43  |..&0001FFEE...DC|
000034e0  42 09 09 22 53 6f 63 6b  65 74 66 73 20 64 6f 65  |B.."Socketfs doe|
000034f0  73 6e 27 74 20 73 75 70  70 6f 72 74 20 74 68 69  |sn't support thi|
00003500  73 20 63 61 6c 6c 22 2c  31 33 0a 09 09 41 4c 49  |s call",13...ALI|
00003510  47 4e 0a 0a 73 6f 63 6b  65 74 5f 46 75 6e 63 0a  |GN..socket_Func.|
00003520  09 09 53 54 4d 46 44 09  20 20 20 20 20 20 20 20  |..STMFD.        |
00003530  52 31 33 21 2c 7b 52 30  2d 52 34 2c 52 31 34 7d  |R13!,{R0-R4,R14}|
00003540  09 09 3b 53 74 6f 72 65  20 52 65 67 69 73 74 65  |..;Store Registe|
00003550  72 73 21 0a 09 09 44 42  46 09 09 22 46 53 5f 45  |rs!...DBF.."FS_E|
00003560  6e 74 72 79 20 46 75 6e  63 20 25 30 77 20 63 61  |ntry Func %0w ca|
00003570  6c 6c 65 64 5c 6e 22 0a  09 09 43 4d 50 09 09 52  |lled\n"...CMP..R|
00003580  30 2c 23 33 34 0a 09 09  41 44 44 4c 45 09 09 50  |0,#34...ADDLE..P|
00003590  43 2c 50 43 2c 52 30 2c  4c 53 4c 20 23 32 09 09  |C,PC,R0,LSL #2..|
000035a0  09 3b 55 73 65 20 6f 6c  64 20 66 61 73 68 69 6f  |.;Use old fashio|
000035b0  6e 6e 65 64 0a 09 09 09  09 09 09 09 09 3b 53 77  |nned.........;Sw|
000035c0  69 20 64 69 73 70 61 74  63 68 20 74 72 69 63 6b  |i dispatch trick|
000035d0  0a 09 09 42 20 09 09 73  6f 63 6b 65 74 5f 75 6e  |...B ..socket_un|
000035e0  6b 6e 6f 77 6e 43 61 6c  6c 0a 0a 09 09 42 09 09  |knownCall....B..|
000035f0  73 6f 63 6b 65 74 5f 44  6f 4e 6f 74 68 69 6e 67  |socket_DoNothing|
00003600  09 09 3b 46 73 45 6e 74  72 79 5f 46 75 6e 63 20  |..;FsEntry_Func |
00003610  30 0a 09 09 42 09 09 73  6f 63 6b 65 74 5f 44 6f  |0...B..socket_Do|
00003620  4e 6f 74 68 69 6e 67 09  09 3b 46 73 45 6e 74 72  |Nothing..;FsEntr|
00003630  79 5f 46 75 6e 63 20 31  0a 09 09 42 09 09 73 6f  |y_Func 1...B..so|
00003640  63 6b 65 74 5f 44 6f 4e  6f 74 68 69 6e 67 09 09  |cket_DoNothing..|
00003650  3b 46 73 45 6e 74 72 79  5f 46 75 6e 63 20 32 0a  |;FsEntry_Func 2.|
00003660  09 09 42 09 09 73 6f 63  6b 65 74 5f 44 6f 4e 6f  |..B..socket_DoNo|
00003670  74 68 69 6e 67 09 09 3b  46 73 45 6e 74 72 79 5f  |thing..;FsEntry_|
00003680  46 75 6e 63 20 33 0a 09  09 42 09 09 73 6f 63 6b  |Func 3...B..sock|
00003690  65 74 5f 44 6f 4e 6f 74  68 69 6e 67 09 09 3b 46  |et_DoNothing..;F|
000036a0  73 45 6e 74 72 79 5f 46  75 6e 63 20 34 0a 09 09  |sEntry_Func 4...|
000036b0  42 09 09 73 6f 63 6b 65  74 5f 44 6f 4e 6f 74 68  |B..socket_DoNoth|
000036c0  69 6e 67 09 09 3b 46 73  45 6e 74 72 79 5f 46 75  |ing..;FsEntry_Fu|
000036d0  6e 63 20 35 0a 09 09 42  09 09 73 6f 63 6b 65 74  |nc 5...B..socket|
000036e0  5f 44 6f 4e 6f 74 68 69  6e 67 09 09 3b 46 73 45  |_DoNothing..;FsE|
000036f0  6e 74 72 79 5f 46 75 6e  63 20 36 0a 09 09 42 09  |ntry_Func 6...B.|
00003700  09 73 6f 63 6b 65 74 5f  44 6f 4e 6f 74 68 69 6e  |.socket_DoNothin|
00003710  67 09 09 3b 46 73 45 6e  74 72 79 5f 46 75 6e 63  |g..;FsEntry_Func|
00003720  20 37 0a 09 09 42 09 09  73 6f 63 6b 65 74 5f 72  | 7...B..socket_r|
00003730  65 6e 61 6d 65 09 09 09  3b 46 73 45 6e 74 72 79  |ename...;FsEntry|
00003740  5f 46 75 6e 63 20 38 0a  09 09 42 09 09 73 6f 63  |_Func 8...B..soc|
00003750  6b 65 74 5f 44 6f 4e 6f  74 68 69 6e 67 09 09 3b  |ket_DoNothing..;|
00003760  46 73 45 6e 74 72 79 5f  46 75 6e 63 20 39 0a 09  |FsEntry_Func 9..|
00003770  09 42 09 09 73 6f 63 6b  65 74 5f 44 6f 4e 6f 74  |.B..socket_DoNot|
00003780  68 69 6e 67 09 09 3b 46  73 45 6e 74 72 79 5f 46  |hing..;FsEntry_F|
00003790  75 6e 63 20 31 30 0a 09  09 42 09 09 73 6f 63 6b  |unc 10...B..sock|
000037a0  65 74 5f 72 65 61 64 42  6f 6f 74 09 09 09 3b 46  |et_readBoot...;F|
000037b0  73 45 6e 74 72 79 5f 46  75 6e 63 20 31 31 0a 09  |sEntry_Func 11..|
000037c0  09 42 09 09 73 6f 63 6b  65 74 5f 72 65 61 64 44  |.B..socket_readD|
000037d0  69 72 4e 61 6d 65 09 09  3b 46 73 45 6e 74 72 79  |irName..;FsEntry|
000037e0  5f 46 75 6e 63 20 31 32  0a 09 09 42 09 09 73 6f  |_Func 12...B..so|
000037f0  63 6b 65 74 5f 72 65 61  64 44 69 72 4e 61 6d 65  |cket_readDirName|
00003800  09 09 3b 46 73 45 6e 74  72 79 5f 46 75 6e 63 20  |..;FsEntry_Func |
00003810  31 33 0a 09 09 42 09 09  73 6f 63 6b 65 74 5f 72  |13...B..socket_r|
00003820  65 61 64 44 69 72 09 09  09 3b 46 73 45 6e 74 72  |eadDir...;FsEntr|
00003830  79 5f 46 75 6e 63 20 31  34 0a 09 09 42 09 09 73  |y_Func 14...B..s|
00003840  6f 63 6b 65 74 5f 72 65  61 64 44 69 72 09 09 09  |ocket_readDir...|
00003850  3b 46 73 45 6e 74 72 79  5f 46 75 6e 63 20 31 35  |;FsEntry_Func 15|
00003860  0a 09 09 42 09 09 73 6f  63 6b 65 74 5f 44 6f 4e  |...B..socket_DoN|
00003870  6f 74 68 69 6e 67 09 09  3b 46 73 45 6e 74 72 79  |othing..;FsEntry|
00003880  5f 46 75 6e 63 20 31 36  0a 09 09 42 09 09 73 6f  |_Func 16...B..so|
00003890  63 6b 65 74 5f 61 6e 6e  6f 75 63 65 09 09 09 3b  |cket_annouce...;|
000038a0  46 73 45 6e 74 72 79 5f  46 75 6e 63 20 31 37 0a  |FsEntry_Func 17.|
000038b0  09 09 42 09 09 73 6f 63  6b 65 74 5f 44 6f 4e 6f  |..B..socket_DoNo|
000038c0  74 68 69 6e 67 09 09 3b  46 73 45 6e 74 72 79 5f  |thing..;FsEntry_|
000038d0  46 75 6e 63 20 31 38 0a  09 09 42 09 09 73 6f 63  |Func 18...B..soc|
000038e0  6b 65 74 5f 72 65 61 64  44 69 72 09 09 09 3b 46  |ket_readDir...;F|
000038f0  73 45 6e 74 72 79 5f 46  75 6e 63 20 31 39 0a 09  |sEntry_Func 19..|
00003900  09 42 09 09 73 6f 63 6b  65 74 5f 44 6f 4e 6f 74  |.B..socket_DoNot|
00003910  68 69 6e 67 09 09 3b 46  73 45 6e 74 72 79 5f 46  |hing..;FsEntry_F|
00003920  75 6e 63 20 32 30 0a 09  09 42 09 09 73 6f 63 6b  |unc 20...B..sock|
00003930  65 74 5f 44 6f 4e 6f 74  68 69 6e 67 09 09 3b 46  |et_DoNothing..;F|
00003940  73 45 6e 74 72 79 5f 46  75 6e 63 20 32 31 0a 09  |sEntry_Func 21..|
00003950  09 42 09 09 73 6f 63 6b  65 74 5f 44 6f 4e 6f 74  |.B..socket_DoNot|
00003960  68 69 6e 67 09 09 3b 46  73 45 6e 74 72 79 5f 46  |hing..;FsEntry_F|
00003970  75 6e 63 20 32 32 0a 09  09 42 09 09 73 6f 63 6b  |unc 22...B..sock|
00003980  65 74 5f 44 6f 4e 6f 74  68 69 6e 67 09 09 3b 46  |et_DoNothing..;F|
00003990  73 45 6e 74 72 79 5f 46  75 6e 63 20 32 33 0a 09  |sEntry_Func 23..|
000039a0  09 42 09 09 73 6f 63 6b  65 74 5f 44 6f 4e 6f 74  |.B..socket_DoNot|
000039b0  68 69 6e 67 09 09 3b 46  73 45 6e 74 72 79 5f 46  |hing..;FsEntry_F|
000039c0  75 6e 63 20 32 34 0a 09  09 42 09 09 73 6f 63 6b  |unc 24...B..sock|
000039d0  65 74 5f 72 65 61 64 44  65 66 65 63 74 73 09 09  |et_readDefects..|
000039e0  3b 46 73 45 6e 74 72 79  5f 46 75 6e 63 20 32 35  |;FsEntry_Func 25|
000039f0  0a 09 09 42 09 09 73 6f  63 6b 65 74 5f 44 6f 4e  |...B..socket_DoN|
00003a00  6f 74 68 69 6e 67 09 09  3b 46 73 45 6e 74 72 79  |othing..;FsEntry|
00003a10  5f 46 75 6e 63 20 32 36  0a 09 09 42 09 09 73 6f  |_Func 26...B..so|
00003a20  63 6b 65 74 5f 72 65 61  64 42 6f 6f 74 09 09 09  |cket_readBoot...|
00003a30  3b 46 73 45 6e 74 72 79  5f 46 75 6e 63 20 32 37  |;FsEntry_Func 27|
00003a40  0a 09 09 42 09 09 73 6f  63 6b 65 74 5f 44 6f 4e  |...B..socket_DoN|
00003a50  6f 74 68 69 6e 67 09 09  3b 46 73 45 6e 74 72 79  |othing..;FsEntry|
00003a60  5f 46 75 6e 63 20 32 38  0a 09 09 42 09 09 73 6f  |_Func 28...B..so|
00003a70  63 6b 65 74 5f 44 6f 4e  6f 74 68 69 6e 67 09 09  |cket_DoNothing..|
00003a80  3b 46 73 45 6e 74 72 79  5f 46 75 6e 63 20 32 39  |;FsEntry_Func 29|
00003a90  0a 09 09 42 09 09 73 6f  63 6b 65 74 5f 72 65 61  |...B..socket_rea|
00003aa0  64 46 72 65 65 09 09 09  3b 46 73 45 6e 74 72 79  |dFree...;FsEntry|
00003ab0  5f 46 75 6e 63 20 33 30  0a 09 09 42 09 09 73 6f  |_Func 30...B..so|
00003ac0  63 6b 65 74 5f 44 6f 4e  6f 74 68 69 6e 67 09 09  |cket_DoNothing..|
00003ad0  3b 46 73 45 6e 74 72 79  5f 46 75 6e 63 20 33 31  |;FsEntry_Func 31|
00003ae0  0a 09 09 42 09 09 73 6f  63 6b 65 74 5f 44 6f 4e  |...B..socket_DoN|
00003af0  6f 74 68 69 6e 67 09 09  3b 46 73 45 6e 74 72 79  |othing..;FsEntry|
00003b00  5f 46 75 6e 63 20 33 32  0a 09 09 42 09 09 73 6f  |_Func 32...B..so|
00003b10  63 6b 65 74 5f 72 65 61  64 55 73 61 67 65 09 09  |cket_readUsage..|
00003b20  3b 46 73 45 6e 74 72 79  5f 46 75 6e 63 20 33 33  |;FsEntry_Func 33|
00003b30  0a 09 09 42 09 09 73 6f  63 6b 65 74 5f 44 6f 4e  |...B..socket_DoN|
00003b40  6f 74 68 69 6e 67 09 09  3b 46 73 45 6e 74 72 79  |othing..;FsEntry|
00003b50  5f 46 75 6e 63 20 33 34  0a 0a 0a 09 3b 53 6f 6d  |_Func 34....;Som|
00003b60  65 20 6f 66 20 74 68 65  20 63 61 6c 6c 73 20 74  |e of the calls t|
00003b70  68 61 74 20 73 65 65 6d  20 74 6f 20 63 6f 6d 65  |hat seem to come|
00003b80  20 68 65 72 65 20 73 68  6f 75 6c 64 20 6e 65 76  | here should nev|
00003b90  65 72 20 62 65 20 63 61  6c 6c 65 64 20 61 6e 79  |er be called any|
00003ba0  77 61 79 2e 0a 20 20 20  20 20 20 20 20 3b 28 61  |way..        ;(a|
00003bb0  74 20 6c 65 61 73 74 20  61 73 73 75 6d 69 6e 67  |t least assuming|
00003bc0  20 74 68 65 20 50 52 4d  73 20 61 72 65 20 63 6f  | the PRMs are co|
00003bd0  72 72 65 63 74 21 29 0a  73 6f 63 6b 65 74 5f 44  |rrect!).socket_D|
00003be0  6f 4e 6f 74 68 69 6e 67  0a 09 09 4c 44 4d 46 44  |oNothing...LDMFD|
00003bf0  09 09 52 31 33 21 2c 7b  52 30 2d 52 34 2c 50 43  |..R13!,{R0-R4,PC|
00003c00  7d 5e 09 09 3b 52 65 74  75 72 6e 20 74 6f 20 66  |}^..;Return to f|
00003c10  69 6c 65 73 77 69 74 63  68 2e 0a 0a 73 6f 63 6b  |ileswitch...sock|
00003c20  65 74 5f 72 65 6e 61 6d  65 0a 09 3b 43 61 6e 27  |et_rename..;Can'|
00003c30  74 20 52 65 6e 61 6d 65  20 73 6f 63 6b 65 74 73  |t Rename sockets|
00003c40  20 73 6f 20 72 65 74 75  72 6e 20 77 69 74 68 20  | so return with |
00003c50  65 72 72 6f 72 0a 09 09  4c 44 4d 46 44 09 09 52  |error...LDMFD..R|
00003c60  31 33 21 2c 7b 52 30 2d  52 34 2c 52 31 34 7d 20  |13!,{R0-R4,R14} |
00003c70  09 09 3b 54 69 64 79 20  73 74 61 63 6b 0a 09 09  |..;Tidy stack...|
00003c80  4d 4f 56 09 09 52 30 2c  23 31 09 09 09 09 3b 6d  |MOV..R0,#1....;m|
00003c90  61 72 6b 20 72 65 6e 61  6d 65 20 66 61 69 6c 65  |ark rename faile|
00003ca0  64 2e 0a 09 09 4d 4f 56  53 09 09 70 63 2c 72 31  |d....MOVS..pc,r1|
00003cb0  34 09 09 09 09 3b 72 65  74 75 72 6e 0a 0a 73 6f  |4....;return..so|
00003cc0  63 6b 65 74 5f 44 69 73  63 42 6f 6f 74 0a 09 3b  |cket_DiscBoot..;|
00003cd0  48 65 72 65 20 77 65 20  75 73 65 20 74 68 65 20  |Here we use the |
00003ce0  27 43 27 20 6c 69 62 73  20 6d 65 6d 63 70 79 20  |'C' libs memcpy |
00003cf0  74 6f 20 6d 6f 76 65 20  6f 75 72 20 64 61 74 61  |to move our data|
00003d00  20 74 6f 20 46 69 6c 65  73 77 69 63 74 68 0a 20  | to Fileswicth. |
00003d10  20 20 20 20 20 20 20 3b  49 74 27 73 20 6f 76 65  |       ;It's ove|
00003d20  72 6b 69 6c 6c 20 66 6f  72 20 35 20 62 79 74 65  |rkill for 5 byte|
00003d30  73 20 62 75 74 20 74 68  65 72 65 20 61 6e 20 6f  |s but there an o|
00003d40  75 74 73 69 64 65 20 63  68 61 6e 63 65 20 69 74  |utside chance it|
00003d50  0a 09 3b 77 69 6c 6c 20  76 61 6c 69 64 61 74 65  |..;will validate|
00003d60  20 74 68 65 20 61 64 64  72 65 73 73 20 66 6f 72  | the address for|
00003d70  20 75 73 2e 0a 09 09 4d  4f 56 09 09 52 31 2c 52  | us....MOV..R1,R|
00003d80  32 0a 09 09 41 44 52 09  09 52 30 2c 73 6f 63 6b  |2...ADR..R0,sock|
00003d90  65 74 5f 44 69 73 63 4d  73 67 0a 09 09 4d 4f 56  |et_DiscMsg...MOV|
00003da0  09 09 52 32 2c 23 73 6f  63 6b 65 74 5f 44 69 73  |..R2,#socket_Dis|
00003db0  63 4d 73 67 20 2d 20 73  6f 63 6b 65 74 5f 44 69  |cMsg - socket_Di|
00003dc0  73 63 4d 73 67 45 6e 64  0a 09 09 42 4c 09 09 6d  |scMsgEnd...BL..m|
00003dd0  65 6d 63 70 79 0a 09 09  4c 44 4d 46 44 09 09 52  |emcpy...LDMFD..R|
00003de0  31 33 21 2c 7b 52 30 2d  52 34 2c 50 43 7d 0a 73  |13!,{R0-R4,PC}.s|
00003df0  6f 63 6b 65 74 5f 44 69  73 63 4d 73 67 0a 09 09  |ocket_DiscMsg...|
00003e00  44 43 42 09 09 33 2c 22  74 63 70 22 2c 30 0a 73  |DCB..3,"tcp",0.s|
00003e10  6f 63 6b 65 74 5f 44 69  73 63 4d 73 67 45 6e 64  |ocket_DiscMsgEnd|
00003e20  0a 09 09 41 4c 49 47 4e  0a 73 6f 63 6b 65 74 5f  |...ALIGN.socket_|
00003e30  72 65 61 64 44 69 72 4e  61 6d 65 0a 09 3b 57 69  |readDirName..;Wi|
00003e40  6c 6c 20 6e 65 65 64 20  74 6f 20 69 6d 70 6c 65  |ll need to imple|
00003e50  6d 65 6e 74 20 74 6f 20  73 75 70 70 6f 72 74 20  |ment to support |
00003e60  52 4f 32 0a 09 09 42 09  09 73 6f 63 6b 65 74 5f  |RO2...B..socket_|
00003e70  44 6f 4e 6f 74 68 69 6e  67 0a 0a 73 6f 63 6b 65  |DoNothing..socke|
00003e80  74 5f 72 65 61 64 44 69  72 0a 20 09 3b 57 65 20  |t_readDir. .;We |
00003e90  65 73 73 65 6e 74 69 61  6c 6c 79 20 73 68 6f 77  |essentially show|
00003ea0  20 61 6e 20 65 6d 74 70  79 20 64 69 72 65 63 74  | an emtpy direct|
00003eb0  72 79 20 77 69 74 68 0a  09 3b 74 68 65 73 65 20  |ry with..;these |
00003ec0  63 61 6c 6c 73 20 73 6f  20 74 68 65 79 20 63 61  |calls so they ca|
00003ed0  6e 20 61 6c 6c 20 73 68  61 72 65 20 61 20 72 6f  |n all share a ro|
00003ee0  75 74 69 6e 65 2e 0a 09  09 4c 44 4d 46 44 09 09  |utine....LDMFD..|
00003ef0  52 31 33 21 2c 7b 52 30  2d 52 34 2c 52 31 34 7d  |R13!,{R0-R4,R14}|
00003f00  09 09 3b 54 69 64 79 20  73 74 61 63 6b 2c 0a 09  |..;Tidy stack,..|
00003f10  09 4d 4f 56 09 09 52 33  2c 23 30 09 09 09 09 3b  |.MOV..R3,#0....;|
00003f20  4e 6f 20 72 65 63 6f 72  64 73 20 72 65 61 64 0a  |No records read.|
00003f30  09 09 53 54 52 09 09 52  33 2c 5b 52 32 5d 09 09  |..STR..R3,[R2]..|
00003f40  09 09 3b 55 73 65 20 30  20 74 6f 20 74 65 72 6d  |..;Use 0 to term|
00003f50  69 6e 61 74 65 20 62 75  66 66 65 72 0a 09 09 4d  |inate buffer...M|
00003f60  56 4e 09 09 52 34 2c 23  30 09 09 09 09 3b 45 6e  |VN..R4,#0....;En|
00003f70  64 20 6f 66 20 64 69 72  65 63 74 6f 72 79 0a 09  |d of directory..|
00003f80  09 4d 4f 56 53 09 09 50  63 2c 52 31 34 09 09 09  |.MOVS..Pc,R14...|
00003f90  09 3b 52 65 74 75 72 6e  0a 0a 73 6f 63 6b 65 74  |.;Return..socket|
00003fa0  5f 61 6e 6e 6f 75 63 65  0a 09 09 53 57 49 09 09  |_annouce...SWI..|
00003fb0  58 4f 53 5f 57 72 69 74  65 53 0a 09 09 44 43 42  |XOS_WriteS...DCB|
00003fc0  09 09 22 45 72 6b 21 20  53 6f 63 6b 65 74 46 53  |.."Erk! SocketFS|
00003fd0  22 2c 31 33 2c 30 09 09  3b 69 66 20 73 6f 63 6b  |",13,0..;if sock|
00003fe0  65 74 66 73 20 69 73 20  64 65 66 61 75 6c 74 20  |etfs is default |
00003ff0  61 74 0a 09 09 41 4c 49  47 4e 09 09 09 09 09 09  |at...ALIGN......|
00004000  3b 62 6f 6f 74 20 74 68  65 6e 20 79 6f 75 27 72  |;boot then you'r|
00004010  65 20 62 65 69 6e 67 20  63 6c 65 76 65 72 0a 09  |e being clever..|
00004020  09 09 09 09 09 09 09 3b  6f 72 20 68 61 76 65 20  |.......;or have |
00004030  6a 75 73 74 20 68 75 6e  67 21 0a 09 09 4c 44 4d  |just hung!...LDM|
00004040  46 44 09 09 52 31 33 21  2c 7b 52 30 2d 52 34 2c  |FD..R13!,{R0-R4,|
00004050  50 43 7d 0a 0a 73 6f 63  6b 65 74 5f 72 65 61 64  |PC}..socket_read|
00004060  44 65 66 65 63 74 73 0a  09 3b 4f 4b 20 73 6f 20  |Defects..;OK so |
00004070  74 68 65 20 69 6e 74 65  72 6e 65 74 20 68 61 73  |the internet has|
00004080  20 74 68 65 6d 2c 20 62  75 74 20 6e 6f 74 20 71  | them, but not q|
00004090  75 69 74 65 20 69 6e 20  74 68 65 20 77 61 79 0a  |uite in the way.|
000040a0  09 3b 66 69 6c 65 73 77  74 69 63 68 20 6d 65 61  |.;fileswtich mea|
000040b0  6e 73 2e 20 53 6f 20 77  65 20 72 65 74 75 72 6e  |ns. So we return|
000040c0  20 61 6e 20 65 6d 70 74  79 20 64 65 66 65 63 74  | an empty defect|
000040d0  20 6c 69 73 74 2e 0a 09  09 4d 4f 56 09 09 52 30  | list....MOV..R0|
000040e0  2c 23 26 32 30 30 30 30  30 30 30 09 09 09 3b 4c  |,#&20000000...;L|
000040f0  6f 61 64 20 74 68 65 20  6c 69 73 74 20 74 65 72  |oad the list ter|
00004100  6d 69 6e 61 74 6f 72 0a  09 09 53 54 52 09 09 52  |minator...STR..R|
00004110  30 2c 5b 52 32 5d 09 09  09 09 3b 54 65 72 6d 69  |0,[R2]....;Termi|
00004120  6e 61 74 65 20 74 68 65  20 6c 69 73 74 27 73 20  |nate the list's |
00004130  66 69 72 73 74 20 77 6f  72 64 0a 09 09 4c 44 4d  |first word...LDM|
00004140  46 44 09 09 52 31 33 21  2c 7b 52 30 2d 52 34 2c  |FD..R13!,{R0-R4,|
00004150  50 43 7d 5e 09 09 3b 50  72 65 73 65 72 76 65 20  |PC}^..;Preserve |
00004160  72 65 67 73 20 61 6e 64  20 72 65 74 75 72 6e 2e  |regs and return.|
00004170  0a 0a 73 6f 63 6b 65 74  5f 72 65 61 64 42 6f 6f  |..socket_readBoo|
00004180  74 0a 09 09 4c 44 4d 46  44 09 09 52 31 33 21 2c  |t...LDMFD..R13!,|
00004190  7b 52 30 2d 52 34 2c 52  31 34 7d 09 09 3b 54 69  |{R0-R4,R14}..;Ti|
000041a0  64 79 20 73 74 61 63 6b  0a 09 09 4d 4f 56 09 09  |dy stack...MOV..|
000041b0  52 32 2c 23 30 09 09 09  09 3b 42 6f 6f 74 20 6f  |R2,#0....;Boot o|
000041c0  70 74 3d 30 0a 09 09 4d  4f 56 53 09 09 70 63 2c  |pt=0...MOVS..pc,|
000041d0  52 31 34 09 09 09 09 3b  52 65 74 75 72 6e 2e 0a  |R14....;Return..|
000041e0  0a 73 6f 63 6b 65 74 5f  72 65 61 64 46 72 65 65  |.socket_readFree|
000041f0  0a 09 09 4c 44 4d 46 44  09 09 52 31 33 21 2c 7b  |...LDMFD..R13!,{|
00004200  52 30 2d 52 34 2c 52 31  34 7d 09 09 3b 54 69 64  |R0-R4,R14}..;Tid|
00004210  79 20 73 74 61 63 6b 0a  09 09 4d 4f 56 09 09 52  |y stack...MOV..R|
00004220  30 2c 23 30 09 09 09 09  3b 30 20 66 72 65 65 20  |0,#0....;0 free |
00004230  73 70 61 63 65 0a 09 09  4d 4f 56 09 09 52 31 2c  |space...MOV..R1,|
00004240  23 30 09 09 09 09 3b 30  20 63 6f 6e 74 2e 20 66  |#0....;0 cont. f|
00004250  72 65 65 20 73 70 61 63  65 0a 09 09 4d 4f 56 09  |ree space...MOV.|
00004260  09 52 32 2c 23 30 09 09  09 09 3b 30 20 64 69 73  |.R2,#0....;0 dis|
00004270  63 20 73 69 7a 65 0a 09  09 4d 4f 56 53 09 09 70  |c size...MOVS..p|
00004280  63 2c 52 31 34 09 09 09  09 3b 52 65 74 75 72 6e  |c,R14....;Return|
00004290  2e 0a 0a 73 6f 63 6b 65  74 5f 72 65 61 64 55 73  |...socket_readUs|
000042a0  61 67 65 0a 09 09 4c 44  4d 46 44 09 09 52 31 33  |age...LDMFD..R13|
000042b0  21 2c 7b 52 30 2d 52 34  2c 52 31 34 7d 09 09 3b  |!,{R0-R4,R14}..;|
000042c0  54 69 64 79 20 73 74 61  63 6b 0a 09 09 4d 4f 56  |Tidy stack...MOV|
000042d0  09 09 52 32 2c 23 32 09  09 09 09 3b 53 74 72 65  |..R2,#2....;Stre|
000042e0  61 6d 73 20 68 61 76 65  20 75 6e 69 71 75 65 20  |ams have unique |
000042f0  61 64 64 72 65 73 73 20  73 70 61 63 65 0a 09 09  |address space...|
00004300  4d 4f 56 53 09 09 70 63  2c 52 31 34 09 09 09 09  |MOVS..pc,R14....|
00004310  3b 52 65 74 75 72 6e 2e  0a 0a 0a 0a 73 6f 63 6b  |;Return.....sock|
00004320  65 74 5f 66 69 6c 65 20  20 20 20 20 44 42 46 09  |et_file     DBF.|
00004330  09 22 46 53 5f 45 6e 74  72 79 20 46 69 6c 65 20  |."FS_Entry File |
00004340  25 30 77 20 63 61 6c 6c  65 64 5c 6e 22 0a 09 09  |%0w called\n"...|
00004350  54 45 51 20 20 20 20 20  20 20 20 20 20 20 20 20  |TEQ             |
00004360  72 30 2c 20 23 32 35 35  0a 20 20 20 20 20 20 20  |r0, #255.       |
00004370  20 20 20 20 20 20 20 20  20 4d 4f 56 45 51 20 20  |         MOVEQ  |
00004380  20 20 20 20 20 20 20 20  20 72 30 2c 20 23 31 30  |         r0, #10|
00004390  0a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
000043a0  20 43 4d 50 20 20 20 20  20 20 20 20 20 20 20 20  | CMP            |
000043b0  20 72 30 2c 20 23 28 73  6f 63 6b 65 74 5f 46 69  | r0, #(socket_Fi|
000043c0  6c 65 54 61 62 45 6e 64  20 2d 20 73 6f 63 6b 65  |leTabEnd - socke|
000043d0  74 5f 46 69 6c 65 54 61  62 29 20 2f 20 34 0a 20  |t_FileTab) / 4. |
000043e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 41  |               A|
000043f0  44 44 4c 45 20 20 20 20  20 20 20 20 20 20 20 70  |DDLE           p|
00004400  63 2c 20 70 63 2c 20 72  30 2c 20 4c 53 4c 20 23  |c, pc, r0, LSL #|
00004410  32 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |2.              |
00004420  20 20 42 49 43 53 20 20  20 20 20 20 20 20 20 20  |  BICS          |
00004430  20 20 70 63 2c 20 6c 72  2c 20 23 56 5f 42 69 74  |  pc, lr, #V_Bit|
00004440  0a 0a 73 6f 63 6b 65 74  5f 46 69 6c 65 54 61 62  |..socket_FileTab|
00004450  20 20 42 20 20 20 20 20  20 20 20 20 20 20 20 20  |  B             |
00004460  20 20 73 6f 63 6b 65 74  5f 53 61 76 65 20 09 20  |  socket_Save . |
00004470  20 20 20 20 20 20 20 20  20 09 3b 20 53 61 76 65  |         .; Save|
00004480  20 66 69 6c 65 0a 20 20  20 20 20 20 20 20 20 20  | file.          |
00004490  20 20 20 20 20 20 42 49  43 53 20 20 20 20 20 20  |      BICS      |
000044a0  20 20 20 20 20 20 70 63  2c 20 6c 72 2c 20 23 56  |      pc, lr, #V|
000044b0  5f 42 69 74 20 20 20 20  20 20 20 09 09 3b 20 57  |_Bit       ..; W|
000044c0  72 69 74 65 20 63 61 74  61 6c 6f 67 75 65 20 69  |rite catalogue i|
000044d0  6e 66 6f 0a 20 20 20 20  20 20 20 20 20 20 20 20  |nfo.            |
000044e0  20 20 20 20 42 49 43 53  20 20 20 20 20 20 20 20  |    BICS        |
000044f0  20 20 20 20 70 63 2c 20  6c 72 2c 20 23 56 5f 42  |    pc, lr, #V_B|
00004500  69 74 20 20 20 20 20 20  20 09 09 3b 20 57 72 69  |it       ..; Wri|
00004510  74 65 20 6c 6f 61 64 20  61 64 64 72 65 73 73 0a  |te load address.|
00004520  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004530  42 49 43 53 20 20 20 20  20 20 20 20 20 20 20 20  |BICS            |
00004540  70 63 2c 20 6c 72 2c 20  23 56 5f 42 69 74 20 20  |pc, lr, #V_Bit  |
00004550  20 20 20 20 20 09 09 3b  20 57 72 69 74 65 20 65  |     ..; Write e|
00004560  78 65 63 75 74 69 6f 6e  20 61 64 64 72 65 73 73  |xecution address|
00004570  0a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00004580  20 42 49 43 53 20 20 20  20 20 20 20 20 20 20 20  | BICS           |
00004590  20 70 63 2c 20 6c 72 2c  20 23 56 5f 42 69 74 20  | pc, lr, #V_Bit |
000045a0  20 20 20 20 20 20 09 09  3b 20 57 72 69 74 65 20  |      ..; Write |
000045b0  61 74 74 72 69 62 75 74  65 73 0a 20 20 20 20 20  |attributes.     |
000045c0  20 20 20 20 20 20 20 20  20 20 20 42 09 09 73 6f  |           B..so|
000045d0  63 6b 65 74 5f 72 65 61  64 43 61 74 09 09 20 20  |cket_readCat..  |
000045e0  20 20 20 20 20 09 3b 20  52 65 61 64 20 63 61 74  |     .; Read cat|
000045f0  61 6c 6f 67 75 65 20 69  6e 66 6f 0a 20 20 20 20  |alogue info.    |
00004600  20 20 20 20 20 20 20 20  20 20 20 20 42 49 43 53  |            BICS|
00004610  20 20 20 20 20 20 20 20  20 20 20 20 70 63 2c 20  |            pc, |
00004620  6c 72 2c 20 23 56 5f 42  69 74 20 20 20 20 20 20  |lr, #V_Bit      |
00004630  20 09 09 3b 20 44 65 6c  65 74 65 20 6f 62 6a 65  | ..; Delete obje|
00004640  63 74 0a 20 20 20 20 20  20 20 20 20 20 20 20 20  |ct.             |
00004650  20 20 20 42 49 43 53 09  09 70 63 2c 20 6c 72 2c  |   BICS..pc, lr,|
00004660  20 23 56 5f 42 69 74 20  20 20 20 20 20 20 20 20  | #V_Bit         |
00004670  20 20 20 20 09 3b 20 43  72 65 61 74 65 20 66 69  |    .; Create fi|
00004680  6c 65 0a 20 20 20 20 20  20 20 20 20 20 20 20 20  |le.             |
00004690  20 20 20 42 49 43 53 20  20 20 20 20 20 20 20 20  |   BICS         |
000046a0  20 20 20 70 63 2c 20 6c  72 2c 20 23 56 5f 42 69  |   pc, lr, #V_Bi|
000046b0  74 20 20 20 20 20 20 20  09 09 3b 20 43 72 65 61  |t       ..; Crea|
000046c0  74 65 20 64 69 72 65 63  74 6f 72 79 0a 20 20 20  |te directory.   |
000046d0  20 20 20 20 20 20 20 20  20 20 20 20 20 42 49 43  |             BIC|
000046e0  53 20 20 20 20 20 20 20  20 20 20 20 20 70 63 2c  |S            pc,|
000046f0  20 6c 72 2c 20 23 56 5f  42 69 74 20 20 20 20 20  | lr, #V_Bit     |
00004700  20 20 09 09 3b 20 52 65  61 64 20 63 61 74 61 6c  |  ..; Read catal|
00004710  6f 67 75 65 20 69 6e 66  6f 0a 20 20 20 20 20 20  |ogue info.      |
00004720  20 20 20 20 20 20 20 20  20 20 42 49 43 53 20 20  |          BICS  |
00004730  20 20 20 20 20 20 20 20  20 20 70 63 2c 20 6c 72  |          pc, lr|
00004740  2c 20 23 56 5f 42 69 74  20 20 20 20 20 20 20 09  |, #V_Bit       .|
00004750  09 3b 20 4c 6f 61 64 20  66 69 6c 65 0a 73 6f 63  |.; Load file.soc|
00004760  6b 65 74 5f 46 69 6c 65  54 61 62 45 6e 64 0a 0a  |ket_FileTabEnd..|
00004770  0a 73 6f 63 6b 65 74 5f  53 61 76 65 20 20 20 20  |.socket_Save    |
00004780  20 53 54 4d 46 44 20 20  20 20 20 20 20 20 20 20  | STMFD          |
00004790  20 52 31 33 21 2c 20 7b  52 30 2d 52 31 2c 20 52  | R13!, {R0-R1, R|
000047a0  34 2c 20 52 31 34 7d 0a  20 20 20 20 20 20 20 20  |4, R14}.        |
000047b0  20 20 20 20 20 20 20 20  42 4c 20 20 20 20 20 20  |        BL      |
000047c0  20 20 20 20 20 20 20 20  73 6f 63 6b 65 74 5f 6f  |        socket_o|
000047d0  70 65 6e 0a 20 20 20 20  20 20 20 20 20 20 20 20  |pen.            |
000047e0  20 20 20 20 42 45 51 20  20 20 20 20 20 20 20 20  |    BEQ         |
000047f0  20 20 20 20 73 6f 63 6b  65 74 5f 73 61 76 65 45  |    socket_saveE|
00004800  72 72 0a 09 09 4d 4f 56  09 09 52 36 2c 52 35 0a  |rr...MOV..R6,R5.|
00004810  09 09 4d 4f 56 09 09 52  31 2c 52 30 0a 09 09 4d  |..MOV..R1,R0...M|
00004820  4f 56 09 09 52 30 2c 23  31 0a 09 09 4d 4f 56 09  |OV..R0,#1...MOV.|
00004830  09 52 32 2c 52 34 0a 09  09 53 55 42 09 09 52 33  |.R2,R4...SUB..R3|
00004840  2c 52 35 2c 52 34 0a 73  6f 63 6b 65 74 5f 73 61  |,R5,R4.socket_sa|
00004850  76 65 6c 6f 6f 70 0a 20  20 20 20 20 20 20 20 20  |veloop.         |
00004860  20 20 20 20 20 20 20 42  47 45 20 20 20 20 20 20  |       BGE      |
00004870  20 20 20 20 20 20 20 73  6f 63 6b 65 74 5f 73 61  |       socket_sa|
00004880  76 65 65 6e 64 0a 0a 20  20 20 20 20 20 20 20 20  |veend..         |
00004890  20 20 20 20 20 20 20 42  4c 20 20 20 20 20 20 20  |       BL       |
000048a0  20 20 20 20 20 20 20 73  6f 63 6b 65 74 5f 47 42  |       socket_GB|
000048b0  50 42 0a 20 20 20 20 20  20 20 20 20 20 20 20 20  |PB.             |
000048c0  20 20 20 42 56 53 20 20  20 20 20 20 20 20 20 20  |   BVS          |
000048d0  20 20 20 73 6f 63 6b 65  74 5f 73 61 76 65 45 72  |   socket_saveEr|
000048e0  72 0a 09 09 4d 4f 56 53  09 09 52 33 2c 52 33 0a  |r...MOVS..R3,R3.|
000048f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004900  42 45 51 20 20 20 20 20  20 20 20 20 20 20 20 20  |BEQ             |
00004910  73 6f 63 6b 65 74 5f 73  61 76 65 6c 6f 6f 70 0a  |socket_saveloop.|
00004920  73 6f 63 6b 65 74 5f 73  61 76 65 65 6e 64 20 20  |socket_saveend  |
00004930  4d 4f 56 20 20 20 20 20  20 20 20 20 20 20 20 20  |MOV             |
00004940  52 30 2c 20 52 31 0a 20  20 20 20 20 20 20 20 20  |R0, R1.         |
00004950  20 20 20 20 20 20 20 42  09 09 73 6f 63 6b 65 74  |       B..socket|
00004960  5f 63 6c 6f 73 65 0a 73  6f 63 6b 65 74 5f 73 61  |_close.socket_sa|
00004970  76 65 45 72 72 0a 20 20  20 20 20 20 20 20 20 20  |veErr.          |
00004980  20 20 20 20 20 20 4c 44  4d 46 44 20 20 20 20 20  |      LDMFD     |
00004990  20 20 20 20 20 20 73 70  21 2c 20 7b 52 30 2d 52  |      sp!, {R0-R|
000049a0  31 2c 20 72 34 2c 20 52  31 34 7d 0a 09 09 41 44  |1, r4, R14}...AD|
000049b0  52 09 09 52 30 2c 20 73  6f 63 6b 65 74 5f 73 61  |R..R0, socket_sa|
000049c0  76 65 45 72 72 4d 73 67  0a 09 09 4f 52 52 53 09  |veErrMsg...ORRS.|
000049d0  09 70 63 2c 20 6c 72 2c  20 23 56 5f 42 69 74 0a  |.pc, lr, #V_Bit.|
000049e0  0a 0a 73 6f 63 6b 65 74  5f 73 61 76 65 45 72 72  |..socket_saveErr|
000049f0  4d 73 67 0a 09 09 44 43  44 20 09 09 26 31 30 30  |Msg...DCD ..&100|
00004a00  36 37 30 32 0a 09 09 44  43 42 09 09 22 41 6e 20  |6702...DCB.."An |
00004a10  65 72 72 6f 72 20 6f 63  75 72 72 69 6e 67 20 77  |error ocurring w|
00004a20  68 69 6c 65 20 73 61 76  69 6e 67 22 2c 31 33 2c  |hile saving",13,|
00004a30  30 0a 09 09 41 4c 49 47  4e 0a 0a 73 6f 63 6b 65  |0...ALIGN..socke|
00004a40  74 5f 72 65 61 64 43 61  74 20 20 3b 43 75 72 72  |t_readCat  ;Curr|
00004a50  65 6e 74 6c 79 20 77 65  20 64 6f 6e 27 74 20 63  |ently we don't c|
00004a60  68 65 63 6b 20 77 65 74  68 65 72 20 74 68 69 73  |heck wether this|
00004a70  20 69 73 20 61 20 66 75  6c 6c 79 20 73 70 65 63  | is a fully spec|
00004a80  69 66 69 65 64 20 61 64  64 72 65 73 73 0a 09 09  |ified address...|
00004a90  3b 77 69 74 68 20 73 6f  63 6b 65 74 73 20 69 6e  |;with sockets in|
00004aa0  20 75 73 65 20 28 65 67  2e 20 61 6e 20 6f 70 65  | use (eg. an ope|
00004ab0  6e 20 66 69 6c 65 20 2d  20 74 63 70 2f 75 64 70  |n file - tcp/udp|
00004ac0  20 63 6f 6e 6e 65 63 74  69 6f 6e 29 0a 09 09 4d  | connection)...M|
00004ad0  4f 56 09 09 52 30 2c 23  30 09 09 09 09 3b 46 69  |OV..R0,#0....;Fi|
00004ae0  6c 65 20 6e 6f 74 20 46  6f 75 6e 64 0a 09 09 42  |le not Found...B|
00004af0  49 43 53 09 09 52 31 35  2c 52 31 34 2c 23 56 5f  |ICS..R15,R14,#V_|
00004b00  42 69 74 09 09 09 3b 52  65 74 75 72 6e 20 6e 6f  |Bit...;Return no|
00004b10  20 65 72 72 2e 0a 0a 0a  73 6f 63 6b 65 74 5f 63  | err....socket_c|
00004b20  6c 69 62 73 74 61 63 6b  6d 75 6e 67 65 0a 09 09  |libstackmunge...|
00004b30  4d 4f 56 09 09 52 31 30  2c 52 31 33 2c 4c 53 52  |MOV..R10,R13,LSR|
00004b40  20 23 32 30 09 09 09 3b  57 68 69 63 68 20 4d 42  | #20...;Which MB|
00004b50  20 62 6f 75 6e 64 61 72  79 20 69 73 20 74 68 65  | boundary is the|
00004b60  20 73 74 61 63 6b 20 6f  6e 2e 2e 2e 0a 09 09 4d  | stack on......M|
00004b70  4f 56 09 09 52 31 30 2c  52 31 30 2c 4c 53 4c 20  |OV..R10,R10,LSL |
00004b80  23 32 30 09 09 09 3b 70  6f 69 6e 74 20 52 31 30  |#20...;point R10|
00004b90  20 64 69 72 65 63 74 6c  79 20 61 74 20 62 6f 6f  | directly at boo|
00004ba0  75 6e 64 61 72 79 2e 2e  2e 0a 09 09 4c 44 4d 49  |undary......LDMI|
00004bb0  41 09 09 52 31 30 2c 7b  52 34 2c 52 35 7d 09 09  |A..R10,{R4,R5}..|
00004bc0  09 3b 47 65 74 20 72 65  6c 6f 63 61 74 69 6f 6e  |.;Get relocation|
00004bd0  20 66 6f 72 20 6f 74 68  65 72 20 43 20 53 56 43  | for other C SVC|
00004be0  20 6d 6f 64 75 6c 65 73  2e 2e 2e 2e 0a 20 20 20  | modules.....   |
00004bf0  20 20 20 20 20 20 20 20  20 20 20 20 20 53 54 4d  |             STM|
00004c00  46 44 20 20 20 20 20 20  20 20 20 20 20 52 31 33  |FD           R13|
00004c10  21 2c 7b 52 34 2c 52 35  7d 20 20 20 20 09 09 3b  |!,{R4,R5}    ..;|
00004c20  73 61 76 65 20 6f 6c 64  20 72 65 6c 6f 63 20 6d  |save old reloc m|
00004c30  6f 64 69 66 69 65 72 73  20 6f 76 65 72 20 66 6e  |odifiers over fn|
00004c40  20 63 61 6c 6c 0a 09 09  44 42 46 09 09 22 53 74  | call...DBF.."St|
00004c50  75 62 73 20 73 74 6f 72  65 73 20 72 65 6c 6f 63  |ubs stores reloc|
00004c60  73 20 40 20 26 25 63 77  5c 6e 22 0a 20 20 20 20  |s @ &%cw\n".    |
00004c70  20 20 20 20 20 20 20 20  20 20 20 20 4c 44 4d 49  |            LDMI|
00004c80  42 20 20 20 20 20 20 20  20 20 20 20 52 31 32 2c  |B           R12,|
00004c90  20 7b 52 34 2c 20 52 35  7d 20 20 09 09 09 3b 6e  | {R4, R5}  ...;n|
00004ca0  65 77 20 72 65 6c 6f 63  61 74 69 6f 6e 20 6d 6f  |ew relocation mo|
00004cb0  64 69 66 69 65 72 73 0a  09 09 44 42 46 09 09 22  |difiers...DBF.."|
00004cc0  43 20 6c 69 62 20 72 65  6c 6f 63 20 64 69 72 65  |C lib reloc dire|
00004cd0  63 74 69 76 65 73 20 61  72 65 20 26 25 34 77 2c  |ctives are &%4w,|
00004ce0  26 25 35 77 5c 6e 22 0a  20 20 20 20 20 20 20 20  |&%5w\n".        |
00004cf0  20 20 20 20 20 20 20 20  53 54 4d 49 41 20 20 20  |        STMIA   |
00004d00  20 20 20 20 20 20 20 20  52 31 30 2c 20 7b 52 34  |        R10, {R4|
00004d10  2c 20 52 35 7d 20 20 20  09 09 3b 73 65 74 20 62  |, R5}   ..;set b|
00004d20  79 20 6d 6f 64 75 6c 65  20 69 6e 69 74 0a 20 20  |y module init.  |
00004d30  20 20 20 20 20 20 20 20  20 20 20 20 20 20 4d 4f  |              MO|
00004d40  56 20 20 20 20 20 20 20  20 20 20 20 20 20 66 70  |V             fp|
00004d50  2c 20 23 30 20 20 20 20  20 20 20 20 20 20 09 09  |, #0          ..|
00004d60  3b 68 61 6c 74 20 43 20  62 61 63 6b 74 72 61 63  |;halt C backtrac|
00004d70  65 20 68 65 72 65 21 0a  0a 20 20 20 20 20 20 20  |e here!..       |
00004d80  20 20 20 20 20 20 20 20  20 44 43 44 20 20 20 20  |         DCD    |
00004d90  20 20 20 20 20 20 20 20  20 7c 5f 4c 69 62 24 52  |         |_Lib$R|
00004da0  65 6c 6f 63 24 4f 66 66  24 44 50 7c 20 2b 20 26  |eloc$Off$DP| + &|
00004db0  45 32 38 41 41 30 30 30  20 20 3b 20 54 68 69 73  |E28AA000  ; This|
00004dc0  20 69 73 20 65 71 75 69  76 61 6c 65 6e 74 20 6f  | is equivalent o|
00004dd0  66 20 27 41 44 44 20 72  31 30 2c 20 72 31 30 2c  |f 'ADD r10, r10,|
00004de0  20 23 30 27 20 2b 20 7c  5f 4c 69 62 24 52 65 6c  | #0' + |_Lib$Rel|
00004df0  6f 63 24 4f 66 66 24 44  50 7c 0a 09 09 4d 4f 56  |oc$Off$DP|...MOV|
00004e00  53 09 09 50 63 2c 52 31  34 0a 0a 73 6f 63 6b 65  |S..Pc,R14..socke|
00004e10  74 5f 63 6c 69 62 73 74  61 63 6b 75 6e 6d 75 6e  |t_clibstackunmun|
00004e20  67 65 0a 09 09 4d 4f 56  09 09 52 31 30 2c 52 31  |ge...MOV..R10,R1|
00004e30  33 2c 4c 53 52 20 23 32  30 09 09 09 3b 57 68 69  |3,LSR #20...;Whi|
00004e40  63 68 20 4d 42 20 62 6f  75 6e 64 61 72 79 20 69  |ch MB boundary i|
00004e50  73 20 74 68 65 20 73 74  61 63 6b 20 6f 6e 2e 2e  |s the stack on..|
00004e60  2e 0a 09 09 4d 4f 56 09  09 52 31 30 2c 52 31 30  |....MOV..R10,R10|
00004e70  2c 4c 53 4c 20 23 32 30  09 09 09 3b 70 6f 69 6e  |,LSL #20...;poin|
00004e80  74 20 52 31 30 20 64 69  72 65 63 74 6c 79 20 61  |t R10 directly a|
00004e90  74 20 62 6f 6f 75 6e 64  61 72 79 2e 2e 2e 0a 09  |t booundary.....|
00004ea0  09 4c 44 4d 49 41 09 09  52 31 30 2c 7b 52 34 2c  |.LDMIA..R10,{R4,|
00004eb0  52 35 7d 09 09 09 3b 43  68 65 63 6b 20 73 6f 20  |R5}...;Check so |
00004ec0  77 65 20 63 61 6e 20 6d  61 74 63 68 20 6c 61 74  |we can match lat|
00004ed0  65 72 21 0a 09 09 44 42  46 09 09 22 43 20 6c 69  |er!...DBF.."C li|
00004ee0  62 20 72 65 6c 6f 63 20  64 69 72 65 63 74 69 76  |b reloc directiv|
00004ef0  65 73 20 61 72 65 20 26  25 34 77 2c 26 25 35 77  |es are &%4w,&%5w|
00004f00  5c 6e 22 0a 09 09 4c 44  4d 46 44 09 09 52 31 33  |\n"...LDMFD..R13|
00004f10  21 2c 7b 52 34 2c 52 35  7d 09 09 09 3b 47 65 74  |!,{R4,R5}...;Get|
00004f20  20 72 65 6c 6f 63 61 74  69 6f 6e 20 66 6f 72 20  | relocation for |
00004f30  6f 74 68 65 72 20 43 20  53 56 43 20 6d 6f 64 75  |other C SVC modu|
00004f40  6c 65 73 2e 2e 2e 2e 0a  09 09 53 54 4d 49 41 09  |les.......STMIA.|
00004f50  09 52 31 30 2c 7b 52 34  2c 52 35 7d 09 09 09 3b  |.R10,{R4,R5}...;|
00004f60  70 75 74 20 69 74 20 62  61 63 6b 20 77 68 65 72  |put it back wher|
00004f70  65 20 69 74 20 63 61 6d  65 20 66 72 6f 6d 21 0a  |e it came from!.|
00004f80  09 09 4d 4f 56 53 09 09  50 63 2c 52 31 34 0a 0a  |..MOVS..Pc,R14..|
00004f90  09 09 45 4e 44 0a                                 |..END.|
00004f96