mirror of
https://github.com/bobbimanners/emailler.git
synced 2024-09-08 06:54:24 +00:00
git-svn-id: http://svn.code.sf.net/p/netboot65/code@307 93682198-c243-4bdb-bd91-e943c89aac3b
This commit is contained in:
parent
59a2e55834
commit
64f722c134
Binary file not shown.
Binary file not shown.
@ -1,4 +1,5 @@
|
||||
; Ethernet driver for W5100 W5100 chip
|
||||
|
||||
; Ethernet driver for SMC LAN91C96 chip
|
||||
;
|
||||
|
||||
.ifndef KPR_API_VERSION_NUMBER
|
||||
@ -18,14 +19,148 @@
|
||||
.import eth_outp
|
||||
.import eth_outp_len
|
||||
|
||||
|
||||
.code
|
||||
.import cfg_mac
|
||||
|
||||
; LANceGS hardware addresses
|
||||
ethbsr := $c00E ; Bank select register R/W (2B)
|
||||
|
||||
; Register bank 0
|
||||
ethtcr := $c000 ; Transmission control register R/W (2B)
|
||||
ethephsr := $c002 ; EPH status register R/O (2B)
|
||||
ethrcr := $c004 ; Receive control register R/W (2B)
|
||||
ethecr := $c006 ; Counter register R/O (2B)
|
||||
ethmir := $c008 ; Memory information register R/O (2B)
|
||||
ethmcr := $c00A ; Memory Config. reg. +0 R/W +1 R/O (2B)
|
||||
|
||||
; Register bank 1
|
||||
ethcr := $c000 ; Configuration register R/W (2B)
|
||||
ethbar := $c002 ; Base address register R/W (2B)
|
||||
ethiar := $c004 ; Individual address register R/W (6B)
|
||||
ethgpr := $c00A ; General address register R/W (2B)
|
||||
ethctr := $c00C ; Control register R/W (2B)
|
||||
|
||||
; Register bank 2
|
||||
ethmmucr := $c000 ; MMU command register W/O (1B)
|
||||
ethautotx := $c001 ; AUTO TX start register R/W (1B)
|
||||
ethpnr := $c002 ; Packet number register R/W (1B)
|
||||
etharr := $c003 ; Allocation result register R/O (1B)
|
||||
ethfifo := $c004 ; FIFO ports register R/O (2B)
|
||||
ethptr := $c006 ; Pointer register R/W (2B)
|
||||
ethdata := $c008 ; Data register R/W (4B)
|
||||
ethist := $c00C ; Interrupt status register R/O (1B)
|
||||
ethack := $c00C ; Interrupt acknowledge register W/O (1B)
|
||||
ethmsk := $c00D ; Interrupt mask register R/W (1B)
|
||||
|
||||
; Register bank 3
|
||||
ethmt := $c000 ; Multicast table R/W (8B)
|
||||
ethmgmt := $c008 ; Management interface R/W (2B)
|
||||
ethrev := $c00A ; Revision register R/W (2B)
|
||||
ethercv := $c00C ; Early RCV register R/W (2B)
|
||||
|
||||
.segment "IP65ZP" : zeropage
|
||||
|
||||
eth_packet: .res 2
|
||||
|
||||
.data ;can't be in "code" segment, because that may end up in ROM.
|
||||
|
||||
;initialize the ethernet adaptor
|
||||
;inputs: none
|
||||
;outputs: carry flag is set if there was an error, clear otherwise
|
||||
eth_init:
|
||||
sec ;FIX ME !
|
||||
jsr lan_self_modify
|
||||
lda #$01
|
||||
fixlan00:
|
||||
sta ethbsr ; Select register bank 1
|
||||
fixlan01:
|
||||
lda ethcr ; Read first four bytes - $31, $20, $67, $18
|
||||
cmp #$31
|
||||
bne lanerror
|
||||
fixlan03:
|
||||
lda ethbar
|
||||
cmp #$67
|
||||
bne lanerror
|
||||
fixlan04:
|
||||
lda ethbar+1
|
||||
cmp #$18
|
||||
bne lanerror
|
||||
; we have the magic signature
|
||||
|
||||
; Reset ETH card
|
||||
lda #$00 ; Bank 0
|
||||
fixlan05:
|
||||
sta ethbsr
|
||||
lda #%10000000 ; Software reset
|
||||
fixlan06:
|
||||
sta ethrcr+1
|
||||
|
||||
ldy #$00
|
||||
fixlan07:
|
||||
sty ethrcr
|
||||
fixlan08:
|
||||
sty ethrcr+1
|
||||
|
||||
; Delay
|
||||
: cmp ($FF,x) ; 6 cycles
|
||||
cmp ($FF,x) ; 6 cycles
|
||||
iny ; 2 cycles
|
||||
bne :- ; 3 cycles
|
||||
; 17 * 256 = 4352 -> 4,4 ms
|
||||
|
||||
; Enable transmit and receive
|
||||
lda #%10000001 ; Enable transmit TXENA, PAD_EN
|
||||
ldx #%00000011 ; Enable receive, strip CRC ???
|
||||
fixlan09:
|
||||
sta ethtcr
|
||||
fixlan10:
|
||||
stx ethrcr+1
|
||||
|
||||
lda #$01 ; Bank 1
|
||||
fixlan11:
|
||||
sta ethbsr
|
||||
|
||||
fixlan12:
|
||||
lda ethcr+1
|
||||
ora #%00010000 ; No wait (IOCHRDY)
|
||||
fixlan13:
|
||||
sta ethcr+1
|
||||
|
||||
lda #%00001001 ; Auto release
|
||||
fixlan14:
|
||||
sta ethctr+1
|
||||
|
||||
; Set MAC address
|
||||
lda cfg_mac
|
||||
ldx cfg_mac + 1
|
||||
fixlan15:
|
||||
sta ethiar
|
||||
fixlan16:
|
||||
stx ethiar + 1
|
||||
lda cfg_mac + 2
|
||||
ldx cfg_mac + 3
|
||||
fixlan17:
|
||||
sta ethiar + 2
|
||||
fixlan18:
|
||||
stx ethiar + 3
|
||||
lda cfg_mac + 4
|
||||
ldx cfg_mac + 5
|
||||
fixlan19:
|
||||
sta ethiar + 4
|
||||
fixlan20:
|
||||
stx ethiar + 5
|
||||
|
||||
; Set interrupt mask
|
||||
lda #$02 ; Bank 2
|
||||
fixlan21:
|
||||
sta ethbsr
|
||||
|
||||
lda #%00000000 ; No interrupts
|
||||
fixlan22:
|
||||
sta ethmsk
|
||||
clc
|
||||
rts
|
||||
|
||||
lanerror:
|
||||
sec
|
||||
rts
|
||||
|
||||
|
||||
@ -37,7 +172,70 @@ eth_init:
|
||||
; eth_inp contains the received packet,
|
||||
; and eth_inp_len contains the length of the packet
|
||||
eth_rx:
|
||||
sec ;FIX ME !
|
||||
fixlan38:
|
||||
lda ethist
|
||||
and #%00000001 ; Check receive interrupt
|
||||
bne :+
|
||||
sec ; No packet available
|
||||
rts
|
||||
|
||||
: lda #$00
|
||||
ldx #%11100000 ; Receive, Auto Increment, Read
|
||||
fixlan39:
|
||||
sta ethptr
|
||||
fixlan40:
|
||||
stx ethptr + 1
|
||||
|
||||
; Last word contains 'last data byte' and $60 or 'fill byte' and $40
|
||||
fixlan41:
|
||||
lda ethdata ; Status word
|
||||
fixlan42:
|
||||
lda ethdata ; Only need high byte
|
||||
|
||||
; Move ODDFRM bit into carry:
|
||||
; - Even packet length -> carry clear -> subtract 6 bytes
|
||||
; - Odd packet length -> carry set -> subtract 5 bytes
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
|
||||
; The packet contains 3 extra words
|
||||
fixlan43:
|
||||
lda ethdata ; Total number of bytes
|
||||
sbc #$05 ; Actually 5 or 6 depending on carry
|
||||
sta eth_inp_len
|
||||
fixlan44:
|
||||
lda ethdata
|
||||
sbc #$00
|
||||
sta eth_inp_len+1
|
||||
|
||||
; Read bytes into buffer
|
||||
lda #<eth_inp
|
||||
ldx #>eth_inp
|
||||
sta eth_packet
|
||||
stx eth_packet+1
|
||||
ldx eth_inp_len+1
|
||||
ldy #$00
|
||||
lanread:
|
||||
fixlan46:
|
||||
lda ethdata
|
||||
sta (eth_packet),y
|
||||
iny
|
||||
bne :+
|
||||
inc eth_packet+1
|
||||
: cpy eth_inp_len
|
||||
bne lanread
|
||||
dex
|
||||
bpl lanread
|
||||
|
||||
; Remove and release RX packet from the FIFO
|
||||
lda #%10000000
|
||||
fixlan47:
|
||||
sta ethmmucr
|
||||
|
||||
clc
|
||||
rts
|
||||
|
||||
|
||||
@ -49,10 +247,195 @@ eth_rx:
|
||||
; if there was an error sending the packet then carry flag is set
|
||||
; otherwise carry flag is cleared
|
||||
eth_tx:
|
||||
sec ;FIX ME !
|
||||
lda eth_outp_len + 1 ;
|
||||
ora #%00100000
|
||||
fixlan23:
|
||||
sta ethmmucr ; Allocate memory for transmission
|
||||
fixlan24:
|
||||
lda ethist
|
||||
and #%00001000 ; Allocation interrupt
|
||||
bne :+
|
||||
sec
|
||||
rts ; Not able to allocate; bail
|
||||
|
||||
: lda #%00001000
|
||||
fixlan25:
|
||||
sta ethack ; Acknowledge interrupt
|
||||
|
||||
fixlan26:
|
||||
lda etharr
|
||||
fixlan27:
|
||||
sta ethpnr ; Set packet number
|
||||
|
||||
lda #$00
|
||||
ldx #%01000000 ; Auto increment
|
||||
fixlan28:
|
||||
sta ethptr
|
||||
fixlan29:
|
||||
stx ethptr + 1
|
||||
|
||||
lda #$00 ; Status written by CSMA
|
||||
fixlan30:
|
||||
sta ethdata
|
||||
fixlan31:
|
||||
sta ethdata
|
||||
|
||||
lda eth_outp_len
|
||||
eor #$01
|
||||
lsr
|
||||
lda eth_outp_len
|
||||
adc #$05 ; Actually will be 5 or 6 depending on carry
|
||||
fixlan32:
|
||||
sta ethdata
|
||||
lda eth_outp_len + 1
|
||||
adc #$00
|
||||
fixlan33:
|
||||
sta ethdata
|
||||
|
||||
lda #<eth_outp ; Send the packet
|
||||
ldx #>eth_outp
|
||||
sta eth_packet
|
||||
stx eth_packet + 1
|
||||
ldx eth_outp_len + 1
|
||||
ldy #$00
|
||||
lanwrite:
|
||||
lda (eth_packet),y
|
||||
fixlan34:
|
||||
sta ethdata
|
||||
iny
|
||||
bne :+
|
||||
inc eth_packet + 1
|
||||
: cpy eth_outp_len
|
||||
bne lanwrite
|
||||
dex
|
||||
bpl lanwrite
|
||||
|
||||
lda eth_outp_len ; Odd packet length?
|
||||
lsr
|
||||
bcc :+
|
||||
|
||||
lda #%001000000 ; Yes, Odd
|
||||
bne fixlan36 ; Always
|
||||
|
||||
: lda #$00 ; No
|
||||
fixlan35:
|
||||
sta ethdata ; Fill byte
|
||||
fixlan36:
|
||||
sta ethdata ; Control byte
|
||||
lda #%11000000 ; Enqueue packet - transmit
|
||||
fixlan37:
|
||||
sta ethmmucr
|
||||
|
||||
clc
|
||||
rts
|
||||
|
||||
|
||||
;
|
||||
; lan_self_modify - make all entry points variable so we can move the
|
||||
; LANceGS card around in the Apple
|
||||
;
|
||||
lan_self_modify:
|
||||
lda #$C0 ; FIXME - hardcoded to slot 4
|
||||
; Make the accumulator contain slot number plus $80
|
||||
; i.e. Slot 1 = $90
|
||||
; i.e. Slot 2 = $A0
|
||||
; i.e. Slot 3 = $B0
|
||||
; i.e. Slot 4 = $C0
|
||||
; i.e. Slot 5 = $D0
|
||||
; i.e. Slot 6 = $E0
|
||||
; i.e. Slot 7 = $F0
|
||||
; $C0s0: Save off all ethtcr, ethcr, ethmmucr, and ethmt mods
|
||||
sta fixlan01 + 1
|
||||
sta fixlan09 + 1
|
||||
sta fixlan23 + 1
|
||||
sta fixlan37 + 1
|
||||
; sta fixlan45 + 1 ; Removed
|
||||
sta fixlan47 + 1
|
||||
|
||||
; $C0s1: Save off all ethtcr+1, ethcr+1, ethmmucr+1, and ethmt+1 mods
|
||||
adc #$01
|
||||
; sta fixlan02 + 1 ; Removed
|
||||
sta fixlan12 + 1
|
||||
sta fixlan13 + 1
|
||||
|
||||
; $C0s2: Save off all ethephsr, ethbar, and ethpnr mods
|
||||
adc #$01
|
||||
sta fixlan03 + 1
|
||||
sta fixlan27 + 1
|
||||
|
||||
; $C0s3: Save off all ethephsr+1, ethbar+1, ethpnr+1, and etharr mods
|
||||
adc #$01
|
||||
sta fixlan04 + 1
|
||||
sta fixlan26 + 1
|
||||
|
||||
; $C0s4: Save off all ethrcr, ethiar, and ethfifo mods
|
||||
adc #$01
|
||||
sta fixlan07 + 1
|
||||
sta fixlan15 + 1
|
||||
|
||||
; $C0s5: Save off all ethrcr+1, ethiar+1, and ethfifo+1 mods
|
||||
adc #$01
|
||||
sta fixlan06 + 1
|
||||
sta fixlan08 + 1
|
||||
sta fixlan10 + 1
|
||||
sta fixlan16 + 1
|
||||
|
||||
; $C0s6: Save off all ethecr, ethptr, and ethiar+2 mods
|
||||
adc #$01
|
||||
sta fixlan17 + 1
|
||||
sta fixlan28 + 1
|
||||
sta fixlan39 + 1
|
||||
|
||||
; $C0s7: Save off all ethecr+1, ethptr+1, and ethiar+3 mods
|
||||
adc #$01
|
||||
sta fixlan18 + 1
|
||||
sta fixlan29 + 1
|
||||
sta fixlan40 + 1
|
||||
|
||||
; $C0s8: Save off all ethmir, ethdata, ethmgmt, and ethiar+4 mods
|
||||
adc #$01
|
||||
sta fixlan19 + 1
|
||||
sta fixlan30 + 1
|
||||
sta fixlan31 + 1
|
||||
sta fixlan32 + 1
|
||||
sta fixlan33 + 1
|
||||
sta fixlan34 + 1
|
||||
sta fixlan35 + 1
|
||||
sta fixlan36 + 1
|
||||
sta fixlan41 + 1
|
||||
sta fixlan42 + 1
|
||||
sta fixlan43 + 1
|
||||
sta fixlan44 + 1
|
||||
sta fixlan46 + 1
|
||||
|
||||
; $C0s9: Save off all ethmir+1, ethdata+1, ethmgmt+1, and ethiar+5 mods
|
||||
adc #$01
|
||||
sta fixlan20 + 1
|
||||
|
||||
; $C0sA: Save off all ethmcr, ethgpr, and ethrev mods
|
||||
; $C0sB: Save off all ethmcr+1, ethgpr+1, and ethrev+1 mods
|
||||
; None
|
||||
|
||||
; $C0sC: Save off all ethctr, ethist, ethack, and ethercv mods
|
||||
adc #$03 ; Because there were no a or b mods
|
||||
sta fixlan24 + 1
|
||||
sta fixlan25 + 1
|
||||
sta fixlan38 + 1
|
||||
|
||||
; $C0sD: Save off all ethmsk, ethctr+1 mods
|
||||
adc #$01
|
||||
sta fixlan14 + 1
|
||||
sta fixlan22 + 1
|
||||
|
||||
; $C0sE: Save off all ethbsr mods
|
||||
adc #$01
|
||||
sta fixlan00 + 1
|
||||
sta fixlan05 + 1
|
||||
sta fixlan11 + 1
|
||||
sta fixlan21 + 1
|
||||
|
||||
rts
|
||||
|
||||
.rodata
|
||||
eth_driver_name:
|
||||
.asciiz "LANceGS (91C96)"
|
||||
@ -69,7 +452,8 @@ eth_driver_name:
|
||||
;
|
||||
; The Original Code is ip65.
|
||||
;
|
||||
; The Initial Developer of the Original Code is <## TBD ##>
|
||||
; Portions created by the Initial Developer is Copyright (C) 2010
|
||||
; The Initial Developer of the Original Code is David Schmidt
|
||||
; Portions created by the Initial Developer is Copyright (C) 2011
|
||||
; All Rights Reserved.
|
||||
; -- LICENSE END --
|
||||
|
||||
|
@ -25,10 +25,12 @@
|
||||
:
|
||||
|
||||
print_ok
|
||||
|
||||
|
||||
print_dhcp_init
|
||||
|
||||
|
||||
|
||||
jsr dhcp_init
|
||||
|
||||
bcc :+
|
||||
print_failed
|
||||
sec
|
||||
|
@ -11,6 +11,7 @@
|
||||
.endif
|
||||
|
||||
DEFAULT_CIFS_CMD_BUFFER = $6800
|
||||
DEFAULT_SMB_RESPONSE_BUFFER=$6000
|
||||
.export cifs_l1_encode
|
||||
.export cifs_l1_decode
|
||||
.export cifs_start
|
||||
@ -30,6 +31,7 @@ DEFAULT_CIFS_CMD_BUFFER = $6800
|
||||
.import udp_send_dest_port
|
||||
.import udp_send_len
|
||||
.importzp ip_src
|
||||
.importzp ip_dest
|
||||
.import ip_data
|
||||
.import ip_inp
|
||||
.import tcp_close
|
||||
@ -53,8 +55,8 @@ nbns_nscount=8
|
||||
nbns_arcount=10
|
||||
nbns_question_name=12
|
||||
nbns_service_type=43
|
||||
nbns_ttl=56
|
||||
nbns_additional_record_flags=62
|
||||
|
||||
|
||||
nbns_my_ip=64
|
||||
nbns_registration_message_length=68
|
||||
|
||||
@ -202,6 +204,7 @@ cifs_start:
|
||||
jsr tcp_listen
|
||||
|
||||
@loop:
|
||||
inc $d020 ;FIXME
|
||||
jsr ip65_process
|
||||
lda connection_closed
|
||||
beq @loop
|
||||
@ -238,7 +241,7 @@ cifs_advertise_hostname:
|
||||
ldax #$20
|
||||
jsr copymem
|
||||
|
||||
;copy our encode hostname to the host announcment
|
||||
;copy our raw hostname to the host announcment
|
||||
ldax #raw_local_hostname
|
||||
stax copy_src
|
||||
ldax #host_announce_servername
|
||||
@ -309,6 +312,18 @@ nbns_callback:
|
||||
@name_request:
|
||||
|
||||
;this is a NB NAME REQUEST.
|
||||
;is it a unicast message?
|
||||
ldx #3
|
||||
@check_unicast_loop:
|
||||
lda ip_inp+ip_dest,x
|
||||
cmp cfg_ip,x
|
||||
bne @not_unicast
|
||||
dex
|
||||
bpl @check_unicast_loop
|
||||
|
||||
jmp @looking_for_us
|
||||
|
||||
@not_unicast:
|
||||
;is it looking for our local hostname?
|
||||
ldax #udp_inp+udp_data+nbns_question_name+1
|
||||
stax copy_src
|
||||
@ -320,52 +335,44 @@ nbns_callback:
|
||||
iny
|
||||
cpy #30
|
||||
bne @cmp_loop
|
||||
|
||||
|
||||
@looking_for_us:
|
||||
;this is a request for our name!
|
||||
;we will overwrite the input message to make our response
|
||||
;copy the txn id
|
||||
ldax udp_inp+udp_data ;first 2 bytes of data are txn id
|
||||
stax netbios_name_query_response
|
||||
|
||||
;set the opcode & flags to make this a response
|
||||
lda #$85
|
||||
ldx #$00
|
||||
sta udp_inp+udp_data+nbns_opcode
|
||||
stx udp_inp+udp_data+nbns_opcode+1
|
||||
|
||||
;set the question count to 0
|
||||
stx udp_inp+udp_data+nbns_qdcount+1
|
||||
|
||||
;set the answer count to 1
|
||||
inx
|
||||
stx udp_inp+udp_data+nbns_ancount+1
|
||||
|
||||
;set the sender & recipients IP address
|
||||
;set the sender & recipients IP address
|
||||
ldx #03
|
||||
@copy_address_loop:
|
||||
lda ip_inp+ip_src,x
|
||||
sta udp_send_dest,x
|
||||
lda cfg_ip,x
|
||||
sta udp_inp+udp_data+nbns_my_ip-6,x
|
||||
sta netbios_name_query_response_ip,x
|
||||
dex
|
||||
bpl @copy_address_loop
|
||||
|
||||
|
||||
|
||||
;set the answers
|
||||
|
||||
ldax #nbns_ttl_etc
|
||||
stax copy_src
|
||||
ldax #udp_inp+udp_data+nbns_ttl-6
|
||||
|
||||
;copy our encoded hostname
|
||||
ldax #local_hostname
|
||||
stax copy_src
|
||||
ldax #netbios_name_query_response_hostname
|
||||
stax copy_dest
|
||||
ldax #08
|
||||
ldax #30
|
||||
jsr copymem
|
||||
|
||||
;copy the service identifier - last 2 bytes in the query hostname
|
||||
.import eth_inp
|
||||
ldax eth_inp+$55
|
||||
stax netbios_name_query_response_hostname+30
|
||||
|
||||
ldax #137
|
||||
stax udp_send_dest_port
|
||||
stax udp_send_src_port
|
||||
|
||||
ldax #nbns_registration_message_length-6
|
||||
ldax #netbios_name_query_response_length
|
||||
stax udp_send_len
|
||||
|
||||
ldax #udp_inp+udp_data
|
||||
ldax #netbios_name_query_response
|
||||
jmp udp_send
|
||||
|
||||
|
||||
@ -453,7 +460,8 @@ nb_session_callback:
|
||||
jmp @message_handled
|
||||
|
||||
;this doesn't look like a NBT session message or SMB, so give up
|
||||
@not_session_message:
|
||||
@not_session_message:
|
||||
|
||||
@not_smb:
|
||||
|
||||
jsr tcp_close
|
||||
@ -471,25 +479,96 @@ nb_session_callback:
|
||||
|
||||
|
||||
@not_got_full_message:
|
||||
.import print_hex
|
||||
lda cifs_cmd_length+1
|
||||
jsr print_hex
|
||||
lda cifs_cmd_length
|
||||
jsr print_hex
|
||||
rts
|
||||
|
||||
|
||||
smb_handler:
|
||||
; at this point, copy_src points to an SMB block encapsulated in an NBT session header
|
||||
|
||||
|
||||
clc
|
||||
lda copy_src
|
||||
adc #4
|
||||
sta smb_ptr ;skip past the NBT header
|
||||
lda copy_src+1
|
||||
adc #00
|
||||
sta smb_ptr+1
|
||||
|
||||
ldy #8
|
||||
lda (copy_src),y ;get the SMB type
|
||||
cmp #$72
|
||||
beq @negotiate_protcol
|
||||
;unknown SMB
|
||||
bne @not_negotiate_protocol
|
||||
jmp @negotiate_protocol
|
||||
@not_negotiate_protocol:
|
||||
;we assume it is an "AndX" command
|
||||
|
||||
|
||||
|
||||
sta andx_opcode
|
||||
lda smb_ptr
|
||||
clc
|
||||
adc #$20 ;skip over SMB header
|
||||
sta andx_ptr
|
||||
|
||||
lda smb_ptr+1
|
||||
adc #00
|
||||
sta andx_ptr+1
|
||||
|
||||
jsr start_smb_response
|
||||
|
||||
@parse_andx_block:
|
||||
ldax andx_ptr
|
||||
stax copy_src
|
||||
lda andx_opcode
|
||||
|
||||
cmp #$ff
|
||||
beq @done_all_andx_blocks
|
||||
|
||||
ldy #0
|
||||
@andx_opcode_scan:
|
||||
lda andx_opcodes,y
|
||||
beq @opcode_not_found
|
||||
cmp andx_opcode
|
||||
beq @opcode_found
|
||||
iny
|
||||
iny
|
||||
iny
|
||||
jmp @andx_opcode_scan
|
||||
@opcode_found:
|
||||
lda andx_opcodes+1,y
|
||||
sta andx_handler+1
|
||||
lda andx_opcodes+2,y
|
||||
sta andx_handler+2
|
||||
jsr andx_handler
|
||||
jmp @go_to_next_andx_block
|
||||
|
||||
@opcode_not_found:
|
||||
jsr unknown_andx
|
||||
|
||||
@go_to_next_andx_block:
|
||||
ldy #3
|
||||
lda (copy_src),y ;get the AndX offset low byte
|
||||
clc
|
||||
adc smb_ptr
|
||||
sta andx_ptr
|
||||
iny
|
||||
lda (copy_src),y ;get the AndX offset high byte
|
||||
adc smb_ptr+1
|
||||
sta andx_ptr+1
|
||||
ldy #1
|
||||
lda (copy_src),y ;get the subsequent AndX opcode
|
||||
sta andx_opcode
|
||||
|
||||
jmp @parse_andx_block
|
||||
|
||||
@done_all_andx_blocks:
|
||||
ldax smb_response_length
|
||||
inx ;FIXME! this is to force wireshark to dump as SMB even tho packet is incorrect
|
||||
stax tcp_send_data_len
|
||||
ldax smb_response_buffer
|
||||
jsr tcp_send
|
||||
|
||||
rts
|
||||
@negotiate_protcol:
|
||||
@negotiate_protocol:
|
||||
;copy the request TID,PID,UID,MID into the response
|
||||
ldy #28 ;offset of TID from start of message
|
||||
ldx #0
|
||||
@ -559,14 +638,83 @@ smb_handler:
|
||||
|
||||
rts
|
||||
|
||||
start_smb_response:
|
||||
ldax smb_response_buffer
|
||||
stax copy_dest
|
||||
ldy #0
|
||||
@copy_header_loop:
|
||||
lda (copy_src),y ; copy_src should be the SMB request - cloning this will set PID / MID etc
|
||||
sta (copy_dest),y
|
||||
iny
|
||||
cpy #smb_response_header_length
|
||||
bne @copy_header_loop
|
||||
lda #0
|
||||
sta smb_response_length+1
|
||||
lda #smb_response_header_length
|
||||
sta smb_response_length
|
||||
ldy #3
|
||||
sta (copy_dest),y
|
||||
|
||||
;set the flags correctly
|
||||
ldy #smb_response_flags_offset
|
||||
lda #$82 ;FLAGS byte
|
||||
sta (copy_dest),y
|
||||
iny
|
||||
lda #$01 ;FLAGS2 low byte
|
||||
sta (copy_dest),y
|
||||
iny
|
||||
lda #$00 ;FLAGS2 hi byte
|
||||
sta (copy_dest),y
|
||||
|
||||
rts
|
||||
|
||||
add_andx_response:
|
||||
rts
|
||||
|
||||
|
||||
.import print_a
|
||||
.import print_hex
|
||||
session_setup_andx:
|
||||
lda #'S'
|
||||
jsr print_a
|
||||
rts
|
||||
|
||||
tree_connect_andx:
|
||||
lda #'T'
|
||||
jsr print_a
|
||||
rts
|
||||
|
||||
unknown_andx:
|
||||
lda andx_opcode
|
||||
jsr print_hex
|
||||
lda #'?'
|
||||
jsr print_a
|
||||
rts
|
||||
|
||||
.rodata
|
||||
|
||||
andx_opcodes:
|
||||
.byte $73
|
||||
.word session_setup_andx
|
||||
.byte $75
|
||||
.word tree_connect_andx
|
||||
.byte $00
|
||||
|
||||
|
||||
|
||||
.data
|
||||
|
||||
andx_handler:
|
||||
jmp $FFFF ;filled in later
|
||||
|
||||
smb_response_header:
|
||||
negotiate_protocol_response_message:
|
||||
.byte $00 ;message type = session message
|
||||
.byte $00,$00,negotiate_protocol_response_message_length-4 ;NBT header
|
||||
.byte $FF,"SMB" ;SMB header
|
||||
.byte $72 ;command = negotiate protocol
|
||||
.byte $00,$00,$00,$00 ;status = OK
|
||||
smb_response_flags_offset =*-smb_response_header
|
||||
.byte $82 ;flags : oplocks not supported, paths are case sensitive
|
||||
.byte $01,$00 ;flags 2 - long file names allowed
|
||||
.byte $00, $00 ;PID HIGH
|
||||
@ -577,6 +725,7 @@ negotiate_protocol_response_tid:
|
||||
.byte $98,$76 ;PID - to be overwritten
|
||||
.byte $65,$64 ;USER ID - to be overwritten
|
||||
.byte $ab,$cd ;multiplex ID - to be overwritten
|
||||
smb_response_header_length=*-smb_response_header
|
||||
.byte $11 ;word count
|
||||
dialect_index: .res 2 ;index of selected dialect
|
||||
.byte $00 ;security mode: share, no encryption
|
||||
@ -666,6 +815,27 @@ host_announce_hostname:
|
||||
.byte $0 ;host comment
|
||||
host_announce_message_length=*-host_announce_message
|
||||
|
||||
|
||||
netbios_name_query_response:
|
||||
.byte $12,$34 ;transaction id
|
||||
.byte $85,$00 ;flags: name query response, no error
|
||||
.byte $00,$00 ;questions = 0
|
||||
.byte $00,$01 ;answers = 1
|
||||
.byte $00,$00 ;authority records = 0
|
||||
.byte $00,$00 ;additional records = 0
|
||||
.byte $20 ;
|
||||
netbios_name_query_response_hostname:
|
||||
.res 30 ;will be replaced with encoded hostname
|
||||
.byte $43,$41 ;
|
||||
.byte $00 ;
|
||||
.byte $00,$20 ; type = NB
|
||||
.byte $00,$01 ;class = IN
|
||||
.byte $00,$00,$01,$40 ; TTL = 64 seconds
|
||||
.byte $00,$06 ;data length
|
||||
.byte $00,$00 ;FLAGS = B-NODE, UNIQUE NAME
|
||||
netbios_name_query_response_ip:
|
||||
.res 4 ;filled in with our IP
|
||||
netbios_name_query_response_length=*-netbios_name_query_response
|
||||
|
||||
registration_request:
|
||||
|
||||
@ -685,7 +855,6 @@ registration_request_servername:
|
||||
.byte $c0,$0c ;additional record name : ptr to string in QUESTION NAME
|
||||
.byte $00,$20 ;question_type = NB
|
||||
.byte $00,$01 ;question_class = IN
|
||||
nbns_ttl_etc:
|
||||
.byte $00,$00,$01,$40 ; TTL = 64 seconds
|
||||
.byte $00,$06 ;data length
|
||||
.byte $00,$00 ;FLAGS = B-NODE, UNIQUE NAME
|
||||
@ -700,6 +869,12 @@ positive_session_response_packet:
|
||||
.byte $00, $00 ;message length
|
||||
positive_session_response_packet_length=*-positive_session_response_packet
|
||||
|
||||
.data
|
||||
|
||||
cifs_cmd_buffer: .word DEFAULT_CIFS_CMD_BUFFER
|
||||
|
||||
smb_response_buffer: .word DEFAULT_SMB_RESPONSE_BUFFER
|
||||
|
||||
.bss
|
||||
hostname_buffer: .res 33
|
||||
|
||||
@ -716,11 +891,13 @@ connection_closed: .res 1
|
||||
cifs_cmd_buffer_ptr: .res 2
|
||||
cifs_cmd_length: .res 2
|
||||
|
||||
.data
|
||||
andx_opcode: .res 1
|
||||
andx_ptr: .res 2 ;pointer to next 'AndX' command
|
||||
andx_length: .res 2
|
||||
smb_ptr: .res 2
|
||||
smb_response_length: .res 2
|
||||
|
||||
cifs_cmd_buffer: .word DEFAULT_CIFS_CMD_BUFFER
|
||||
|
||||
;-- LICENSE FOR cifs.s --
|
||||
; The contents of this file are subject to the Mozilla Public License
|
||||
; Version 1.1 (the "License"); you may not use this file except in
|
||||
; compliance with the License. You may obtain a copy of the License at
|
||||
|
@ -32,7 +32,6 @@
|
||||
.export udp_send_dest_port
|
||||
.export udp_send_len
|
||||
|
||||
|
||||
.import ip_calc_cksum
|
||||
.import ip_send
|
||||
.import ip_create_packet
|
||||
|
@ -1 +1 @@
|
||||
.byte "2011-01-15"
|
||||
.byte "2011-01-15"
|
||||
|
@ -104,7 +104,6 @@ test_vic20.prg: test_vic20.o $(IP65TCPLIB) $(VIC20RRNETLIB) $(INCFILES) ../cfg/v
|
||||
test_lancegs.pg2: test_lancegs.o $(IP65LIB) $(A2LANCEGSLIB) $(INCFILES) ../cfg/a2bin.cfg
|
||||
$(LD) -C ../cfg/a2bin.cfg -o test_lancegs.pg2 $(AFLAGS) $< $(IP65LIB) $(A2LANCEGSLIB)
|
||||
|
||||
|
||||
httpd_test.d64: test_httpd.prg index.html file1.html
|
||||
cp test_httpd.prg autoexec.prg
|
||||
ripxplore.rb --init CbmDos httpd_test.d64 -a autoexec.prg
|
||||
@ -112,12 +111,12 @@ httpd_test.d64: test_httpd.prg index.html file1.html
|
||||
ripxplore.rb httpd_test.d64 -a file1.html -t C64Seq
|
||||
|
||||
|
||||
ip65test.dsk: testdns.pg2 testdottedquad.pg2 testtftp.pg2
|
||||
ripxplore.rb --init BeautifulBoot ip65test.dsk -a testdns.pg2 -t AppleBinary
|
||||
ripxplore.rb ip65test.dsk -a testdns.pg2 -t AppleBinary
|
||||
ripxplore.rb ip65test.dsk -a testtftp.pg2 -t AppleBinary
|
||||
ripxplore.rb ip65test.dsk -a testdottedquad.pg2 -t AppleBinary
|
||||
ripxplore.rb ip65test.dsk -a testdns.pg2 -t AppleBinary
|
||||
ip65test.dsk: testdns.pg2 testdottedquad.pg2 testtftp.pg2 test_lancegs.pg2
|
||||
ripxplore.rb --init AppleDos ip65test.dsk -a test_lancegs.pg2 -t AppleBinary
|
||||
# ripxplore.rb --init BeautifulBoot ip65testb.dsk -a test_lancegs.pg2 -t AppleBinary
|
||||
# ripxplore.rb ip65test.dsk -a testtftp.pg2 -t AppleBinary
|
||||
# ripxplore.rb ip65test.dsk -a testdottedquad.pg2 -t AppleBinary
|
||||
# ripxplore.rb ip65test.dsk -a testdns.pg2 -t AppleBinary
|
||||
|
||||
|
||||
test_disk_io.d64: test_disk_io.prg
|
||||
|
@ -13,6 +13,7 @@
|
||||
.import __CODE_SIZE__
|
||||
.import __RODATA_SIZE__
|
||||
.import __DATA_SIZE__
|
||||
.import __IP65_DEFAULTS_SIZE__
|
||||
|
||||
|
||||
.segment "STARTUP" ;this is what gets put at the start of the file on the C64
|
||||
@ -33,15 +34,26 @@ basicstub:
|
||||
|
||||
.segment "EXEHDR" ;this is what gets put an the start of the file on the Apple 2
|
||||
.addr __CODE_LOAD__-$11 ; Start address
|
||||
.word __CODE_SIZE__+__RODATA_SIZE__+__DATA_SIZE__+4 ; Size
|
||||
.word __CODE_SIZE__+__RODATA_SIZE__+__DATA_SIZE__+__IP65_DEFAULTS_SIZE__+4 ; Size
|
||||
jmp init
|
||||
|
||||
.code
|
||||
|
||||
init:
|
||||
|
||||
; jsr print_cr
|
||||
lda #$0E ;change to lower case
|
||||
jsr print_a
|
||||
jsr print_cr
|
||||
init_ip_via_dhcp
|
||||
|
||||
; jsr ip65_init
|
||||
|
||||
ldx #3
|
||||
:
|
||||
lda static_ip,x
|
||||
sta cfg_ip,x
|
||||
dex
|
||||
bpl :-
|
||||
|
||||
jsr print_ip_config
|
||||
|
||||
ldax #hostname_1
|
||||
@ -96,6 +108,8 @@ hostname_3:
|
||||
cifs_hostname:
|
||||
.byte "KIPPERCIFS",0
|
||||
|
||||
static_ip:
|
||||
.byte 10,5,1,64
|
||||
sample_msg:
|
||||
.byte $ff, $ff, $ff, $ff, $ff, $ff, $f8, $1e, $df, $dc, $47, $a1, $08, $00, $45, $00
|
||||
.byte $00, $4e, $9e, $cf, $00, $00, $40, $11, $c4, $c5, $0a, $05, $01, $02, $0a, $05
|
||||
|
@ -2,46 +2,30 @@
|
||||
.include "../inc/commonprint.i"
|
||||
.include "../inc/net.i"
|
||||
|
||||
.import cfg_get_configuration_ptr
|
||||
.import cfg_get_configuration_ptr
|
||||
.import copymem
|
||||
.importzp copy_src
|
||||
.importzp copy_dest
|
||||
|
||||
.import exit_to_basic
|
||||
|
||||
|
||||
.import __CODE_LOAD__
|
||||
.import __CODE_SIZE__
|
||||
.import __RODATA_SIZE__
|
||||
.import __RODATA_SIZE__
|
||||
.import __DATA_SIZE__
|
||||
|
||||
.import __IP65_DEFAULTS_SIZE__
|
||||
.segment "EXEHDR" ;this is what gets put an the start of the file on the Apple 2
|
||||
.addr __CODE_LOAD__-$11 ; Start address
|
||||
.word __CODE_SIZE__+__RODATA_SIZE__+__DATA_SIZE__+4 ; Size
|
||||
.addr __CODE_LOAD__-$03 ; Start address
|
||||
.word __CODE_SIZE__+__RODATA_SIZE__+__DATA_SIZE__+__IP65_DEFAULTS_SIZE__+4 ; file size
|
||||
jmp init
|
||||
|
||||
.code
|
||||
|
||||
init:
|
||||
cld
|
||||
jsr print_cr
|
||||
init_ip_via_dhcp
|
||||
jsr print_ip_config
|
||||
jsr print_cr
|
||||
rts
|
||||
|
||||
;-- LICENSE FOR test_ping.s --
|
||||
; The contents of this file are subject to the Mozilla Public License
|
||||
; Version 1.1 (the "License"); you may not use this file except in
|
||||
; compliance with the License. You may obtain a copy of the License at
|
||||
; http://www.mozilla.org/MPL/
|
||||
;
|
||||
; Software distributed under the License is distributed on an "AS IS"
|
||||
; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
; License for the specific language governing rights and limitations
|
||||
; under the License.
|
||||
;
|
||||
; The Original Code is ip65.
|
||||
;
|
||||
; The Initial Developer of the Original Code is Jonno Downes,
|
||||
; jonno@jamtronix.com.
|
||||
; Portions created by the Initial Developer are Copyright (C) 2009
|
||||
; Jonno Downes. All Rights Reserved.
|
||||
; -- LICENSE END --
|
||||
jmp exit_to_basic
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user