The C library allows us manage de-initializations via atext() so we can avoid the explict timer_exit call necessary in atrtimer.s (used for assembler programs).
The HTTP callback is explicitly allowed to send the HTTP response on its own and set the carry to signal that. Therefore it seems reasonable to export httpd_send_response to allow the HTTP callback to make use of the given infrastructure to send the HTTP response.
Given that Telnet65's 80 column display requires an enhanced Apple //e anyway it seems reasonable to have the C applications benefit from building for that target too.
The date application isn't of much actual use. But it shows
- how easy to use the IP65 C API is
- the power of combining IP65 with the C library
(going from SNTP time format to a date string in two lines of code)
I don't have plans to support C programs on the VIC20. So now that there are C test programs the simplest solution is to not (try to) build VIC20 test programs as part of the default recipe.
Together with the recent change to provide the inbound data buffer address and length to the TCP callback function as C parameters this change allows the TCP API to get along without any global variable :-)
In contrast to the multiple UDP callbacks there's only one TCP callback so it easy to provide a wrapper for the C callback that pushes C parameters on the stack.
Now that we process incoming data from the main loop - and use 'buf' both for incoming and outgoing data we should of course make sure that we never trash the incoming data with outgoing data.
The C test program may serve as copy & paste templates so it should make clear that ip65_process() is supposed to be called pretty regularly. Additionally it isn't supposed to be called recursively meaning that recv callbacks need to return quickly and defer longer processing.
The IP5 usage of ld65 segments and zeropage variables was made compatible with cc65 C programs already a while ago. This commit is the next logical step which is to introduce the actual C interface to IP65.
IP65 for C programs shares the the ip65.lib / ip65_tcp.lib with IP65 for assembler programs. However the various libraries from the 'drivers' are not reused. Instead there's exactly one library for every target named ip65_<target>.lib. Those libraries contain only functions used by ip65.lib / ip65_tcp.lib.
TODOs:
- Introduce c64_timer.s and atr_timer.s.
- Add a C interface to the rest of the IP65 functionality (especially TCP).
Now that with Telnet65 there is a "real" application there's no point anymore in the
ip65demo.dsk. Therefore httpd.slotscan is now part of the ordinary ip65test.dsk.
This was probably an artifact from early stages of porting to the
Atari. Problem manifested itself e.g. when hitting DEL in the middle
of a 'bash' input line.
The change also includes some cleanups as suggested by Oliver.
The vertical blank interrupt (which is used by the timer) runs with
60Hz on NTSC systems and 50Hz on PAL systems.
This commit also clears 'vbichain' in 'timer_exit', so a subsequent
'timer_init' would do the right thing.
FreeBSD and NetBSD, at least, have a banner message when you telnet into them
which has an empty line as first line. On those systems, an old "cursor" char
was visible at the top of the login prompt message.
This is fixed by enabling and disabling the cursor in 'get_key' while waiting
for a key press.
So far most of the time the cursor drawing was handled with a 'jsr COff - jsr COn' bracket around the drawing code. However in the area of screen erasing a different approach was used - which caused subtile issues.
4d729ec839 already fixed (most ?) of those issues for the Apple II and the ATARI. However it broke the approach 'jsr COff - jsr COn' brackets.
This is now adjusted - for all machines.
In order to manage upcoming changes relevant to all machine types it's important that the files are easy to diff. This change improves the similarity between a2<...>.s and atr<...>.s.
Lars informed me that $F142 by default produces ASCII code 0 via Ctrl-@. One just needs a way to distinguish it from the no-key-press.
This means that the further processing can be done in that same as on the Apple II - meaning to just replace in the VT100 keyboard translation table $00 with $FF as code for ignore-key.