________._______________ ________ .------------------. / _____/| ____/\ _ \ \_____ \ |.----------------.| / __ \ |____ \ / /_\ \ / ____/ || beebs.ddns.net || \ |__\ \/ \\ \_/ \/ \ || || \_____ /______ / \_____ /\_______ \ || Welcome to || \/ \/ \/ \/ || BeeBS || 6502 Assembly Projext #2 || ~ || A simple HTML Downloader for your BBC Micro ||________________|| |-[CUB]---------[]-| '------------------'

____ ____ ____ ____ ____ ||I |||n |||t |||r |||o || ||__|||__|||__|||__|||__|| |/__\|/__\|/__\|/__\|/__\| After the "success" of the BBS dialer, I looked in to using TcpSer to do Telnet GET HTTP requests and was pleasantly surprised to see that it both sent and received the request. Essentially to download the HTML of a page the following is sent over telnet (usually using port 80): || GET / HTTP/1.1 || Host: www.site.com || Connection: Close Case is important, as are the spacing and each line must end with LFCR (10,13) with the last line ending with two (i.e. LFCRLFCR). The final line (Connection: Close) isn't strictly necessary however does close the TcpSer "call" after the page has been received. The / in GET / HTTP/1.1 can be replaced with the file you're looking for e.g. /pictures/kittens.html ____ ____ ____ ____ ____ ||U |||s |||a |||g |||e || ||__|||__|||__|||__|||__|| |/__\|/__\|/__\|/__\|/__\| Sprow (http://www.sprow.co.uk/) had created a HTML renderer for the BBC Micro that can run from rom. It supports basic formatting, but due to the Beebs limitations (no bold, no underlined, no italics, and only mono 80 column modes). It's not a browser, instead it just displays HTML files in a readable format...once you have a file to display that is. Which is where this program comes in handy. Using *web www.address.com you can scrape the HTML from the page to a file which then loads up in WEBBC (Sprows viewer). ____ ____ ____ ____ ____ ||N |||o |||t |||e |||s || ||__|||__|||__|||__|||__|| |/__\|/__\|/__\|/__\|/__\| A few caveats with this program. Firstly my TcpSer setup is always set to 19200 baud, so that is the speed it is fixed at. This solution really only works with the Web 1.0 world (I'd recommend Wiby.org as a good Web 1.0 search engine). For SSL support I have created a second version which requires you to be running WebOne Proxy (https://github.com/atauenis/webone), in this instance it "dials" the proxy server and then send the website request in GET and Host: E.g. || ATDT You.rProx.ySer.ver:8008 || GET /pictures/kittens.html HTTP/1.1 || Host: www.thecatsite.com || Connection: Close I'm hoping to expand on this to create a Web 1.0 browser for the Beeb. ____ ____ ____ ____ ____ ____ ____ ||L |||i |||s |||t |||i |||n |||g || ||__|||__|||__|||__|||__|||__|||__|| |/__\|/__\|/__\|/__\|/__\|/__\|/__\|

addr = &70 cmdline = &5000 filename = &5050 channel = &5060 osasci = &ffee ;not osasci is oswrch but fixes the crlf problem osargs = &ffda osword = &fff1 osbyte = &fff4 osfind = &ffce osbput = &ffd4 serial = &fe09 ORG &2000 .start ;get params lda #1 ldy #0 ldx #addr jsr osargs .rdcmdlp ;store params in cmdline tya pha LDX #addr LDY #0 LDA #5 JSR osword ;read byte from i/o memory PLA TAY LDA addr+4 STA cmdline,Y INY ;copy byte of commandline to buffer INC addr BNE rdcmdnxt INC addr+1 ;increment command line address .rdcmdnxt CMP #13 BNE rdcmdlp ;Loop until cr .init ldx #2 ;set serial port to listening lda #&02 jsr &fff4 LDY #0 LDX #0 .temp ;load temp in to filename LDA file_name, X STA filename,X INX CMP #0 BNE temp .open_file ;open file temp for writing and store channel in channel lda #&80 ldy #filename DIV256 ldx #filename MOD256 JSR osfind STA channel LDX #0 .dial ;Dial ATDT to serial port lda atdt, X CMP #0 BEQ end_dial sta serial INX JMP dial .end_dial LDX #0 ;Reset X and Y LDY #0 .dial_address ;Append ATDT with address LDA cmdline, X sta serial INX CMP #13 BNE dial_address LDX #0 .dial_telnet ;Send GET / HTTP/1.1 lda telnet, X CMP #0 BEQ end_telnet sta serial INX JMP dial_telnet .end_telnet LDX #0 .dial_addtwo ;type address for host LDA cmdline, X sta serial INX CMP #13 BNE dial_addtwo ;append Host: with address LDA #13 sta serial LDA #10 sta serial LDA #13 sta serial LDA #10 sta serial .display_header ;Display header response jsr get_serial ;cmp #60 ;BEQ save_serial JSR osasci ldy channel Jsr osbput JMP display_header .get_serial ldx #1 lda #145 jsr &fff4 tya bcs get_serial rts .save_serial JSR osasci LDY channel JSR osbput LDA #128 LDY #&FF LDX #254 JSR osbyte CPX #0 BEQ end JSR get_serial .atdt EQUS "ATDT",0 .telnet EQUS "GET / HTTP/1.1",13,10,"Host: ",0 .file_name EQUS "temp",13,0 .end