Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jedeoric committed Apr 26, 2024
1 parent f105085 commit 53647e9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/connect.s
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

.import socket_state
.import socket_sour_port
.import socket_sour_pos

.proc connect
;;@brief Perform connect to socket. Returns socket error if something is wrong
Expand Down Expand Up @@ -51,7 +52,15 @@
jsr ch395_set_des_port_sn

; source port
ldx TR0
;ldx TR0
ldx socket_sour_pos
cpx #16
bne @do_not_rotate_src_port
lda #$00
sta socket_sour_pos

@do_not_rotate_src_port:
inc socket_sour_pos
lda socket_sour_port,x ; Get source port mapping
tay
ldx #$00
Expand Down
6 changes: 6 additions & 0 deletions src/socket.s
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

.export socket_state
.export socket_sour_port
.export socket_sour_pos


.proc socket
;;@brief Open a socket
Expand Down Expand Up @@ -134,3 +136,7 @@ socket_domain:
; The first byte define the source port for socket 0
socket_sour_port:
.byt 170,171,172,173,174,175,176,177
.byt 178,179,180,181,182,183,184,185

socket_sour_pos:
.byte 0

0 comments on commit 53647e9

Please sign in to comment.