It is currently Sat Dec 16, 2017 7:26 am

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Shutting down ip65
PostPosted: Fri Oct 21, 2011 9:16 am 
Offline

Joined: Mon Oct 17, 2011 4:16 am
Posts: 2
Hi all.

Just wondering if anyone knows how to properly shut down ip65?

If I send the following small test (a cut down 'single packet' version of the testudpsend.s that was bundled with ip65) to my c64+ RR-Net + RetroReplay using codenet and run it once, it works fine. (errors on first send attempt, second send is successfully recieved at laptop).

However, if I subsequently run codenet, attempting to send a second .prg from my laptop fails, either with "c64 did not ack," or by crashing my laptop altogether(!) I don't see this behaviour if I reset the c64 before sending another test programme.

I'm also unclear as to when/how I'm meant to use ip65_process.

Any assistance would be much appreciated.

/Christopher Jam


Code:
init:
   jsr ip65_init
   bcc :+

   ldax #failmsg
   jmp print

:   ldax #startmsg
   jsr print
   jmp main


send_err:
   lda#2
   sta $d020
   jsr wait500ms
main:
   jsr ip65_process
   jsr send
   bcs send_err
   lda#4
   sta $d020
:   jsr ip65_process
   rts
   ;jmp :-



send:
   ldx #3
:   lda serverip,x         ; set destination
   sta udp_send_dest,x
   dex
   bpl :-

   ldax #3172         ; set source port
   stax udp_send_src_port

   ldax #3172         ; set dest port
   stax udp_send_dest_port

   ldax #udpsendend - udpsendmsg   ; set length
   stax udp_send_len

   ldax #udpsendmsg
   jsr udp_send

   rts

wait500ms:  ;25 frames
   ldx #25
w1:   bit $d011
   bpl w1
w2:   bit $d011
   bmi w2
   dex
   bne w1
   rts

 ; print elided for brevity - cf ip65 test directory.

udpsendmsg:
   .byte "Greetings from the toad.", 13, 10
udpsendend:

serverip:
   .byte 192, 168, 1, 1


Top
 Profile  
Reply with quote  
 Post subject: Re: Shutting down ip65
PostPosted: Fri Oct 21, 2011 12:57 pm 
Offline

Joined: Mon Mar 23, 2009 12:11 pm
Posts: 140
Location: Katoomba, Australia
With ip65, it is entirely poll driven, i.e. it is only running when you call 'ip65_process', so you don't need to do anything special to shut it down, just stop call ip65_process

But one thing to be aware of is ip65 has a 'hardcoded' MAC address in it (defined in config.s) that will get written into the RR-NET. I am not familiar with codenet, but I expect that it will also have a MAC address hardcoded in it, and that may be causing your problems. Your laptop will have cached in it the ip address & MAC address used by codenet, and after ip65 runs, the RR-NET no longer responds to requests sent using that IP/MAC address, which I guess would show up as 'c64 did not ACK' error.

The simplest workaround while you are developing your code is probably just to exit your program with a reset (JMP $FCE2) rather than an RTS to basic.

re when to call ip65_process - this routine will check whether there is any new packet arrived on your RR-NET, and if so, it will process it - responding automatically to an ARP or ICMP request, and calling your callback routines if it is a UDP or TCP packet. So basically, you should call it as often as you can. Don't do it in an IRQ though, if you have time-critical code (e.g. you are playing a tune and/or doing a graphic display), set up a CIA or VIC IRQ to call your audio/video routines, and then have a 'main' loop that just keeps calling ip65_process.


Top
 Profile  
Reply with quote  
 Post subject: Re: Shutting down ip65
PostPosted: Fri Oct 21, 2011 2:31 pm 
Offline

Joined: Mon Oct 17, 2011 4:16 am
Posts: 2
Ah, thanks for all that. Jumping to fce2 wasn't resetting things sufficiently (edit: also wasn't picking up the TFR rom image!), but I used 'arp -a' on my host system to check the MAC address codenet was using, and altered config.s to match, and that helped a lot; I can now send code from the host after running the test program.

I'm still getting a warm start on the c64 every second run, but that's a huge improvement on what things were before. I'll report back when I work out what the remaining issue is.


Top
 Profile  
Reply with quote  
 Post subject: Re: Shutting down ip65
PostPosted: Sun Jun 16, 2013 7:27 am 
Offline

Joined: Mon Sep 06, 2010 8:05 pm
Posts: 10
Location: Pittsburgh,PA
I'm trying to learn some more about using IP65 in ML code to write some netgames. My background is hardware but I've written programs for a long while now for various projects. I tried KipperBasic and it was very easy to understand the programs from the presentation. Even though the server and client programs were incomplete in there, I managed to finish the TCP program to send a simple message back n forth.

I've been reading how using UDP protocol is best for netgames. I saw this UDP test code written in ML from this thread and wanted to practice with this next. But I don't see any server code for the other C64 machine. Would you have some test code like this which I could use to practice.

_________________
=Dan
http://www.rogtronics.net/


Top
 Profile  
Reply with quote  
 Post subject: Re: Shutting down ip65
PostPosted: Sun Jun 16, 2013 10:04 am 
Offline

Joined: Mon Mar 23, 2009 12:11 pm
Posts: 140
Location: Katoomba, Australia
Hi Ragooman

If you want to see how to wait for an inbound UDP packet (which is what a server does), look at the section marked "Sample UDP listener source" at the bottom of http://ip65.sourceforge.net/

Have fun!


Top
 Profile  
Reply with quote  
 Post subject: Re: Shutting down ip65
PostPosted: Tue Jun 18, 2013 5:20 am 
Offline

Joined: Mon Sep 06, 2010 8:05 pm
Posts: 10
Location: Pittsburgh,PA
jonnosan wrote:
Hi Ragooman

If you want to see how to wait for an inbound UDP packet (which is what a server does), look at the section marked "Sample UDP listener source" at the bottom of http://ip65.sourceforge.net/

Have fun!


thanks, I found it, I'll give it a try. I might have to start a separate thread with more questions so as to not hijack this one. Lief was showing me the ropes on some of the Netgaming techniques. But I've still more to learn about the netgaming aspect. I've been reading some more about Netgame programming in general and then I want to try and apply it to the C64. What I like to start with is converting some old games into netgames to get a better feel for the network code. I've also been scouring the threads on here about IP65 to see what's been happening over the years to try and catchup. I might have to get a 2nd C64NIC card for the other C64 to speed up the testing. Right now, I tag team with another C64 friend in NJ whenever we try some network code.

One quick question, I couldn't find the 'testudpsend.s' that was mentioned here inside the test dir for IP65. Was this removed at some point ? I could always use any example code I can find to learn some more about network programming.

_________________
=Dan
http://www.rogtronics.net/


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group