Jump to content
IGNORED

DSRLINK Code Tutorial


TheBF

Recommended Posts

11 hours ago, Lee Stewart said:

       LI   R0,VDPPAB+9
       LI   R1,COUNT  * Note that this will load the address of COUNT, not the content, in R1
       MOVB @COUNT,R1   * This will work, though, to get the file name length into the PAB in VDP RAM
       BLWP @VSBW     * Then send the most significant byte of the address to the PAB in VDP RAM 

       LI   R0,VDPPAB+10
       LI   R1,FLNM
       CLR  R2
       MOVB @COUNT,R2
       SWPB R2            count byte to LSB
       BLWP @VMBW

 

Here's my suggestion how to move the filename, when it has been updated by user input, to VDP RAM.

* Here's a piece of code which is equivalent to what the above one should have accomplished (at least that's what I think)

       LI   R0,VDPPAB+9	* Writes only the length and file name
       LI   R1,COUNT	* Fetch it starting from COUNT (which should be the tenth byte in the PAB in CPU RAM)
       MOVB *R1,R2		* Get the value of the count, make it 16-bit and add one, to account for that not only the file name, but also the count itself, should be transferred
       SRL  R2,8
       INC  R2
       BLWP @VMBW

 

Edited by apersson850
  • Like 2
Link to comment
Share on other sites

I'll get the data into position first, as I need only 128 bytes in the buffer as pointed out instead of 1028. 

I'll make sure I have a routine that provides that buffer constantly with a call to DSRLNK to process it in-between.

 

And once I get that working, up to the call to DSRLNK, then I'll work on getting the FLNM, (filename),and COUNT (length of filename), pushed into VRAM PAB.

I'll probably use a simpler formula but I understand I need to do what @APERSSON850 is suggesting.

  • Like 1
Link to comment
Share on other sites

I'm not much for providing ready code to people trying to learn programming. They just use it, but never understand it. However, the code I did provide above, to move the count and file name into the PAB in VDP RAM, is only six instructions long. Use that. It's about as simple as it gets. You have to define the PAB image in CPU RAM correctly first, of course. Please put that piece up here when you've done it, so we/I can verify that you fully understand that before you proceed. Otherwise your problems will be eternal.

  • Like 2
Link to comment
Share on other sites

On 11/2/2020 at 7:43 PM, GDMike said:

I might be making things worse but to make things clearer you could consider laying out your CPU RAM image of the PAB so that it is easy to remember what is what.

Use the CPU PAB as a mirror image of the VDP PAB. Use the mirror for all control and copy it into VDP RAM before calling dsrlink

This is nice and it does break each piece down to little sections, but I still don't know how I'd use it?

You said when I've got it setup then blast it to vdp. I still need an example. So I can actually see what is going on. 

Btw, it's a 128 byte record length not 80. 

Doesn't matter, I see the setup. 

I do like this approach. 

Could you create an artificial write of 128 bytes of code that's sitting at >1000 VDPRAM for me whenever you have time.

Then everything might click. Thank you.

 

 

Link to comment
Share on other sites

Let's see if this clicks, then.

Now you are doing something like this.

 

prepare general PAB in CPU RAM;

write PAB to VDP RAM;

do things;

update filename and length in PAB in VDP RAM;

do things;

update opcode in PAB in VDP RAM;

do things;

update record number in PAB in VDP RAM;

do things;

call DSRLNK;

 

Writing to VDP RAM is complex and takes time, compared to changing things in CPU RAM. So the suggestion is to do like this instead.

 

prepare general PAB in CPU RAM;

do things;

update filename and length in PAB in CPU RAM;

do things;

update opcode in PAB in CPU RAM;

do things;

update record number in PAB in CPU RAM;

do things;

write PAB to VDP RAM;

call DSRLNK;

 

With this strategy, you only mess with moving the PAB to VDP RAM once per DSRLNK call, instead of updating small pieces of it ever so often. You still update pieces of it, but in CPU RAM most of that is a simple MOV or MOVB. No need to BLWP the VDP data transfer routines each time.

It does mean that some parts you'll copy in spite of them not being changed, but due to the overhead for each small transfer, it's probably faster anyway, and definitely simpler.

Edited by apersson850
  • Like 7
  • Thanks 1
Link to comment
Share on other sites

  • 2 months later...

I noticed that in ti basic and with no controller card installed, I can create a file anyway - on tipi by the basic code

Open #1:"DSK4.FILE", output, fixed 128

Print#1:A$

Close #1

Is that function not available in assembly?

I seemed to have been able to create a PAB and the PAB Address

Placed the pab in ram

And called DSR Subroutine which is

