2013-12-27 13:57:56 +00:00
|
|
|
.include "../inc/common.i"
|
|
|
|
.include "../inc/commonprint.i"
|
|
|
|
.include "../inc/net.i"
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2015-08-28 13:19:52 +00:00
|
|
|
.export start
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
.import exit_to_basic
|
2015-08-28 13:19:52 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
.import ascii_to_native
|
|
|
|
.import parse_dotted_quad
|
|
|
|
.import dotted_quad_value
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
.import tcp_listen
|
|
|
|
.import tcp_callback
|
|
|
|
.import ip65_random_word
|
|
|
|
.import ip65_error
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
.import tcp_connect
|
|
|
|
.import tcp_connect_ip
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
.import tcp_inbound_data_ptr
|
|
|
|
.import tcp_inbound_data_length
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
.import tcp_send
|
|
|
|
.import tcp_send_data_len
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
.importzp acc32
|
|
|
|
.importzp op32
|
|
|
|
.importzp acc16
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
.import add_32_32
|
|
|
|
.import add_16_32
|
|
|
|
.import cmp_32_32
|
|
|
|
.import cmp_16_16
|
|
|
|
.import mul_8_16
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
.import sub_16_16
|
2013-12-13 21:24:03 +00:00
|
|
|
|
|
|
|
|
2014-04-28 16:41:54 +00:00
|
|
|
; keep LD65 happy
|
2016-03-30 14:06:45 +00:00
|
|
|
.segment "INIT"
|
|
|
|
.segment "ONCE"
|
2014-04-28 16:41:54 +00:00
|
|
|
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
.segment "STARTUP"
|
2013-12-15 21:50:01 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
; switch to lower case charset
|
2013-12-29 22:39:35 +00:00
|
|
|
lda #14
|
|
|
|
jsr print_a
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2015-08-28 13:19:52 +00:00
|
|
|
start:
|
|
|
|
jsr print_cr
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #$1234
|
2013-12-13 21:24:03 +00:00
|
|
|
stax acc16
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #$1235
|
|
|
|
jsr test_sub_16_16
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #$180
|
2013-12-13 21:24:03 +00:00
|
|
|
stax acc16
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #$28
|
|
|
|
jsr test_sub_16_16
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #$ff34
|
2013-12-13 21:24:03 +00:00
|
|
|
stax acc16
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #$1235
|
|
|
|
jsr test_sub_16_16
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #$100
|
2013-12-13 21:24:03 +00:00
|
|
|
stax acc16
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #$ffff
|
|
|
|
jsr test_sub_16_16
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #$ffff
|
2013-12-13 21:24:03 +00:00
|
|
|
stax acc16
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #$100
|
|
|
|
jsr test_sub_16_16
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #number1
|
2013-12-13 21:24:03 +00:00
|
|
|
stax acc32
|
|
|
|
stax op32
|
2013-12-27 13:57:56 +00:00
|
|
|
jsr test_cmp_32_32
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #number1
|
2013-12-13 21:24:03 +00:00
|
|
|
stax acc32
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #number13
|
2013-12-13 21:24:03 +00:00
|
|
|
stax op32
|
2013-12-27 13:57:56 +00:00
|
|
|
jsr test_cmp_32_32
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #number1
|
2013-12-13 21:24:03 +00:00
|
|
|
stax acc32
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #number2
|
2013-12-13 21:24:03 +00:00
|
|
|
stax op32
|
2013-12-27 13:57:56 +00:00
|
|
|
jsr test_cmp_32_32
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #$12
|
2013-12-13 21:24:03 +00:00
|
|
|
stax acc16
|
2013-12-27 13:57:56 +00:00
|
|
|
jsr test_cmp_16_16
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #$1234
|
2013-12-13 21:24:03 +00:00
|
|
|
stax acc16
|
2013-12-27 13:57:56 +00:00
|
|
|
jsr test_cmp_16_16
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #$1234
|
2013-12-13 21:24:03 +00:00
|
|
|
stax acc16
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #$1235
|
|
|
|
jsr test_cmp_16_16
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #$1234
|
2013-12-13 21:24:03 +00:00
|
|
|
stax acc16
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #$2234
|
|
|
|
jsr test_cmp_16_16
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #$0000
|
2013-12-13 21:24:03 +00:00
|
|
|
stax acc16
|
2013-12-27 13:57:56 +00:00
|
|
|
jsr test_cmp_16_16
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #$FFFF
|
2013-12-13 21:24:03 +00:00
|
|
|
stax acc16
|
2013-12-27 13:57:56 +00:00
|
|
|
jsr test_cmp_16_16
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #number1
|
2013-12-13 21:24:03 +00:00
|
|
|
stax acc32
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #number2
|
2013-12-13 21:24:03 +00:00
|
|
|
stax op32
|
|
|
|
jsr test_add_32_32
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #number3
|
2013-12-13 21:24:03 +00:00
|
|
|
stax acc32
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #number4
|
2013-12-13 21:24:03 +00:00
|
|
|
stax op32
|
|
|
|
jsr test_add_32_32
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #number5
|
2013-12-13 21:24:03 +00:00
|
|
|
stax acc32
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #number6
|
2013-12-13 21:24:03 +00:00
|
|
|
stax op32
|
|
|
|
jsr test_add_32_32
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #number7
|
2013-12-13 21:24:03 +00:00
|
|
|
stax acc32
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #number8
|
2013-12-13 21:24:03 +00:00
|
|
|
stax op32
|
|
|
|
jsr test_add_32_32
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #number9
|
2013-12-13 21:24:03 +00:00
|
|
|
stax acc32
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #number10
|
2013-12-13 21:24:03 +00:00
|
|
|
stax op32
|
|
|
|
jsr test_add_32_32
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #number11
|
2013-12-13 21:24:03 +00:00
|
|
|
stax acc32
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #number12
|
2013-12-13 21:24:03 +00:00
|
|
|
stax op32
|
|
|
|
jsr test_add_32_32
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #number13
|
2013-12-13 21:24:03 +00:00
|
|
|
stax acc32
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #$1234
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr test_add_16_32
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #number14
|
2013-12-13 21:24:03 +00:00
|
|
|
stax acc32
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #$1234
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr test_add_16_32
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #number15
|
2013-12-13 21:24:03 +00:00
|
|
|
stax acc32
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #$1234
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr test_add_16_32
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #number16
|
2013-12-13 21:24:03 +00:00
|
|
|
stax acc32
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #$1234
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr test_add_16_32
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #number17
|
2013-12-13 21:24:03 +00:00
|
|
|
stax acc32
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #$158
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr test_add_16_32
|
|
|
|
|
|
|
|
jsr print_cr
|
2013-12-19 21:04:19 +00:00
|
|
|
init_ip_via_dhcp
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr print_ip_config
|
|
|
|
|
|
|
|
jsr print_cr
|
|
|
|
|
2013-12-19 21:04:19 +00:00
|
|
|
jsr print_random_number
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
; connect to port 81 - should be rejected
|
|
|
|
ldax #tcp_callback_routine
|
|
|
|
stax tcp_callback
|
|
|
|
ldax tcp_dest_ip
|
|
|
|
stax tcp_connect_ip
|
|
|
|
ldax tcp_dest_ip+2
|
|
|
|
stax tcp_connect_ip+2
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #81
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr tcp_connect
|
|
|
|
jsr check_for_error
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #http_get_length
|
|
|
|
stax tcp_send_data_len
|
|
|
|
ldax #http_get_msg
|
2015-08-28 13:19:52 +00:00
|
|
|
jsr tcp_send
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr check_for_error
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
; now try to connect to port 80 - should be accepted
|
|
|
|
ldax #tcp_callback_routine
|
|
|
|
stax tcp_callback
|
|
|
|
ldax tcp_dest_ip
|
|
|
|
stax tcp_connect_ip
|
|
|
|
ldax tcp_dest_ip+2
|
|
|
|
stax tcp_connect_ip+2
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #80
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr tcp_connect
|
|
|
|
jsr check_for_error
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
sta cxn_closed
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #http_get_length
|
|
|
|
stax tcp_send_data_len
|
|
|
|
ldax #http_get_msg
|
2015-08-28 13:19:52 +00:00
|
|
|
jsr tcp_send
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr check_for_error
|
|
|
|
|
|
|
|
@loop_till_end:
|
|
|
|
jsr ip65_process
|
|
|
|
lda #1
|
|
|
|
cmp cxn_closed
|
|
|
|
|
|
|
|
beq @loop_till_end
|
2015-08-28 13:19:52 +00:00
|
|
|
jmp exit_to_basic
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #tcp_callback_routine
|
|
|
|
stax tcp_callback
|
|
|
|
ldax tcp_dest_ip
|
|
|
|
stax tcp_connect_ip
|
|
|
|
ldax tcp_dest_ip+2
|
|
|
|
stax tcp_connect_ip+2
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #80
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr tcp_connect
|
|
|
|
jsr check_for_error
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #4
|
|
|
|
stax tcp_send_data_len
|
|
|
|
ldax #http_get_msg
|
|
|
|
jsr tcp_send
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr check_for_error
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #http_get_length-4
|
|
|
|
stax tcp_send_data_len
|
|
|
|
ldax #http_get_msg+4
|
|
|
|
jsr tcp_send
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr check_for_error
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #looping
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr print
|
|
|
|
@loop_forever:
|
|
|
|
jsr ip65_process
|
2013-12-19 21:04:19 +00:00
|
|
|
jmp @loop_forever
|
2013-12-13 21:24:03 +00:00
|
|
|
|
|
|
|
tcp_callback_routine:
|
|
|
|
lda tcp_inbound_data_length
|
|
|
|
cmp #$ff
|
|
|
|
bne @not_end_of_file
|
|
|
|
lda #1
|
|
|
|
sta cxn_closed
|
|
|
|
rts
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
@not_end_of_file:
|
|
|
|
lda #14
|
2013-12-27 13:57:56 +00:00
|
|
|
jsr print_a ; switch to lower case
|
2013-12-13 21:24:03 +00:00
|
|
|
|
|
|
|
ldax tcp_inbound_data_ptr
|
|
|
|
stax get_next_byte+1
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
lda #0
|
|
|
|
sta byte_counter
|
|
|
|
sta byte_counter+1
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
@print_one_byte:
|
2013-12-27 13:57:56 +00:00
|
|
|
jsr get_next_byte
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr ascii_to_native
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr print_a
|
|
|
|
inc get_next_byte+1
|
|
|
|
bne :+
|
|
|
|
inc get_next_byte+2
|
2013-12-27 13:57:56 +00:00
|
|
|
: inc byte_counter
|
2013-12-13 21:24:03 +00:00
|
|
|
bne :+
|
|
|
|
inc byte_counter+1
|
2013-12-27 13:57:56 +00:00
|
|
|
: ldax byte_counter
|
|
|
|
stax acc16
|
2013-12-13 21:24:03 +00:00
|
|
|
ldax tcp_inbound_data_length
|
|
|
|
jsr cmp_16_16
|
|
|
|
bne @print_one_byte
|
2013-12-19 21:04:19 +00:00
|
|
|
rts
|
2013-12-13 21:24:03 +00:00
|
|
|
|
|
|
|
check_for_error:
|
|
|
|
lda ip65_error
|
|
|
|
beq @exit
|
|
|
|
ldax #error_code
|
|
|
|
jsr print
|
|
|
|
lda ip65_error
|
2013-12-27 13:57:56 +00:00
|
|
|
jsr print_hex
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr print_cr
|
|
|
|
lda #0
|
|
|
|
sta ip65_error
|
2013-12-19 21:04:19 +00:00
|
|
|
@exit:
|
2013-12-13 21:24:03 +00:00
|
|
|
rts
|
|
|
|
|
|
|
|
print_random_number:
|
|
|
|
jsr ip65_random_word
|
2013-12-27 13:57:56 +00:00
|
|
|
stx temp_ax
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr print_hex
|
2013-12-27 13:57:56 +00:00
|
|
|
lda temp_ax
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr print_hex
|
|
|
|
jsr print_cr
|
|
|
|
rts
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
; assumes acc32 & op32 already set
|
2013-12-13 21:24:03 +00:00
|
|
|
test_add_32_32:
|
2013-12-27 13:57:56 +00:00
|
|
|
ldy #3
|
|
|
|
: lda (acc32),y
|
|
|
|
jsr print_hex
|
2013-12-13 21:24:03 +00:00
|
|
|
dey
|
|
|
|
bpl :-
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
lda #'+'
|
|
|
|
jsr print_a
|
2013-12-27 13:57:56 +00:00
|
|
|
ldy #3
|
|
|
|
: lda (op32),y
|
|
|
|
jsr print_hex
|
2013-12-13 21:24:03 +00:00
|
|
|
dey
|
|
|
|
bpl :-
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
lda #'='
|
|
|
|
jsr print_a
|
|
|
|
jsr add_32_32
|
2013-12-19 21:04:19 +00:00
|
|
|
|
|
|
|
ldy #3
|
2013-12-27 13:57:56 +00:00
|
|
|
: lda (acc32),y
|
|
|
|
jsr print_hex
|
2013-12-13 21:24:03 +00:00
|
|
|
dey
|
|
|
|
bpl :-
|
|
|
|
jsr print_cr
|
|
|
|
rts
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
; assumes acc32 & op32 already set
|
2013-12-13 21:24:03 +00:00
|
|
|
test_cmp_32_32:
|
2013-12-27 13:57:56 +00:00
|
|
|
ldy #3
|
|
|
|
: lda (acc32),y
|
|
|
|
jsr print_hex
|
2013-12-13 21:24:03 +00:00
|
|
|
dey
|
|
|
|
bpl :-
|
2013-12-27 13:57:56 +00:00
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
lda #'='
|
|
|
|
jsr print_a
|
2013-12-27 13:57:56 +00:00
|
|
|
ldy #3
|
|
|
|
: lda (op32),y
|
|
|
|
jsr print_hex
|
2013-12-13 21:24:03 +00:00
|
|
|
dey
|
|
|
|
bpl :-
|
2013-12-27 13:57:56 +00:00
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
lda #':'
|
|
|
|
jsr print_a
|
|
|
|
jsr cmp_32_32
|
|
|
|
bne @not_equal
|
|
|
|
lda #'T'
|
|
|
|
jmp @char_set
|
|
|
|
@not_equal:
|
|
|
|
lda #'F'
|
|
|
|
@char_set:
|
|
|
|
jsr print_a
|
|
|
|
jsr print_cr
|
|
|
|
rts
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
; assumes acc16& AX already set
|
2013-12-13 21:24:03 +00:00
|
|
|
test_cmp_16_16:
|
2013-12-27 13:57:56 +00:00
|
|
|
stax temp_ax
|
2013-12-13 21:24:03 +00:00
|
|
|
lda acc16+1
|
|
|
|
jsr print_hex
|
|
|
|
lda acc16
|
|
|
|
jsr print_hex
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
lda #'='
|
|
|
|
jsr print_a
|
|
|
|
lda temp_ax+1
|
|
|
|
jsr print_hex
|
|
|
|
lda temp_ax
|
|
|
|
jsr print_hex
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
lda #':'
|
|
|
|
jsr print_a
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax temp_ax
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr cmp_16_16
|
|
|
|
bne @not_equal
|
|
|
|
lda #'T'
|
|
|
|
jmp @char_set
|
|
|
|
@not_equal:
|
|
|
|
lda #'F'
|
|
|
|
@char_set:
|
|
|
|
jsr print_a
|
|
|
|
jsr print_cr
|
|
|
|
rts
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
; assumes acc32 & AX already set
|
2013-12-13 21:24:03 +00:00
|
|
|
test_add_16_32:
|
2013-12-27 13:57:56 +00:00
|
|
|
stax temp_ax
|
2013-12-19 21:04:19 +00:00
|
|
|
ldy #3
|
2013-12-27 13:57:56 +00:00
|
|
|
: lda (acc32),y
|
|
|
|
jsr print_hex
|
2013-12-13 21:24:03 +00:00
|
|
|
dey
|
|
|
|
bpl :-
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
lda #'+'
|
|
|
|
jsr print_a
|
|
|
|
|
|
|
|
lda temp_ax+1
|
|
|
|
jsr print_hex
|
|
|
|
lda temp_ax
|
|
|
|
jsr print_hex
|
2013-12-27 13:57:56 +00:00
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
lda #'='
|
|
|
|
jsr print_a
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax temp_ax
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr add_16_32
|
2013-12-27 13:57:56 +00:00
|
|
|
|
2013-12-19 21:04:19 +00:00
|
|
|
ldy #3
|
2013-12-27 13:57:56 +00:00
|
|
|
: lda (acc32),y
|
|
|
|
jsr print_hex
|
2013-12-13 21:24:03 +00:00
|
|
|
dey
|
|
|
|
bpl :-
|
|
|
|
jsr print_cr
|
|
|
|
rts
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
; assumes acc16& A already set
|
2013-12-13 21:24:03 +00:00
|
|
|
test_mul_8_16:
|
2013-12-27 13:57:56 +00:00
|
|
|
sta temp_ax
|
2013-12-13 21:24:03 +00:00
|
|
|
lda acc16+1
|
|
|
|
jsr print_hex
|
|
|
|
lda acc16
|
|
|
|
jsr print_hex
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
lda #'*'
|
|
|
|
jsr print_a
|
|
|
|
lda temp_ax
|
|
|
|
jsr print_hex
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
lda #'='
|
|
|
|
jsr print_a
|
2013-12-27 13:57:56 +00:00
|
|
|
lda temp_ax
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr mul_8_16
|
|
|
|
lda acc16+1
|
|
|
|
jsr print_hex
|
|
|
|
lda acc16
|
|
|
|
jsr print_hex
|
|
|
|
jsr print_cr
|
|
|
|
rts
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
; assumes acc16 & AX already set
|
2013-12-13 21:24:03 +00:00
|
|
|
test_sub_16_16:
|
2013-12-27 13:57:56 +00:00
|
|
|
stax temp_ax
|
2013-12-13 21:24:03 +00:00
|
|
|
|
|
|
|
lda acc16+1
|
|
|
|
jsr print_hex
|
|
|
|
lda acc16
|
|
|
|
jsr print_hex
|
|
|
|
|
|
|
|
lda #'-'
|
|
|
|
jsr print_a
|
|
|
|
|
|
|
|
lda temp_ax+1
|
|
|
|
jsr print_hex
|
|
|
|
lda temp_ax
|
|
|
|
jsr print_hex
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
lda #'='
|
|
|
|
jsr print_a
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax temp_ax
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr sub_16_16
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
lda acc16+1
|
|
|
|
jsr print_hex
|
|
|
|
lda acc16
|
|
|
|
jsr print_hex
|
|
|
|
|
|
|
|
jsr print_cr
|
|
|
|
rts
|
|
|
|
|
|
|
|
@error:
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #failed_msg
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr print
|
|
|
|
jsr print_cr
|
|
|
|
rts
|
2013-12-19 21:04:19 +00:00
|
|
|
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
.bss
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
temp_ax: .res 2
|
|
|
|
cxn_closed: .res 1
|
2013-12-19 21:04:19 +00:00
|
|
|
byte_counter: .res 1
|
|
|
|
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
.data
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
number1:
|
|
|
|
.byte $1,$2,$3,$f
|
|
|
|
number2:
|
|
|
|
.byte $10,$20,$30,$f0
|
|
|
|
number3:
|
2013-12-19 21:04:19 +00:00
|
|
|
.byte $ff,$ff,$ff,$ff
|
2013-12-13 21:24:03 +00:00
|
|
|
number4:
|
|
|
|
.byte $1,$0,$0,$0
|
|
|
|
number5:
|
2013-12-19 21:04:19 +00:00
|
|
|
.byte $ff,$ff,$ff,$ff
|
2013-12-13 21:24:03 +00:00
|
|
|
number6:
|
|
|
|
.byte $0,$0,$0,$0
|
|
|
|
number7:
|
2013-12-19 21:04:19 +00:00
|
|
|
.byte $ff,$ff,$ff,$fe
|
2013-12-13 21:24:03 +00:00
|
|
|
number8:
|
|
|
|
.byte $1,$0,$0,$0
|
|
|
|
number9:
|
2013-12-19 21:04:19 +00:00
|
|
|
.byte $ff,$ff,$ff,$fe
|
2013-12-13 21:24:03 +00:00
|
|
|
number10:
|
|
|
|
.byte $5,$0,$0,$0
|
|
|
|
number11:
|
|
|
|
.byte $ff,$0,$0,$e
|
|
|
|
number12:
|
|
|
|
.byte $5,$0,$0,$0
|
|
|
|
number13:
|
|
|
|
.byte $1,$2,$3,$4
|
|
|
|
number14:
|
|
|
|
.byte $ff,$ff,$ff,$ff
|
|
|
|
number15:
|
|
|
|
.byte $ff,$ff,$00,$00
|
|
|
|
number16:
|
|
|
|
.byte $00,$00,$00,$00
|
|
|
|
number17:
|
|
|
|
.byte $5b,$bc,$08,$a9
|
|
|
|
|
|
|
|
tcp_dest_ip:
|
2013-12-27 13:57:56 +00:00
|
|
|
; .byte 10,5,1,1
|
2013-12-13 21:24:03 +00:00
|
|
|
.byte 74,207,242,229
|
|
|
|
looping:
|
|
|
|
.asciiz "LOOPING..."
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
http_get_msg:
|
|
|
|
.byte "GET /blogx/ HTTP/1.0",13,10,13,10
|
2013-12-27 13:57:56 +00:00
|
|
|
http_get_msg_end:
|
|
|
|
http_get_length = http_get_msg_end-http_get_msg
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
get_next_byte:
|
2013-12-19 21:04:19 +00:00
|
|
|
lda $ffff
|
|
|
|
rts
|
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
|
|
|
|
|
2014-04-13 16:36:04 +00:00
|
|
|
; -- LICENSE FOR tcp.s --
|
2013-12-13 21:24:03 +00:00
|
|
|
; 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/
|
2013-12-27 13:57:56 +00:00
|
|
|
;
|
2013-12-13 21:24:03 +00:00
|
|
|
; 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.
|
2013-12-27 13:57:56 +00:00
|
|
|
;
|
2013-12-13 21:24:03 +00:00
|
|
|
; The Original Code is ip65.
|
2013-12-27 13:57:56 +00:00
|
|
|
;
|
2013-12-13 21:24:03 +00:00
|
|
|
; The Initial Developer of the Original Code is Jonno Downes,
|
|
|
|
; jonno@jamtronix.com.
|
|
|
|
; Portions created by the Initial Developer are Copyright (C) 2009
|
2013-12-27 13:57:56 +00:00
|
|
|
; Jonno Downes. All Rights Reserved.
|
2013-12-13 21:24:03 +00:00
|
|
|
; -- LICENSE END --
|