home *** CD-ROM | disk | FTP | other *** search
/ 8bitfiles.net/archives / archives.tar / archives / geos-archive / GEOS-LINK / ip65-2010-03-21.diff < prev    next >
Text File  |  2019-04-13  |  22KB  |  957 lines

  1. Index: cfg/geos.cfg
  2. ===================================================================
  3. --- cfg/geos.cfg    (revision 0)
  4. +++ cfg/geos.cfg    (revision 694)
  5. @@ -0,0 +1,17 @@
  6. +MEMORY {
  7. +    # use GEOS pseudo-regs a2-a9 for zero-page variables:
  8. +    IP65ZP: start = $70, size = $10, type = rw, define = yes;
  9. +    # would like to load at $6000-length...
  10. +    RAM: start = $3300, size = $2d00, define = yes, file = %O;
  11. +}
  12. +
  13. +SEGMENTS {
  14. +    CODE: load = RAM, type = ro,define = yes;
  15. +    DATA: load = RAM, type = rw,define = yes;
  16. +    SELF_MODIFIED_CODE: load = RAM, type = rw,define = yes, optional=yes;
  17. +    RODATA: load = RAM, type = ro,define = yes;
  18. +    IP65_DEFAULTS: load = RAM, type = rw,define = yes;
  19. +    BSS: load = RAM, type = bss;
  20. +    IP65ZP: load = IP65ZP, type = zp;
  21. +    TCP_VARS: load = RAM, type = bss;
  22. +}
  23. Index: ip65/icmp.s
  24. ===================================================================
  25. --- ip65/icmp.s    (revision 691)
  26. +++ ip65/icmp.s    (revision 694)
  27. @@ -16,6 +16,7 @@
  28.  
  29.      .export icmp_inp
  30.      .export icmp_outp
  31. +    .export icmp_echo_cnt
  32.      .exportzp icmp_type
  33.      .exportzp icmp_code
  34.      .exportzp icmp_cksum
  35. @@ -107,11 +108,14 @@
  36.  .ifdef TCP
  37.  .segment "TCP_VARS"
  38.  icmp_echo_ip: .res 4 ; destination IP address for echo request ("ping")
  39. -icmp_echo_cnt: .res 1  ;ping sequence counter
  40. +; ShadowM (for GEOS) icmp_echo_cnt: .res 1  ;ping sequence counter
  41.  ping_state: .res 1  
  42.   ping_timer: .res 2 ;
  43.  .endif
  44.  
  45. +.bss  ;ShadowM (for GEOS)
  46. +icmp_echo_cnt: .res 1  ;ping sequence counter
  47. +
  48.      .code
  49.  
  50.  ; initialize icmp
  51.  
  52. Property changes on: ip65
  53. ___________________________________________________________________
  54. Added: svn:ignore
  55.    + ip65_tcp.lib
  56. ip65.lib
  57.  
  58.  
  59. Index: inc/kipper_constants.i
  60. ===================================================================
  61. --- inc/kipper_constants.i    (revision 691)
  62. +++ inc/kipper_constants.i    (revision 694)
  63. @@ -20,6 +20,15 @@
  64.  
  65.  KPR_INITIALIZE                EQU $01 ;no inputs or outputs - initializes IP stack, also sets IRQ chain to call KPR_VBL_VECTOR at @ 60hz
  66.  KPR_GET_IP_CONFIG             EQU $02 ;no inputs, outputs AX=pointer to IP configuration structure
  67. +;$03-$0E added by ShadowM for GEOS version
  68. +KPR_SET_DEFAULTS              EQU $03 ;copy default values to IP configuration structure
  69. +KPR_INITIALIZE_CARD           EQU $04 ;no inputs, no outputs (sets error code)
  70. +KPR_INITIALIZE_STACK          EQU $05 ;set default variables based on IP address, etc.
  71. +KPR_INSTALL_IRQ_HANDLER       EQU $06 ;set up timer and install IRQ handler
  72. +KPR_REMOVE_IRQ_HANDLER        EQU $07 ;unhook timer code from IRQ handler
  73. +KPR_INITIALIZE_DHCP           EQU $08 ;request address from DHCP server
  74. +KPR_POLL                      EQU $09 ;call ip65 polling routine
  75. +KPR_ACTIVATE                  EQU $0E ;set up periodic polling
  76.  KPR_DEACTIVATE                EQU $0F ;inputs: none, outputs: none (removes call to KPR_VBL_VECTOR on IRQ chain)
  77.  
  78.  KPR_UDP_ADD_LISTENER          EQU $10 ;inputs: AX points to a UDP listener parameter structure, outputs: none
  79. @@ -42,6 +51,9 @@
  80.                                         ;KPR_DNS_HOSTNAME_IP updated with IP address corresponding to hostname.
  81.  KPR_DOWNLOAD_RESOURCE         EQU $31 ;inputs: AX points to a URL download structure, outputs: none
  82.  KPR_PING_HOST                 EQU $32 ;inputs: AX points to destination IP address for ping, outputs: AX=time (in milliseconds) to get response
  83. +KPR_ICMP_ADD_LISTENER         EQU $33 ;inputs: AX points to an ICMP listener parameter structure, outputs: carry flag
  84. +KPR_ICMP_REMOVE_LISTENER      EQU $34 ;inputs: A=ICMP type to remove listener for
  85. +KPR_ICMP_SEND_ECHO_REQ        EQU $35 ;inputs: AX points to destination IP address for ping
  86.  
  87.  KPR_FILE_LOAD                 EQU $40 ;inputs: AX points to a file access parameter structure, outputs: none
  88.  
  89. @@ -97,6 +109,9 @@
  90.  KPR_BLOCK_DEST           EQU $02                   ;2 byte address of start of destination block
  91.  KPR_BLOCK_SIZE           EQU $04                   ;2 byte length of block to be copied (in bytes
  92.  
  93. +;offsets in ICMP listener parameter structure
  94. +KPR_ICMP_LISTENER_TYPE     EQU $00                 ;ICMP type
  95. +KPR_ICMP_LISTENER_CALLBACK EQU $01                 ;2 byte address of routine to call when ICMP packet of specified type arrives
  96.  
  97.  ;offsets in TCP connect parameter structure
  98.  KPR_TCP_REMOTE_IP      EQU $00                       ;4 byte IP address of remote host (0.0.0.0 means wait for inbound i.e. server mode)
  99. Index: Makefile
  100. ===================================================================
  101. --- Makefile    (revision 691)
  102. +++ Makefile    (revision 694)
  103. @@ -1,35 +1,40 @@
  104.  TARGET=c64
  105.  
  106.  
  107. -.PHONY: ip65 drivers test clean distclean carts examples
  108. +.PHONY: ip65 drivers test clean distclean carts examples geos
  109.  
  110.  
  111. -all: ip65 drivers test carts  examples
  112. +all: ip65 drivers test carts  examples geos
  113.  
  114.  ip65:
  115.      make -C ip65 all
  116.  
  117. -drivers:
  118. -    make -C drivers all
  119. -
  120. -examples:
  121. -    make -C examples all
  122. -
  123. -test:
  124. -    make -C test TARGET=$(TARGET) all
  125. -
  126. -carts:
  127. -    make -C carts all
  128. +drivers:
  129. +    make -C drivers all
  130.  
  131. +examples:
  132. +#    make -C examples all
  133. +
  134. +test:
  135. +#    make -C test TARGET=$(TARGET) all
  136. +
  137. +carts:
  138. +#    make -C carts all
  139. +
  140. +geos:
  141. +    make -C geos all
  142. +
  143.  clean:
  144. -    make -C ip65 clean
  145. +    make -C ip65 clean
  146.      make -C drivers clean
  147. +    make -C geos clean
  148.      make -C test clean
  149. -    make -C carts clean
  150. +    make -C carts clean
  151.  
  152.  distclean:
  153. -    make -C ip65 distclean
  154. +    make -C ip65 distclean
  155.      make -C drivers clean
  156. -    make -C test distclean
  157. -    make -C carts distclean
  158. +    make -C geos clean
  159. +    make -C test distclean
  160. +    make -C carts distclean
  161.      rm -f *~
  162. Index: geos/geos_dispatcher.s
  163. ===================================================================
  164. --- geos/geos_dispatcher.s    (revision 0)
  165. +++ geos/geos_dispatcher.s    (revision 694)
  166. @@ -0,0 +1,701 @@
  167. +;this is some very quick and dirty glue to make the most useful IP65 functions available via a single entry point.
  168. +;this allows user applications to be developed that don't link ip65 in directly, rather they use an instance of ip65 that is preloaded (or in a cartridge/ROM)
  169. +;this whole file could (and should) be greatly optimised by making it all table driven, but since this file is probably only going to be used in a bankswitched ROM where
  170. +;space is not at such a premium, I'll go with the gross hack for now.
  171. +
  172. +;Modified by ShadowM for use with GEOS.
  173. +;The include of commonprint.i is commented out, as well as the routines for
  174. +;printing to the screen:
  175. +;KPR_PRINT_ASCIIZ
  176. +;KPR_PRINT_HEX
  177. +;KPR_PRINT_DOTTED_QUAD
  178. +;KPR_PRINT_IP_CONFIG
  179. +;KPR_PRINT_INTEGER
  180. +
  181. +;Includes for input routines (filter_dns, get_filtered_input, filter_number)
  182. +;have been commented out, along with the routines that call them. Same for
  183. +;disk I/O, TFTP and HTTP.
  184. +
  185. +;GEOS IRQ vector (there are two, top and bottom)
  186. +intBotVector = $849F
  187. +
  188. +.ifndef KPR_API_VERSION_NUMBER
  189. +  .define EQU     =
  190. +  .include "../inc/kipper_constants.i"
  191. +.endif
  192. +.include "../inc/common.i"
  193. +; .include "../inc/commonprint.i"
  194. +.export kipper_dispatcher
  195. +
  196. +.import ip65_init
  197. +.import dhcp_init
  198. +.import cfg_get_configuration_ptr
  199. +.import ip65_error
  200. +.import dns_ip
  201. +.import dns_resolve
  202. +.import dns_set_hostname
  203. +.import udp_callback
  204. +.import udp_add_listener
  205. +.import udp_remove_listener
  206. +.import ip_inp
  207. +.import udp_inp
  208. +.import udp_send
  209. +.import udp_send_src
  210. +.import udp_send_src_port
  211. +.import udp_send_dest
  212. +.import udp_send_dest_port
  213. +.import udp_send_len
  214. +
  215. +.import copymem
  216. +.import cfg_mac
  217. +.importzp copy_src
  218. +.importzp copy_dest
  219. +
  220. +;imports added by ShadowM for GEOS version:
  221. +.import arp_init
  222. +.import eth_init
  223. +.import icmp_add_listener
  224. +.import icmp_callback
  225. +.import icmp_echo_cnt
  226. +.import icmp_remove_listener
  227. +.import icmp_send_echo
  228. +.import ip_init
  229. +.import ip65_process
  230. +.import timer_init
  231. +.import timer_vbl_handler
  232. +
  233. +;reuse the copy_src zero page location
  234. +kipper_params = copy_src
  235. +buffer_ptr= copy_dest
  236. +
  237. +.code
  238. +
  239. +jmp kipper_dispatcher  ;vector for GEOS
  240. +
  241. +.data
  242. +
  243. +old_bot_vector:  ;hold area for GEOS intBotVector
  244. +  .word 0
  245. +irq_handler_installed_flag:
  246. +  .byte 0
  247. +ip_configured_flag:
  248. +  .byte 0
  249. +
  250. +.code
  251. +
  252. +install_irq_handler:
  253. +  ldax intBotVector
  254. +  stax old_bot_vector
  255. +  php
  256. +  sei
  257. +  ldax #timer_vbl_handler
  258. +  stax intBotVector
  259. +  lda #$ff
  260. +  sta  irq_handler_installed_flag
  261. +  plp
  262. +  rts
  263. +  
  264. +kipper_dispatcher:
  265. +  stax kipper_params
  266. +  
  267. +
  268. +; not supported under GEOS, must be more granular
  269. +;  cpy #KPR_INITIALIZE
  270. +;  bne :+
  271. +;  lda ip_configured_flag
  272. +;  bne ip_configured
  273. +;  jsr ip65_init
  274. +;  bcs init_failed
  275. +;  jsr dhcp_init
  276. +;  bcc dhcp_ok
  277. +;  jsr ip65_init   ;if DHCP failed, then reinit the IP stack (which will reset IP address etc that DHCP messed with to cartridge default values)
  278. +;dhcp_ok:
  279. +;  lda #1
  280. +;  sta ip_configured_flag
  281. +;  clc
  282. +;init_failed:
  283. +;  rts
  284. +;
  285. +;ip_configured:
  286. +;  clc
  287. +;  rts
  288. +;new GEOS init code:
  289. +  cpy #KPR_INITIALIZE_CARD
  290. +  bne :+
  291. +  jsr eth_init
  292. +  bcc @ok
  293. +  lda #KPR_ERROR_DEVICE_FAILURE
  294. +  sta ip65_error
  295. +@ok:
  296. +  rts
  297. +:
  298. +
  299. +  cpy #KPR_INITIALIZE_STACK
  300. +  bne :+
  301. +  jsr arp_init
  302. +  jsr ip_init
  303. +  rts
  304. +:
  305. +
  306. +  cpy #KPR_INSTALL_IRQ_HANDLER
  307. +  bne :+
  308. +  jsr timer_init
  309. +  jsr install_irq_handler
  310. +  rts
  311. +:
  312. +
  313. +  cpy #KPR_INITIALIZE_DHCP
  314. +  bne :+
  315. +  jsr dhcp_init
  316. +  rts  ;call KPR_GET_LAST_ERROR if carry set on return
  317. +:
  318. +
  319. +  cpy #KPR_POLL
  320. +  bne :+
  321. +  jsr ip65_process
  322. +:
  323. +
  324. +  cpy #KPR_GET_IP_CONFIG
  325. +  bne :+
  326. +  ldax  #cfg_mac
  327. +  clc
  328. +  rts
  329. +:
  330. +
  331. +  cpy #KPR_DNS_RESOLVE
  332. +  bne :+  
  333. +  phax
  334. +  ldy #KPR_DNS_HOSTNAME+1
  335. +  lda (kipper_params),y
  336. +  tax
  337. +  dey
  338. +  lda (kipper_params),y
  339. +  jsr dns_set_hostname 
  340. +  bcs @dns_error
  341. +  jsr dns_resolve
  342. +  bcs @dns_error
  343. +
  344. +  ldy #KPR_DNS_HOSTNAME_IP  
  345. +  plax
  346. +  stax kipper_params
  347. +  ldx #4
  348. +@copy_dns_ip:
  349. +  lda dns_ip,y
  350. +  sta (kipper_params),y
  351. +  iny
  352. +  dex  
  353. +  bne @copy_dns_ip
  354. +  rts
  355. +@dns_error:
  356. +  plax
  357. +  rts
  358. +    
  359. +:
  360. +
  361. +  cpy #KPR_UDP_ADD_LISTENER
  362. +  bne :+  
  363. +  ldy #KPR_UDP_LISTENER_CALLBACK
  364. +  lda (kipper_params),y
  365. +  sta udp_callback
  366. +  iny
  367. +  lda (kipper_params),y
  368. +  sta udp_callback+1
  369. +  ldy #KPR_UDP_LISTENER_PORT+1
  370. +  lda (kipper_params),y
  371. +  tax
  372. +  dey
  373. +  lda (kipper_params),y
  374. +  
  375. +  jmp udp_add_listener
  376. +:
  377. +
  378. +  cpy #KPR_GET_INPUT_PACKET_INFO
  379. +  bne :+
  380. +  ldy #3
  381. +@copy_src_ip:  
  382. +  lda ip_inp+12,y  ;src IP 
  383. +  sta (kipper_params),y
  384. +  dey
  385. +  bpl @copy_src_ip
  386. +  
  387. +  ldy #KPR_REMOTE_PORT
  388. +  lda udp_inp+1 ;src port (lo byte)
  389. +  sta (kipper_params),y
  390. +  iny
  391. +  lda udp_inp+0 ;src port (high byte)
  392. +  sta (kipper_params),y
  393. +  iny
  394. +  lda udp_inp+3 ;dest port (lo byte)
  395. +  sta (kipper_params),y
  396. +  iny
  397. +  lda udp_inp+2 ;dest port (high byte)
  398. +  sta (kipper_params),y
  399. +
  400. +  iny
  401. +  sec
  402. +  lda udp_inp+5 ;payload length (lo byte)
  403. +  sbc #8  ;to remove length of header
  404. +  sta (kipper_params),y
  405. +
  406. +  iny
  407. +  lda udp_inp+4 ;payload length (hi byte)
  408. +  sbc #0  ;in case there was a carry from the lo byte
  409. +  sta (kipper_params),y
  410. +  
  411. +  iny
  412. +  lda #<(udp_inp+8) ;payload ptr (lo byte)
  413. +  sta (kipper_params),y
  414. +
  415. +  iny
  416. +  lda #>(udp_inp+8) ;payload ptr (hi byte)
  417. +  sta (kipper_params),y
  418. +
  419. +.import tcp_inbound_data_ptr
  420. +.import tcp_inbound_data_length
  421. +
  422. +  lda ip_inp+9 ;proto number
  423. +  cmp #6  ;TCP
  424. +  bne @not_tcp
  425. +  ldy #KPR_PAYLOAD_LENGTH
  426. +  lda tcp_inbound_data_length
  427. +  sta (kipper_params),y
  428. +  iny
  429. +  lda tcp_inbound_data_length+1
  430. +  sta (kipper_params),y
  431. +  
  432. +  ldy #KPR_PAYLOAD_POINTER
  433. +  lda tcp_inbound_data_ptr
  434. +  sta (kipper_params),y
  435. +  iny
  436. +  lda tcp_inbound_data_ptr+1
  437. +  sta (kipper_params),y
  438. +@not_tcp:
  439. +
  440. +  clc
  441. +  rts
  442. +:  
  443. +
  444. +  cpy #KPR_SEND_UDP_PACKET
  445. +  bne :+
  446. +  ldy #3
  447. +@copy_dest_ip:  
  448. +  lda (kipper_params),y
  449. +  sta udp_send_dest,y
  450. +  dey
  451. +  bpl @copy_dest_ip
  452. +  
  453. +  ldy #KPR_REMOTE_PORT  
  454. +  lda (kipper_params),y
  455. +  sta udp_send_dest_port
  456. +  iny
  457. +  lda (kipper_params),y
  458. +  sta udp_send_dest_port+1
  459. +  iny
  460. +
  461. +  lda (kipper_params),y
  462. +  sta udp_send_src_port
  463. +  iny
  464. +  lda (kipper_params),y
  465. +  sta udp_send_src_port+1
  466. +  iny
  467. +
  468. +
  469. +  lda (kipper_params),y
  470. +  sta udp_send_len
  471. +  iny
  472. +  lda (kipper_params),y
  473. +  sta udp_send_len+1
  474. +  iny
  475. +
  476. +  ;AX should point at data to send
  477. +  lda (kipper_params),y
  478. +  pha
  479. +  iny
  480. +  lda (kipper_params),y  
  481. +  tax
  482. +  pla
  483. +  jmp udp_send
  484. +:
  485. +
  486. +  cpy #KPR_UDP_REMOVE_LISTENER
  487. +  bne :+
  488. +  jmp udp_remove_listener
  489. +:  
  490. +
  491. +
  492. +  cpy #KPR_DEACTIVATE
  493. +  ;nothing to do now we don't use IRQ
  494. +  bne :+
  495. +  clc
  496. +  rts
  497. +
  498. +:  
  499. +  cpy #KPR_PRINT_ASCIIZ
  500. +  bne :+
  501. +;  jsr print
  502. +;  clc
  503. +;  not supported under GEOS
  504. +  sec
  505. +  rts
  506. +:  
  507. +
  508. +  cpy #KPR_PRINT_HEX
  509. +  bne :+
  510. +;  jsr print_hex
  511. +;  clc
  512. +;  not supported under GEOS
  513. +  sec
  514. +  rts
  515. +:  
  516. +
  517. +  cpy #KPR_PRINT_DOTTED_QUAD
  518. +  bne :+
  519. +;  jsr print_dotted_quad
  520. +;  clc
  521. +;  not supported under GEOS
  522. +  sec
  523. +  rts
  524. +:  
  525. +
  526. +  cpy #KPR_PRINT_IP_CONFIG
  527. +  bne :+
  528. +;  jsr print_ip_config
  529. +;  clc
  530. +;  not supported under GEOS
  531. +  sec
  532. +  rts
  533. +:
  534. +
  535. +  cpy #KPR_PRINT_INTEGER
  536. +  bne :+
  537. +;  jsr print_integer
  538. +;  clc
  539. +;  not supported under GEOS
  540. +  sec
  541. +  rts
  542. +:
  543. +
  544. +
  545. +  .segment "TCP_VARS"
  546. +    port_number: .res 2
  547. +    nonzero_octets: .res 1
  548. +  .code
  549. +
  550. +  cpy #KPR_DOWNLOAD_RESOURCE
  551. +  bne :+  
  552. +.import url_download
  553. +.import url_download_buffer
  554. +.import url_download_buffer_length
  555. +
  556. +
  557. +  ldy #KPR_URL_DOWNLOAD_BUFFER
  558. +  lda (kipper_params),y
  559. +  sta url_download_buffer
  560. +  iny
  561. +  lda (kipper_params),y
  562. +  sta url_download_buffer+1
  563. +
  564. +  ldy #KPR_URL_DOWNLOAD_BUFFER_LENGTH
  565. +  lda (kipper_params),y
  566. +  sta url_download_buffer_length
  567. +  iny
  568. +  lda (kipper_params),y
  569. +  sta url_download_buffer_length+1
  570. +  
  571. +  ldy #KPR_URL+1
  572. +  lda (kipper_params),y
  573. +  tax
  574. +  dey
  575. +  lda (kipper_params),y
  576. +  jmp url_download
  577. +:
  578. +
  579. +  cpy #KPR_FILE_LOAD
  580. +bne :+  
  581. +;.import  io_device_no
  582. +;.import io_read_file
  583. +;.import io_filename
  584. +;.import io_filesize
  585. +;.import io_load_address
  586. +;  phax
  587. +;  ldy #KPR_FILE_ACCESS_FILENAME
  588. +;  lda (kipper_params),y
  589. +;  sta io_filename
  590. +;  iny
  591. +;  lda (kipper_params),y
  592. +;  sta io_filename+1
  593. +;
  594. +;  ldy #KPR_FILE_ACCESS_DEVICE
  595. +;  lda (kipper_params),y
  596. +;  sta io_device_no
  597. +;
  598. +;  ldy #KPR_FILE_ACCESS_POINTER+1
  599. +;  lda (kipper_params),y
  600. +;  tax
  601. +;  dey
  602. +;  lda (kipper_params),y
  603. +;  jsr io_read_file
  604. +;  plax
  605. +;  bcc @read_file_ok
  606. +;  rts
  607. +;
  608. +;@read_file_ok:
  609. +;  stax kipper_params
  610. +;
  611. +;  ldy #KPR_FILE_ACCESS_POINTER
  612. +;  lda io_load_address
  613. +;  sta (kipper_params),y
  614. +;  iny
  615. +;  lda io_load_address+1
  616. +;  sta (kipper_params),y
  617. +;
  618. +;  ldy #KPR_FILE_ACCESS_FILESIZE
  619. +;  lda io_filesize
  620. +;  sta (kipper_params),y
  621. +;  iny
  622. +;  lda io_filesize+1
  623. +;  sta (kipper_params),y
  624. +;  not supported under GEOS
  625. +  sec
  626. +  rts
  627. +:
  628. +
  629. +  cpy #KPR_PING_HOST
  630. +  .import icmp_echo_ip
  631. +  .import icmp_ping
  632. +  bne :+  
  633. +  ldy #3
  634. +@copy_ping_ip_loop:
  635. +  lda (kipper_params),y
  636. +  sta icmp_echo_ip,y
  637. +  dey
  638. +  bpl @copy_ping_ip_loop
  639. +  jmp icmp_ping  
  640. +
  641. +:
  642. +  cpy #KPR_ICMP_ADD_LISTENER
  643. +  bne :+
  644. +  ldy #KPR_ICMP_LISTENER_CALLBACK
  645. +  lda (kipper_params),y
  646. +  sta icmp_callback
  647. +  iny
  648. +  lda (kipper_params),y
  649. +  sta icmp_callback+1
  650. +  ldy #KPR_ICMP_LISTENER_TYPE
  651. +  lda (kipper_params),y
  652. +  jmp icmp_add_listener
  653. +:
  654. +
  655. +  cpy #KPR_ICMP_REMOVE_LISTENER
  656. +  bne :+
  657. +  ;A contains ICMP type to remove listener for
  658. +  jmp icmp_remove_listener
  659. +:
  660. +
  661. +  cpy #KPR_ICMP_SEND_ECHO_REQ  ;send ping
  662. +  bne not_echo_request
  663. +  ;AX contains pointer to destination IP address
  664. +  ldy #3
  665. +: lda (kipper_params),y
  666. +  sta icmp_echo_ip,y
  667. +  dey
  668. +  bpl :-
  669. +  lda #0
  670. +  sta icmp_echo_cnt
  671. +  sta icmp_echo_cnt + 1  ;initialize ping sequence
  672. +  jmp icmp_send_echo
  673. +not_echo_request:
  674. +
  675. +:  
  676. +  cpy #KPR_TCP_CONNECT
  677. +  bne :+  
  678. +  .import tcp_connect
  679. +  .import tcp_callback
  680. +  .import tcp_connect_ip
  681. +  .import tcp_listen
  682. +  ldy #3
  683. +  lda #0
  684. +  sta nonzero_octets
  685. +@copy_dest_ip:  
  686. +  lda (kipper_params),y
  687. +  beq @octet_was_zero
  688. +  inc nonzero_octets
  689. +@octet_was_zero:  
  690. +  sta tcp_connect_ip,y
  691. +  dey
  692. +  bpl @copy_dest_ip
  693. +  
  694. +  ldy #KPR_TCP_CALLBACK
  695. +  lda (kipper_params),y
  696. +  sta tcp_callback
  697. +  iny
  698. +  lda (kipper_params),y
  699. +  sta tcp_callback+1
  700. +  
  701. +  ldy #KPR_TCP_PORT+1
  702. +  lda (kipper_params),y
  703. +  tax
  704. +  dey
  705. +  lda (kipper_params),y
  706. +  ldy nonzero_octets
  707. +  bne @outbound_tcp_connection
  708. +  jmp tcp_listen
  709. +  
  710. +@outbound_tcp_connection:  
  711. +  jmp tcp_connect
  712. +
  713. +:
  714. +
  715. +  .import tcp_send
  716. +  .import tcp_send_data_len
  717. +  cpy #KPR_SEND_TCP_PACKET
  718. +  bne :+
  719. +  ldy #KPR_TCP_PAYLOAD_LENGTH
  720. +  lda (kipper_params),y
  721. +  sta tcp_send_data_len
  722. +  iny
  723. +  lda (kipper_params),y
  724. +  sta tcp_send_data_len+1
  725. +  ldy #KPR_TCP_PAYLOAD_POINTER+1
  726. +  lda (kipper_params),y
  727. +  tax
  728. +  dey
  729. +  lda (kipper_params),y
  730. +  jmp tcp_send
  731. +
  732. +:
  733. +
  734. +
  735. +.import tcp_close
  736. +  cpy #KPR_TCP_CLOSE_CONNECTION
  737. +  bne :+
  738. +  jmp tcp_close
  739. +:
  740. +
  741. +
  742. +; .import filter_dns
  743. +; .import get_filtered_input
  744. +; .import filter_number
  745. +
  746. +  cpy #KPR_INPUT_STRING
  747. +  bne :+
  748. +;  ldy #40 ;max chars
  749. +;  ldax #$0000
  750. +;  jmp get_filtered_input
  751. +;  not supported under GEOS:
  752. +  sec
  753. +  rts
  754. +:
  755. +
  756. +  cpy #KPR_INPUT_HOSTNAME  
  757. +  bne :+
  758. +;  ldy #40 ;max chars
  759. +;  ldax #filter_dns
  760. +;  jmp get_filtered_input
  761. +;  not supported under GEOS
  762. +  sec
  763. +  rts
  764. +:
  765. +
  766. +cpy #KPR_INPUT_PORT_NUMBER
  767. +  bne :+
  768. +;  ldy #5 ;max chars
  769. +;  ldax #filter_number
  770. +;  jsr get_filtered_input
  771. +;  bcs @no_port_entered
  772. +  
  773. +  ;AX now points a string containing port number    
  774. +;  .import parse_integer
  775. +;  jmp parse_integer
  776. +;  not supported under GEOS
  777. +  sec
  778. +@no_port_entered:
  779. +  rts
  780. +:
  781. +
  782. +cpy #KPR_BLOCK_COPY
  783. +  bne :+
  784. +  ;this is where we pay the price for trying to save a few 'zero page' pointers 
  785. +  ;by reusing the 'copy_src' and 'copy_dest' addresses!
  786. +.segment "TCP_VARS"
  787. +  tmp_copy_src: .res 2
  788. +  tmp_copy_dest: .res 2
  789. +  tmp_copy_length: .res 2
  790. +.code
  791. +  
  792. +  ldy #KPR_BLOCK_SRC
  793. +  lda (kipper_params),y
  794. +  sta tmp_copy_src
  795. +  iny  
  796. +  lda (kipper_params),y
  797. +  sta tmp_copy_src+1
  798. +  
  799. +  ldy #KPR_BLOCK_DEST
  800. +  lda (kipper_params),y
  801. +  sta tmp_copy_dest
  802. +  iny  
  803. +  lda (kipper_params),y
  804. +  sta tmp_copy_dest+1
  805. +
  806. +  ldy #KPR_BLOCK_SIZE
  807. +  lda (kipper_params),y
  808. +  sta tmp_copy_length
  809. +  iny  
  810. +  lda (kipper_params),y
  811. +  sta tmp_copy_length+1
  812. +
  813. +  ldax tmp_copy_src
  814. +  stax  copy_src
  815. +  ldax tmp_copy_dest
  816. +  stax  copy_dest
  817. +  ldax tmp_copy_length
  818. +  jmp copymem
  819. +:
  820. +
  821. +  cpy #KPR_PARSER_INIT
  822. +  bne :+
  823. +  .import parser_init
  824. +  jmp parser_init
  825. +:
  826. +
  827. +  cpy #KPR_PARSER_SKIP_NEXT
  828. +  bne :+
  829. +  .import parser_skip_next
  830. +  jmp parser_skip_next
  831. +:
  832. +
  833. +
  834. +
  835. +  cpy #KPR_GET_LAST_ERROR
  836. +  bne :+
  837. +  lda ip65_error
  838. +  clc
  839. +  rts
  840. +:  
  841. +
  842. +
  843. +;default function handler
  844. +  lda #KPR_ERROR_FUNCTION_NOT_SUPPORTED
  845. +  sta ip65_error
  846. +  sec        ;carry flag set = error
  847. +  rts
  848. +
  849. +
  850. +;-- LICENSE FOR function_dispatcher.s --
  851. +; The contents of this file are subject to the Mozilla Public License
  852. +; Version 1.1 (the "License"); you may not use this file except in
  853. +; compliance with the License. You may obtain a copy of the License at
  854. +; http://www.mozilla.org/MPL/
  855. +; 
  856. +; Software distributed under the License is distributed on an "AS IS"
  857. +; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
  858. +; License for the specific language governing rights and limitations
  859. +; under the License.
  860. +; 
  861. +; The Original Code is ip65.
  862. +; 
  863. +; The Initial Developer of the Original Code is Jonno Downes,
  864. +; jonno@jamtronix.com.
  865. +; Portions created by the Initial Developer are Copyright (C) 2009
  866. +; Jonno Downes. All Rights Reserved.  
  867. +; -- LICENSE END --
  868. Index: geos/Makefile
  869. ===================================================================
  870. --- geos/Makefile    (revision 0)
  871. +++ geos/Makefile    (revision 694)
  872. @@ -0,0 +1,44 @@
  873. +AS=ca65
  874. +LD=ld65
  875. +AFLAGS=-l
  876. +
  877. +all: ip65-geos
  878. +
  879. +%.o: %.c
  880. +    $(CC) -c $(CFLAGS) $<
  881. +
  882. +%.o: %.s
  883. +    $(AS) $(AFLAGS) $<
  884. +
  885. +IP65OBJS= \
  886. +    ../ip65/arithmetic.o \
  887. +    ../ip65/config.o \
  888. +    ../ip65/copymem.o \
  889. +    ../ip65/dottedquad.o \
  890. +    ../ip65/ip65.o \
  891. +    ../ip65/output_buffer.o \
  892. +  ../ip65/parser.o \
  893. +  ../ip65/string_utils.o \
  894. +    ../ip65/timer.o \
  895. +  ../ip65/url.o \
  896. +    ../drivers/c64timer_nb65.o \
  897. +    ../ip65/eth.o \
  898. +    ../ip65/cs8900a.o \
  899. +    ../drivers/rr-net.o \
  900. +    ../ip65/arp.o \
  901. +    ../ip65/dhcp.o \
  902. +    ../ip65/dns.o \
  903. +    ../ip65/icmp.o \
  904. +    ../ip65/ip.o \
  905. +    ../ip65/tcp.o \
  906. +    ../ip65/udp.o \
  907. +
  908. +ip65-geos: geos_dispatcher.o $(IP65OBJS) geosinput.o
  909. +    $(LD) -m ip65-geos.map -vm -C ../cfg/geos.cfg -o ip65-geos.prg \
  910. +    geos_dispatcher.o $(IP65OBJS) geosinput.o
  911. +
  912. +clean:
  913. +    rm -f *.o *.prg *.map *.lst
  914. +
  915. +distclean: clean
  916. +    rm -f *~
  917. Index: geos/geosinput.s
  918. ===================================================================
  919. --- geos/geosinput.s    (revision 0)
  920. +++ geos/geosinput.s    (revision 694)
  921. @@ -0,0 +1,14 @@
  922. +.export check_for_abort_key
  923. +
  924. +.code
  925. +
  926. +;This file provides just enough of the routines in drivers/c64input.s
  927. +;to satisfy the dependency from dhcp.s when building ip65 for GEOS.
  928. +
  929. +;check whether the RUN/STOP key is being pressed
  930. +;inputs: none
  931. +;outputs: sec if RUN/STOP pressed, clear otherwise
  932. +check_for_abort_key:
  933. +  clc  ;stub test
  934. +  rts
  935. +  
  936.  
  937. Property changes on: geos
  938. ___________________________________________________________________
  939. Added: svn:ignore
  940.    + ip65-geos.map
  941. geosinput.lst
  942. geos_dispatcher.o
  943. geos_dispatcher.lst
  944. geosinput.o
  945. ip65-geos.prg
  946.  
  947.  
  948.  
  949. Property changes on: drivers
  950. ___________________________________________________________________
  951. Added: svn:ignore
  952.    + c64timer_nb65.lst
  953. apple2prog.lib
  954. c64prog.lib
  955.  
  956.  
  957.