Jump to content

Photo

Using TIPI socket interface in assembler (was: copying E/A 3 problem)


25 replies to this topic

#1 Stuart OFFLINE  

Stuart

    Dragonstomper

  • 792 posts
  • Location:Southampton, UK

Posted Mon Sep 24, 2018 2:45 PM

I'm trying to get a small E/A 3 object file to Omega to test. I'm assembling it using Asm994a and I can load and run it fine using Classic99.

 

I tried sending a copy of this file to Omega to test; Omega copies the file from his PC to the TIPI with the TIPI's browser based transfer routine, like he does with other files. He tries to load it using E/A but gets I/O error 2.

 

Omega sends me an E/A 3 file which works for him for me to look at. It looks like it has a TI files(?) header on it. So I take my object file and use the Ti99Dir program "Convert PC File to TI File" command to convert the file, using the options file type "DIS/FIX", record length 80, "Remove CR and/or LF (EDITOR/ASM)". Omega isn't able to load this file either. I've attached a copy of this file.

 

What do I need to do to get the E/A 3 file to work?

Attached Files

  • Attached File  TIPI.zip   678bytes   8 downloads

Edited by Stuart, Wed Sep 26, 2018 5:13 PM.


#2 HOME AUTOMATION OFFLINE  

HOME AUTOMATION

    Star Raider

  • 96 posts

Posted Mon Sep 24, 2018 5:59 PM

When I use E/A option 3 in Classic99 "DSK2.TIPI" I hit enter... I get bumped to the EDITOR MENU!!!

When I use MININMEM option 1 in Classic99 "DSK2.TIPI" I hit enter... I get error 5. So I tried a second time (sometimes a bug in MINIMEM causes the first time to fail) and I got DUPLICATE DEFINITION... so I tried to run "START"  it seems to run!

 

"OPENING DEVICE: TIPI.TCP=WWW.CWFK.NET:80

... FAILED"

 

I'm not sure what any error codes are anymore... I try to avoid them. HA-HA...



#3 HOME AUTOMATION OFFLINE  

HOME AUTOMATION

    Star Raider

  • 96 posts

Posted Mon Sep 24, 2018 7:15 PM

Repeated the Above on real iron with TIPI online... same exact results...



#4 Tursi OFFLINE  

Tursi

    Quadrunner

  • 5,289 posts
  • HarmlessLion
  • Location:BUR

Posted Mon Sep 24, 2018 9:46 PM

Remember that Classic99 can translate /Windows text files/ into the TI display/variable format transparently - I don't think TIPI does this. And that's what Asm994a outputs - a Windows text file.

So if you want to use it through TIPI, I believe it needs to be converted to TIFILES format or copied to a TI disk image. You also need to make sure the file type is set correctly - compressed files are Display/Variable 80, and uncompressed files (which this is) are Display/Fixed 80.

The ZIP contains a V9T9 file, Display/Fixed 80, but I don't see the end record that an object file needs...? The last line of the file should start with a full colon ( : ), it appears that got lost somewhere in translation.

Since you are testing in Classic99 anyway, you could always just convert it there... load the file up in the Editor then save it back out with a new filename, and Classic99 will write the TIFILES version for you ;)


Edited by Tursi, Mon Sep 24, 2018 9:47 PM.


#5 PeteE OFFLINE  

PeteE

    Chopper Commander

  • 163 posts
  • Location:Beaverton, OR

Posted Mon Sep 24, 2018 11:00 PM

Remember that Classic99 can translate /Windows text files/ into the TI display/variable format transparently - I don't think TIPI does this. And that's what Asm994a outputs - a Windows text file.

So if you want to use it through TIPI, I believe it needs to be converted to TIFILES format or copied to a TI disk image. You also need to make sure the file type is set correctly - compressed files are Display/Variable 80, and uncompressed files (which this is) are Display/Fixed 80.

TIPI will translate some files based on the file extension, see here. But none of those extensions will enable reading as DF/80.

I tested the file on my TIPI through the web interface, it shows a TI icon with red ?, so I check the box next to in the "Select Action" menu choose "Convert v9t9 to TIFILES" and click Submit.  That makes the red ? go away, so tried loading it with E/A option 3 with file name TIPI.TIPI seems okay, but on the next screen doing 1 TO LOAD results in I/O ERROR CODE 0.


Edited by PeteE, Mon Sep 24, 2018 11:23 PM.


#6 arcadeshopper OFFLINE  

arcadeshopper

    River Patroller

  • 3,713 posts
  • Location:Portland, Oregon USA

Posted Wed Sep 26, 2018 11:03 AM

ok the file is v9t9 format and on the tipi it needs to be tifiles..so converting that to tifiles is first step.. 

