\ Filing system temporary workspace mac =&80 ip =&B0 sub =&B4 gw =&B8 dns =&BC REM oswrch =&FFEE nic =&FCC0:REM NIC is located between &FCC0-&FCDF FORI%=0TO3STEP3 P%=&8000 [OPTI% .language_entry BRK \ language entry BRK BRK .service_entry JMP service \ service entry EQUB &82 \ EQUB copyright MOD 256 \ copyright offset EQUB &01 \ version EQUS "Ethernet TCP/IP" \ ROM title EQUB &00 EQUS "1.00" \ Version EQUB &00 .copyright EQUS "Eelco Huininga (c) 2008" EQUB &00 .service PHP PHA TXA PHA TYA PHA TSX LDA &0103,X CMP #&02 \ Relative workspace claim BEQ claimworkspace CMP #&04 \ Unrecognized * command BEQ clihandler CMP #&05 \ Unknown interrupt BEQ inthandler CMP #&08 \ Unrecognized OSWORD call BEQ wordhandler CMP #&09 BEQ helphandler \ *HELP .exitservice PLA TAY PLA TAX PLA PLP RTS .claimworkspace JMP exitservice .clihandler JMP exitservice .inthandler JMP exitservice .wordhandler LDA &EF CMP #&8F \ OSWORD &8F for Ethernet TCP/IP calls BNE exitservice LDY #&00 LDA (&F0),Y \ Get XY+1 (command code) CMP #&08 \ Is the number of parameters 8? BNE exitservice \ Incorrect number of parameters INY LDA (&F0),Y \ Get XY+1 (command code) CMP #&12 \ Is it < &10? BCS exitservice \ Unrecognized command, so exit PHA INY LDA (&F0),Y \ Get XY+1 (address LSB) STA &F8 INY LDA (&F0),Y \ Get XY+1 (address MSB) STA &F9 PLA ASL A \ A=A*2 TAY LDA jumptable,Y \ Get LSB from jumptable PHA LDA jumptable+1,Y \ Get MSB from jumptable PHA RTS .helphandler JMP exitservice \ OSWORD parameter block: \ XY+0: parameterblock length \ XY+1: command code \ XY+2-5: 32-bit address LSB-..-..-MSB \ XY+6-7: 16-bit length \ XY+8: result code .jumptable EQUW status \ Command &00: Get status EQUW setmacaddr-1 \ Command &01: Set MAC address EQUW setipaddr-1 \ Command &02: Set IP address EQUW setsubnetmask-1 \ Command &03: Set subnet mask EQUW setgateway-1 \ Command &04: Set gateway address EQUW setdnsaddr-1 \ Command &05: Set DNS address EQUW sendethernet \ Command &06: Send ethernet package EQUW sendarp \ Command &07: Send ARP package EQUW sendip \ Command &08: Send IP package EQUW sendicmp \ Command &09: Send ICMP package EQUW sendudp \ Command &0A: Send UDP package EQUW sendtcp \ Command &0B: Send TCP package EQUW ping \ Command &0C: ARP Ping EQUW icmpping \ Command &0D: ICMP Ping EQUW arpannounce \ Command &0E: ARP Announce EQUW arpresolve \ Command &0F: ARP Resolve EQUW rarpresolve \ Command &10: RARP Resolve EQUW bootp \ Command &11: BOOTP request EQUW dnsresolve \ Command &12: DNS resolve EQUW getntp \ Command &13: Get NTP time EQUW whois \ Command &13: Perform WHOIS lookup (telnet whois.ripe.net 43, send ip, receive answer) .printmsg PLA STA &7B PLA STA &7C LDY #&00 .printmsg1 INY LDA (&7B),Y JSR oswrch BNE printmsg1 TYA CLC ADC &7B STA &7B LDA &7C ADC #&00 PHA LDA &7B PHA RTS .status LDY #&00 LDX #&00 .status1 LDA mac,X STA (&F8),Y \ Get MAC address INX INY CPY #&06 BNE status1 LDX #&00 .status2 LDA ip,X \ Get ip, sub, gw and dns addresses STA (&F8),Y INX INY CPY #&10 BNE status2 JSR nic_statusupdate