I’ve got a rough skeleton of the TCP code working (for outbound connections only). That means TCP segments are sequenced correctly, ACKs are sent when appropriate, and duplicate TCP packets are discarded. I don’t think I’ve quit got the handling of FINs correct, and I’m sure there’s a few other bugs in there, but it is at least at the point where I can connect to port 80 of a webserver, send a GET request, and dump a few KB of raw HTML to the screen.
I’m definately doing this a lot easier than a 6502 hacker would have back in the day. Probably the most significant advantage is the editing tool – I use the SciTE IDE (which comes with Ruby). I don’t have syntax highlighting set up, but I’d find it very painful to not be able to have multiple tabs & windows at once, plus find/replace. Also, when it comes to understanding what a big messy hunk of code does, it makes a huge difference how much of it you can see at once - SciTE on my laptop gives 40 lines of 100+chars. compared to 24 lines of 40 chars each on a real 64.
Also by using CA65 + make + some batch files to call Vice, the time from making a change to the source code to seeing the code run is seconds, vs tens of minutes if I was working on the real thing. Effectively I am able to see the effects of code changes “in real time” - turnaround times that were only possible in BASIC when these 8 bit machines were around. Which is about the only nice thing that can be said about 8 bit BASIC . As much as I am enjoying relearning 6502 assembler, and as much fun as I had PEEKing, GOSUBing and FOR-NEXTing in the mid 80s, I have no desire whatsoever to read or write code with meaningless variable names and subroutines referenced by numbers.
Now that I think about it, the original 8-bit assemblers had much more meaningful identifiers, and more legible comments, and hence (I suspect) more maintainable source code than a typical pre-90s era BASIC did.
Case in point – here is the first 6 lines from a Memory Game for the Tandy Color Computer (picked at random via the Peekbot Random Listing feature)
10 GOTO1380
20 CLS0:CLEAR200:DIMS(12,12),F(24),PP(24):T=RND(-TIMER):B$=STRING$(4,32)
30 'title page
40 FORT=1024TO1055:POKET,159:POKET+480,159:NEXT:FORT=1056TO1472STEP32:POKE
T,159:POKET+31,159:NEXT:FORT=1090TO1117:POKET,255:POKET+352,255:NEXT:FORT=
1122TO1442STEP32:POKET,255:POKET+27,255:NEXT
50 T$="MEMORY GAME":FORT=1TOLEN(T$):POKE1187+T*2,ASC(MID$(T$,T,1))AND63:
PLAY"L255CDEF":NEXT
60 T$="BY * BOB VAN DER POEL":FORT=1TOLEN(T$):POKE1381+T,ASC(MID$(T$,T,1))
AND63:PLAY";"+STR$(RND(12)):NEXT
WTF? The comment gives a clue that this is a title page, but there’s so much packed into each line, and so many variables with meaningless names, my brain hurts thinking about how you would make changes.
Compare this to an extract from the 6502 assembler from Mrs Pacman (one of many Atari 7800 game sources recently released) . It may or may not help to know that in 6502 assembler ”JSR” is “Jump to SubRoutine” (i.e. call subroutine), “LDX” means “LoaD the X register with the following value”, “INX” means “Increment the X register”, “CPX” means “Compare the X register with the following value” and “BMI” means “Branch (jump to) the specified location if the result of the previous comparison was a negative number”.
* TITLE.S ROUTINES TO CONTROL THE TITLE PAGE
* THIS IS THE ENTRY ROUTINE. IT DOES ALL THE WORK.
DOTITLE JSR TITLESET ;DO BASIC SETUP
JSR INITSTMP ;INITIALIZE THE STAMPS
LDX #$00
DTLOOP JSR WRTNAME ;WRITE THE MONSTER'S NAME
JSR TMOVEMON ;MOVE THE MONSTER
INX ;GET THE NEXT ONE
CPX #$04
BMI DTLOOP
JSR WRTPNAME ;WRITE MS PAC-MAN'S NAME
JMP TMOVEPAC ;MOVE HER
So yeah, BASIC sux0rs, ASM rux0rs.
Anyway, making reasonable progress, might raise the bar a bit and aim for a gopher client by kfest.