Setting the pointer and calling dsrlnk and data 8.

I don't get an error message but the file doesn't get created either.

So I'm assuming I have to have a controller card.

 

Edited by GDMike
Link to comment
Share on other sites

@BeeryMiller I'm going to submit my NEW Assy code, it's much cleaner and has comments. And let you see..I'll do that tomorrow morning..

Once I master this I'll be able to implement it into SNP as I know how to get the data to the DSR. Just need a little help now with the DSR.

I would like to use the file type:

Display fixed 120 BUT I could make it all work with Display Variable 80 also. It's just less work with the 120 type. 

 

Edited by GDMike
Link to comment
Share on other sites

 @BeeryMiller, here are the files.

DSRS is your main source file.

It expects chars and subrs(source files) to be in another directory when compiling.

So make your changes to the DSRS beginning code routine to have them in a directory of your choice.

Everything seems to work until you get to the

CONT label.

It's near the EOF of the source code DSRS .

That is where the call to DSR comes in and pretty much everything is happening near that CONT label.

 

 

 

CHARS DSR DSRS SUBRS

Edited by GDMike
Link to comment
Share on other sites

You should not need a controller card to create a file.

 

Next question is have you conducted any error checking after the open, write, and close?  As you are doing this on the TIPI. look at the TIPI.log file and look at the last lines of the log file right after you run your routine.  That will tell you if your OPEN, WRITE, and CLOSE code is being executed by the TIPI and/or if there are errors.

 

I use a program like WinSCP to log into the TIPI using my local host name.  Your should be something like 192.168.1.xxx or something else similar depending upon your router.  That TIPI log can be very informative if something isn't behaving the way you think it should be.

 

Beery

 

  • Like 1
Link to comment
Share on other sites

9 minutes ago, BeeryMiller said:

You should not need a controller card to create a file.

 

Next question is have you conducted any error checking after the open, write, and close?  As you are doing this on the TIPI. look at the TIPI.log file and look at the last lines of the log file right after you run your routine.  That will tell you if your OPEN, WRITE, and CLOSE code is being executed by the TIPI and/or if there are errors.

 

I use a program like WinSCP to log into the TIPI using my local host name.  Your should be something like 192.168.1.xxx or something else similar depending upon your router.  That TIPI log can be very informative if something isn't behaving the way you think it should be.

 

Beery

 

I only have internal DSR error checking relating to the DSR program.

Edited by GDMike
Link to comment
Share on other sites

10 hours ago, GDMike said:

 @BeeryMiller, here are the files.

DSRS is your main source file.

It expects chars and subrs(source files) to be in another directory when compiling.

So make your changes to the DSRS beginning code routine to have them in a directory of your choice.

Everything seems to work until you get to the

CONT label.

It's near the EOF of the source code DSRS .

That is where the call to DSR comes in and pretty much everything is happening near that CONT label.

 

 

 

CHARS 16.38 kB · 3 downloads DSR 7.88 kB · 2 downloads DSRS 11.38 kB · 2 downloads SUBRS 1.63 kB · 2 downloads

I'm briefly looking at your code in DSRS shown below.  You are moving a READ byte rather than a WRITE byte into your PAB.  I have not tested any reassembly, but at first glance, that is where I would start.

 

WRITEF CLR  R5
       LI   R3,>3000
       LI   R4,>F80
WF     MOV  *R3+,*R4+
       INC  R5
       CI   R5,25
       JNE  WF

        MOVB @READ,R1
       LI   R0,PAB
       BLWP @VSBW
       BL   @DSR
  
       MOVB @CLOSE,R1
       BLWP @VSBW
       BL   @DSR
 
       B    @STP
 

  • Like 1
Link to comment
Share on other sites

4 minutes ago, BeeryMiller said:

INC  R5
       CI   R5,25

Also should be 60, but it'll all change to however you make it work, nearest to 120 count, I could also make use of dv 80, just have to add more looping. If you want to shoot for a DV 80.

Edited by GDMike
Link to comment
Share on other sites

8 hours ago, BeeryMiller said:

Try  reassembling  your project using the WRITE instruction instead of the READ instruction along with whatever other code changes if you want to write something to the TIPI and report back.

 

I changed to a write and made sure I set the pab:

PAB DATA >0002,BUFADR,>7878,>0000,0009

For a display fixed 128 file type

And made sure to do a write and changed my count to 60 in my loop as I move a word at a time to VDP RAM.

I did NOT receive an error this time.

And got garbage all over the screen.

My PAB ADDRESS is still EQU>079E

My BUF ADDRESS is still >F80

No file created.

 

IMG_20210122_153847945.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...