Vic 20 network - software by Lee Davison |
FeaturesIt would have easily been possible to expand the Vic 20 well beyond it's original specification for this project, but that would have just made it a less able Commodore 64. So, the code as is fits in the 8KB cartridge space from $A000 to $BFFF and only the Vic's internal RAM is used. BASIC is completely ignored, and could be removed, and only the cartridge startup and interrupt vectors are used in the kernal ROM.
At the time of writing the .asm file is over 100KB long so only sections will be presented here, if you want to see all the code you can download it as a .zip file.
As there are differences between PAL and NTSC Vic 20s where this makes a difference the PAL code is shown in bold and the NTSC code is shown in grey. The PAL code is tested but as I don't have an NTSC machine I'm unable to test those bits. They should work.
Listings.This code provides ARP, TCP/IP and ICMP function enough to be PINGed and enough HTTP ability to serve the web content held in the ROM file system. The TCP implementation is as server only, there is no active open or close wait ability and supports only a single connection at a time, this may change.
One of the Vic's VIA timers is used to provide a millisecond clock, this allows the TCP state machine to time out gracefully, and is used to time the animation of the crawling dot in the bottom right of the Vic screen.
The first two IP address digits are fixed at 169.254 in the ROM but the last two digits are copied from the MAC address of the card. This means the same ROM code can be used in multiple Vics without changes, each machine getting it's IP address from the hardware without the worry of IP address conflicts.
This is not a finished product, it is presented as a starting point and as such is written with that in mind. This means the code could be shortened and sped up in many places but is left as is because the intention is clearer. E.g. adding the final carry back into the 16 bit checksum could be done thus ..
LAB_21980 BCC LAB_21990 ; exit if carry clear INC chksum_l ; increment checksum low byte BNE LAB_21990 ; exit if no overflow INC chksum_h ; increment checksum high byte LAB_21990But the intention is much clearer if it's done like this ..
LAB_21980 LDA chksum_l ; get checksum low byte ADC #$00 ; add any carry STA chksum_l ; save checksum low byte LDA chksum_h ; get checksum high byte ADC #$00 ; add any carry STA chksum_h ; save checksum high byte LAB_21990
The source is so long that it has been split into different sections. Some of these are more or less complete and unlikely to change, others are still under developement, yet more is not started yet. These sections will be added to and changed as the code progresses.
Vic startup The 3Com card Interrupts Main program loop ARP and packet transmit Web server files Whatever the state of the listings, you can always download the most recent binary image.
Last page update: 29th February, 2004. | e-mail me |