ea option 3 it returns to the editor menu then if i hit back and select run then START for the start point it runs.. "opening device: TIPI.TCP=WWW.CWFT.NET:80 .. FAILED"

 

should't this be PI.TCP?  https://github.com/j...pi/wiki/Devices

 

Greg



#7 Stuart OFFLINE  

Stuart

    Dragonstomper

  • Topic Starter
  • 792 posts
  • Location:Southampton, UK

Posted Wed Sep 26, 2018 4:57 PM

Thanks all. Tursi's suggestion of loading the file in the E/A Editor in Classic99 then saving it again under a different filename did the trick!



#8 Stuart OFFLINE  

Stuart

    Dragonstomper

  • Topic Starter
  • 792 posts
  • Location:Southampton, UK

Posted Wed Sep 26, 2018 5:08 PM

 

should't this be PI.TCP?  https://github.com/j...pi/wiki/Devices

 

 

 Well yes, that's a question, and what I was hoping to find clear documentation for!

 

What I'm trying to do is reproduce what's in the video here (TIPI Does TCP - https://www.youtube....h?v=VpYcPHIbxU4) in assembler. That video shows (in BASIC) opening the device TIPI.TCP. So that's what I've tried doing (opening the device TIPI.TCP=WWW.CWFK.NET:80) using the standard PAB and DSRLNK call, and checking the equal bit in the status error to check if the DSRLNK completed successfully or not. So am I on the right track (although it seems to be failing) or do I need a different approach?


Edited by Stuart, Wed Sep 26, 2018 5:17 PM.


#9 jedimatt42 OFFLINE  

jedimatt42

    Stargunner

  • 1,814 posts
  • Location:Beaverton, OR

Posted Thu Sep 27, 2018 10:25 AM

Oops, yes the non-file stuff was moved from the TIPI. device to the PI. device.

The DSR approach is really just meant for BASIC integration.

For assembly or other languages take a look here: http://atariage.com/...-1#entry4099723

-M@

#10 BeeryMiller ONLINE  

BeeryMiller

    Dragonstomper

  • 655 posts
  • Location:Campbellsburg, KY

Posted Thu Sep 27, 2018 11:04 AM

I have uploaded in another area on Atariage some Mass Transfer source code that got the basics for communications in assembly.  I have also uploaded some more recent source files to 9640news.ddns.net:9640 in the Telnet area (MT201809??.ark) source files and images of the more recent code.  It is still not the latest code, but has most of the pieces.

 

It is probably not the cleanest piece of code, but I had to "mold" it to work with how Mass Transfer was written without destroying any other registers, etc in other workspaces.

 

I did learn that when you open a socket connection, you can set a longer URL:port length than the actual length is, AS LONG AS, it is spaces.  That made the phone directory much easier to implement so I did not have to determine length of URL string.  I just tell it to copy something like 50 characters, and tell the Open Command the length of the Open string is like 3 bytes + 50 bytes and all is well.

 

Beery


Edited by BeeryMiller, Thu Sep 27, 2018 11:07 AM.


#11 Stuart OFFLINE  

Stuart

    Dragonstomper

  • Topic Starter
  • 792 posts
  • Location:Southampton, UK

Posted Fri Sep 28, 2018 3:46 PM

Thanks all. I'll start again!



#12 Stuart OFFLINE  

Stuart

    Dragonstomper

  • Topic Starter
  • 792 posts
  • Location:Southampton, UK

Posted Sun Sep 30, 2018 4:25 AM

For assembly or other languages take a look here: http://atariage.com/...-1#entry4099723

-M@

 

Matt, a couple of questions as I haven't got a TIPI to test against.

 

(1) The open socket command.

 

-- Can I assume that if the specified host does not exist, the open socket command returns a value 0 'failed to connect'?

 

-- The command accepts text and dotted-decimal host addresses (www.bbc.co.uk and 12.456.789.1)?

 

-- I do a MOV @SENDMSG,R4 and BL *R4 to send the message (after setting up R0 and R1). How quickly after that does the Pi have the return value available? Can I immediately prepare R0 and R1 and call the RECVMSG routine? Does the receive routine block until the send command has completed? Or do I need to faff around changing the workspace and resetting/setting the CRU bit to give time for the send command to complete?

 

-- If I don't 'receive' the return value (for any open/close/write command), does that cause any problem with the next command?

 

(2) The write command. An HTTP GET request comprises multiple lines, each terminated with a >0D >0A. Can these be sent as separate, multiple write commands, followed by a read command for the response? Or does the GET request have to be a single write command?

 

(3) The read command. After writing an HTTP GET request, do I need to send a read command and check the length returned in GPLWS R0, and loop (need to repeatedly send the read command, or just call RECVMSG?) until this is greater than zero?

 

Thanks!


Edited by Stuart, Sun Sep 30, 2018 6:09 AM.


#13 BeeryMiller ONLINE  

BeeryMiller

    Dragonstomper

  • 655 posts
  • Location:Campbellsburg, KY

Posted Sun Sep 30, 2018 2:55 PM

Stuart, The open connection is immediately ready for the RECVMSG to know if you got a connection.

Beery

#14 Stuart OFFLINE  

Stuart

    Dragonstomper

  • Topic Starter
  • 792 posts
  • Location:Southampton, UK

Posted Mon Oct 1, 2018 12:43 PM

Stuart, The open connection is immediately ready for the RECVMSG to know if you got a connection.

Beery

 

Thanks Beery. How did you go about checking if there was data ready to be read?



#15 BeeryMiller ONLINE  

BeeryMiller

    Dragonstomper

  • 655 posts
  • Location:Campbellsburg, KY

Posted Mon Oct 1, 2018 1:37 PM

 

Thanks Beery. How did you go about checking if there was data ready to be read?

 

It is not so much as checking to see if data is ready to be read, but rather, checking to see if something is present.  That is where it is a bit different from serial communications.  With serial, you would know something is there before you read it.  With the TIPI, you read it and see if you got anything back.  Downside with the TIPI in this respect is the character receive throughput can be slower than the RS232.  The upside is, you do not have to worry about ever dropping a character because you were running a longer subroutine doing other processing elsewhere.

 

I check for a single byte and process it if one is there.  If I am in an XMODEM routine, I check the length returned.  It is either >00 or >01.  If it is >00, I continue requesting a read and wait until it is a >01.  If I am at a menu, I read the TIPI and I read the keyboard waiting for someone to make the next move.

 

The nice thing about the TIPI and the PI, is it buffers the string.  So, if you were to say ask for a 1 MB text file with no pausing, you are going to get the full file scrolled to you that you have to process from the TIPI/PI buffer.  There may be a way to interrupt that with some Telnet IAC codes, but I am not sure.

 

Beery



#16 jedimatt42 OFFLINE  

jedimatt42

    Stargunner

  • 1,814 posts
  • Location:Beaverton, OR

Posted Tue Oct 2, 2018 8:22 AM

All communication with the TiSocket service is sendmsg, recvmsg, pairs, and recvmsg will block until the PI sends a msg.  So, yes you can jump right into the response handling. 

 

The backing service code is super simple:  https://github.com/j...ces/TiSocket.py

 

Requesting a read data, as will send whatever data is queued up via the lower level socket buffer. So as Beery said, poll for data, and it is ok if the response is an empty buffer.

 

Speaking of buffers, yes, there is considerable overhead to be using this API for single byte read.  Use a fetch buffer on the 4A side to grab many bytes in one call... then if your fetch buffer isn't empty, loop over and process your single bytes from that fetch buffer.  

 

-M@



#17 Stuart OFFLINE  

Stuart

    Dragonstomper

  • Topic Starter
  • 792 posts
  • Location:Southampton, UK

Posted Tue Oct 2, 2018 8:33 AM

 

Requesting a read data, as will send whatever data is queued up via the lower level socket buffer. So as Beery said, poll for data, and it is ok if the response is an empty buffer.

 

 

Thanks Matt. Polling for read data - do I need to:

 

send read command 

do receive message and check length

send read command 

do receive message and check length

send read command 

do receive message and check length

etc.

 

or

 

send read command 

do receive message and check length

do receive message and check length

do receive message and check length

do receive message and check length

etc.

 

When receiving a web page that could be several kilobytes, is there any guarantee that I'll receive it all through the one read? Or once I've got data, do I need to do multiple reads (adding any further data to my buffer) until a read returns a length of zero?



#18 arcadeshopper OFFLINE  

arcadeshopper

    River Patroller

  • 3,713 posts
  • Location:Portland, Oregon USA

Posted Tue Oct 2, 2018 12:30 PM

 

Thanks Matt. Polling for read data - do I need to:

 

send read command 

do receive message and check length

send read command 

do receive message and check length

send read command 

do receive message and check length

etc.

 

or

 

send read command 

do receive message and check length

do receive message and check length

do receive message and check length

do receive message and check length

etc.

 

When receiving a web page that could be several kilobytes, is there any guarantee that I'll receive it all through the one read? Or once I've got data, do I need to do multiple reads (adding any further data to my buffer) until a read returns a length of zero?

 

pretty sure its until it returns a length of zero 

 

I wrote this program in basic 

 

1 !T80XB high memory version   by Harry Wilhelm
2 CALL INIT :: CALL LOAD(8192,255,178):: CALL LINK("T80ON"):: RUN 3
3 !@P+
4 INPUT "WEBPAGE HTTP://":F$
5 CALL LINK("T80")
6 DIM A$(255)
9 O$="PI.http://"&F$
10 OPEN #1:O$,INPUT ,VARIABLE 128
20 ON ERROR 50
21 D=D+1
30 INPUT #1:A$(D)
40 GOTO 20
50 FOR A=1 TO D
60 CALL LINK("PRINT",A,1,A$(A))
70 NEXT A
1000 INPUT "done":B$

 

its got the 80column xb thing from Harry which is where the call link came from to display.. anyway you can see I'm just pulling data until it errors 



#19 Stuart OFFLINE  

Stuart

    Dragonstomper

  • Topic Starter
  • 792 posts
  • Location:Southampton, UK

Posted Thu Oct 4, 2018 9:33 AM

I've now got a working example of using the TIPI socket interface to download a web page (and big thanks to Omega for testing many iterations of the code on his TIPI setup). I have a query though over opening a socket to an invalid host ...

 

I've (temporarily) set up the TIPI calls so the 'open socket' command is to an invalid host, and the 'write socket' command is an HTTP GET request to a valid host and a valid web page. I was expecting the open socket command to fail, but it succeeds, and the response to the GET request is a valid page with a 'refresh' link to a page at http://webhelper/centurylink.com. So I'm wondering if:

 

(1) Whether the open socket command always reports as succeeding (that is, the command itself was processed successfully even though the specified host was invalid).

or

(2) Omega's ISP is intercepting the open socket request, reporting it as OK, and redirecting further requests to this webhelper page.

 

Any ideas?



#20 jedimatt42 OFFLINE  

jedimatt42

    Stargunner

  • 1,814 posts
  • Location:Beaverton, OR

Posted Fri Oct 5, 2018 8:07 AM

That would be a redirect by the ISP DNS server in support of advertising by the ISP... shame on them!

 

-M@



#21 Stuart OFFLINE  

Stuart

    Dragonstomper

  • Topic Starter
  • 792 posts
  • Location:Southampton, UK

Posted Fri Oct 5, 2018 3:40 PM

Thanks Matt.

 

My code is here (http://www.stuartcon...ocket_interface), should anyone find it useful in the future. Now to incorporate it into my TI Browser ...



#22 BeeryMiller ONLINE  

BeeryMiller

    Dragonstomper

  • 655 posts
  • Location:Campbellsburg, KY

Posted Tue Oct 9, 2018 3:29 PM

Thanks Matt.

 

My code is here (http://www.stuartcon...ocket_interface), should anyone find it useful in the future. Now to incorporate it into my TI Browser ...

 

Stuart,

 

I started to look at some FTP specs, and started to wonder if your Browser could TI browser may be able to browse ftp.whtech.com and possibly do a "file save" so uses could transfer files?

 

That would be a heck of an accomplishment if your code could pull that off.  The Mass Transfer Telnet client I uploaded a week or so ago has the source code for the XMODEM routine in it. I'm not saying use the XMODEM protocol, however, it does have code for calling the specific DSR routines for file saving.

 

Just a thought.

 

Beery



#23 Stuart OFFLINE  

Stuart

    Dragonstomper

  • Topic Starter
  • 792 posts
  • Location:Southampton, UK

Posted Tue Oct 9, 2018 4:56 PM

I did think about including some sort of file download functionality, but the problem is that each new feature reduces the size of web page that can be downloaded and displayed. So the only practical way to do it would be some sort of code overlay facility, where the browser loads some overlay code to handle file downloads, and that then reloads the browser code when the file download is complete. And that gets very time consuming to do when trying to support disk- and cartridge-based version of the browser. One day maybe ...



#24 BeeryMiller ONLINE  

BeeryMiller

    Dragonstomper

  • 655 posts
  • Location:Campbellsburg, KY

Posted Tue Oct 9, 2018 6:52 PM

Stuart,

 

I have no idea what is involved with your code management.  Mentally, I was just picturing the most basic of "browser" functions that would display a page/directory, and then a point/click/etc to mark a file for transfer.  I would have thought the DSR code for file saving would have been 2 to 4 K.  I can see where buffering filename/sizes, especially quite a few if there were many on a ftp web page could be extensive consuming a lot of memory.  Perhaps one could buffer the page on a TIPI.TEMP. directory for the scrolling up and down.

Anyways, just thinking out loud not knowing what all is involved.

 

Web browsing is definitely a PLUS!

Beery



#25 --- Ω --- OFFLINE  

--- Ω ---

    HexaCoreRunner

  • 12,831 posts

Posted Sat Oct 13, 2018 5:49 AM

SmallWavingHappy.gif   Just peeking in to see if anything new has been developing...






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users