Jump to content
IGNORED

Supernotes


GDMike

Recommended Posts

12 minutes ago, GDMike said:

Originally, I had issues not saving and reastsablishing R11. So I got into a habit of making sure not to lose R11.

I was thinking, later maybe someone would go back through and fix things like that, I'm not sure about. Thx

That's what stacks are for, my friend! ?

Or in assembly, you can chain workspaces via the BLWP & RT instructions - which is really nice, because each subroutine gets a bunch of registers (ostensibly R0 to R11 inclusive) to themselves.

  • Like 2
Link to comment
Share on other sites

I try to resolve my BL routines before having to BL to another., Or that's my intention.

I get confoosed easily and don't need to be branching everywhere from BL routine to another... yikes

I'm gonna need more years on my grey head for that. While, you all might be ok, I'm sure my program would just die.

Edited by GDMike
Link to comment
Share on other sites

Lee, in the meantime while you have that code, I'm going to rem out SAMs use in label CCREST routine and check for lockup. I suppose if I don't lock, it's going to be related to my SAMs use in MAPPG.

BTW, file SNPS3 has the label and routine called from getkey, for page up and down. It's here that start the process of my lockup in CCREST, in file SNPS.

Edited by GDMike
Link to comment
Share on other sites

So apparently I was doing a

BL @ MAPPG from a routine that itself was called by a BL.. the same exact thing that @Stuart warned me of earlier.

When Lee discovered this I was in total embarrassment.?

And I looked over that code at least a hundred times and didn't see it.

I think because the routine already existed and I just added the mapping routine to it and didn't even think about the branch of the link going on, as I was more interested in getting the mapping to work.

Hats off to Lee Stewart again with a great eye!!

 

And thank you again Lee Stewart and others you know who you are for helping me get the SAMS working. @thebf,@automotion

 

Tested at, what? 1:23am

Works great!!

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

So... wanna jump into the world of having your own stack? :) 

 

You just need one dedicated register, a tiny chunk of memory somewhere at the top of memory and some simple rules:

  1. ALL sub-routines have a little "entry code" (which you already do)
  2. All sub-routines exit with 2 instructions. (which you do now as well


    Code is untested but it gives you the concept.  It's really not much more that you do now and waaaay more flexible. You will probably never nest deeper than 3 or 4 levels but its there when you need it.
* Example of using a stack for nesting sub-routines
****************************************************

* make the stack at the beginning of your program
STACK  EQU  FF00            Put somewhere in HI RAM, it grows down from here. 
                            (32 bytes nests 16 BL levels) 
                             
SP     EQU  R10             R10 is our stack register so rename it.
       LI   R10,STACK       R10 now holds the stack address.

* EXAMPLE: MAP3K is now nestable (call it from other sub-routines)
BANK   DATA 0000

**** NEW ENTRY CODE, 2 instructions ****
MAP3K  DECT SP             make room on the stack
       MOV R11,*SP         PUSH R11 onto the stack
       
* run your code
       LI   R12,>1E00      CRU address of SAMS
       SBO  0              Turn on SAMS card 
       MOV  @BANK,@4006    move the BANK we want into the register for CPU addr >3000
       SBZ  0              Turn off SAMS card

* new EXIT CODE
       MOVE *SP+,R11       POP old R11 from the stack            
	   RT                  return safely from your sub-routine :)
	   
* CALL MAP3K  is same as before but safe to call from any sub.
       LI R1,45
       MOV R1,@BANK
       BL @MAP3K

 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

25 minutes ago, TheBF said:

So... wanna jump into the world of having your own stack? :) 

 

You just need one dedicated register, a tiny chunk of memory somewhere at the top of memory and some simple rules:

  1. ALL sub-routines have a little "entry code" (which you already do)
  2. All sub-routines exit with 2 instructions. (which you do now as well


    Code is untested but it gives you the concept.  It's really not much more that you do now and waaaay more flexible. You will probably never nest deeper than 3 or 4 levels but its there when you need it.

* Example of using a stack for nesting sub-routines
****************************************************

* make the stack at the beginning of your program
STACK  EQU  FF00            Put somewhere in HI RAM, it grows down from here. 
                            (32 bytes nests 16 BL levels) 
                             
SP     EQU  R10             R10 is our stack register so rename it.
       LI   R10,STACK       R10 now holds the stack address.

* EXAMPLE: MAP3K is now nestable (call it from other sub-routines)
BANK   DATA 0000

**** NEW ENTRY CODE, 2 instructions ****
MAP3K  DECT SP             make room on the stack
       MOV R11,*SP         PUSH R11 onto the stack
       
* run your code
       LI   R12,>1E00      CRU address of SAMS
       SBO  0              Turn on SAMS card 
       MOV  @BANK,@4006    move the BANK we want into the register for CPU addr >3000
       SBZ  0              Turn off SAMS card

* new EXIT CODE
       MOVE *SP+,R11       POP old R11 from the stack            
	   RT                  return safely from your sub-routine :)
	   
* CALL MAP3K  is same as before but safe to call from any sub.
       LI R1,45
       MOV R1,@BANK
       BL @MAP3K

 

Ok. I see it.will do on future, OR after I go back through this one day. Makes sense now. Hmm. Maybe I'll try it here after I get a window. 

If done earlier, it could of saved some face. :)

Edited by GDMike
  • Like 1
Link to comment
Share on other sites

3 hours ago, GDMike said:

Ok. I see it.will do on future, OR after I go back through this one day. Makes sense now. Hmm. Maybe I'll try it here after I get a window. 

If done earlier, it could of saved some face. :)

4 hours ago, TheBF said:

So... wanna jump into the world of having your own stack? :) 

 

You just need one dedicated register, a tiny chunk of memory somewhere at the top of memory and some simple rules:

  1. ALL sub-routines have a little "entry code" (which you already do)
  2. All sub-routines exit with 2 instructions. (which you do now as well


    Code is untested but it gives you the concept.  It's really not much more that you do now and waaaay more flexible. You will probably never nest deeper than 3 or 4 levels but its there when you need it.

* Example of using a stack for nesting sub-routines
****************************************************

* make the stack at the beginning of your program
STACK  EQU  FF00            Put somewhere in HI RAM, it grows down from here. 
                            (32 bytes nests 16 BL levels) 
                             
SP     EQU  R10             R10 is our stack register so rename it.
       LI   R10,STACK       R10 now holds the stack address.

* EXAMPLE: MAP3K is now nestable (call it from other sub-routines)
BANK   DATA 0000

**** NEW ENTRY CODE, 2 instructions ****
MAP3K  DECT SP             make room on the stack
       MOV R11,*SP         PUSH R11 onto the stack
       
* run your code
       LI   R12,>1E00      CRU address of SAMS
       SBO  0              Turn on SAMS card 
       MOV  @BANK,@4006    move the BANK we want into the register for CPU addr >3000
       SBZ  0              Turn off SAMS card

* new EXIT CODE
       MOVE *SP+,R11       POP old R11 from the stack            
	   RT                  return safely from your sub-routine :)
	   
* CALL MAP3K  is same as before but safe to call from any sub.
       LI R1,45
       MOV R1,@BANK
       BL @MAP3K

 

It will definitely get filed in my notebook! Uh, of things NOT to forget.

Link to comment
Share on other sites

SNP assy ver update:

With S.A.M.S. working and SNE cartridge import working now, I've got two items to complete.

1. PSX routine. This is all about saving SNP pages from 1-???, Hasn't been determined yet, into SAMS memory. Should be a piece of cake.

 

2. Ability to save SNP pages to Disk

    This I'm not toooo worried.. but I'll tackle it very very soon it looks like.

 

 

  • Like 2
Link to comment
Share on other sites

Time to start planning"DSR" calculations

I think!! Oh by the way I need to change the autosave to reset after page changes. Ooops

One thing leads to another in this biz.

Is it possible to setup the DSR for forth compatibility?

I want to be able to load via forth and SNP..

Edited by GDMike
Link to comment
Share on other sites

14 hours ago, GDMike said:

Is it possible to setup the DSR for forth compatibility?

I want to be able to load via forth and SNP..

 

Not certain what you mean here. Forth can do whatever you are doing in Assembler, excepting, of course, the cartridge Forths—unless you dispense with the Supercart. You cannot have two cartridges operating at the same time.

 

...lee

  • Like 1
Link to comment
Share on other sites

2 hours ago, Lee Stewart said:

 

Not certain what you mean here. Forth can do whatever you are doing in Assembler, excepting, of course, the cartridge Forths—unless you dispense with the Supercart. You cannot have two cartridges operating at the same time.

 

...lee

Sorry, was dozy when I asked..

I want to be able to setup my save/load file structure so that if I'm in Forth, and in the forth editor, I'd like to be able to read from a SNP saved file. Given that I previously saved it with forth blocks file name.

 

As if, I'm in SNP, and I save a text page as DSK#.BLOCKS then read it via forth, given the length is 16X64 of my saved file.

Id like to use SNP as a substitute editor, but I'd like to also have The ability to save the same file as DV80 but definitely not on the same media or at the same time.

Does that make better sense?

Thx

 

 

 

Edited by GDMike
Link to comment
Share on other sites

Assy SNP , file handling:

I'm ready, I suppose.. nervously...

BUT...I'm wanting to create a file structure. Of course, the fastest load/save times.

It's going to be TEXT, no compiled code.

DV 80 isn't written in stone that it serves text files only, as I may have to break a rule. I don't really mind the output being

Variable 128, but I'll let the numbers tell me which way to go.

I have the following:

I'll have 840 bytes per page

I'll have another 160 bytes that follow.

That may just be populated with spaces, >20. 

That's where I get my 1000 bytes.

The BANK will have some excess I just will lose.

But the 1000 bytes per page I need to save/load and numerous pages.

The amount of pages to save should be less or equal to a DBL sided / single density disk.

I think that's 720k?

That way I can answer my own question, how many pages should SNP hold using S.A.M.S. to fit within the boundaries of a floppy?

I can make use of extra SAMs if there is some.

Thx

 

 

 

 

 

 

 

Edited by GDMike
Link to comment
Share on other sites

3 hours ago, GDMike said:

Sorry, was dozy when I asked..    I want to be able to setup my save/load file structure so that if I'm in Forth, and in the forth editor, I'd like to be able to read from a SNP saved file. Given that I previously saved it with forth blocks file name.

 

As if, I'm in SNP, and I save a text page as DSK#.BLOCKS then read it via forth, given the length is 16X64 of my saved file.

Id like to use SNP as a substitute editor, but I'd like to also have The ability to save the same file as DV80 but definitely not on the same media or at the same time.

Does that make better sense?    Thx

 

fbForth (either one) can handle files of any kind if properly set up. If you want to use the Forth blocks editors, you must use DF128 files. It does not matter what you name them as long as they are DF128. As you know, a Forth block is 1024 bytes (8 DF128 records), so you would need to watch what you do past line 13 character 7 (both zero-based).  Beyond that, you would need to write your own editor in Forth because the Forth editors only know how to handle DF128. Anything else requires that you set up file handling with your own PABs. General file handling is built into fbForth 2.0 but needs to be loaded from the appropriate FBLOCKS with fbForth 1.0 (block 47), which adds 1000 bytes to the dictionary.

 

...lee

  • Like 1
Link to comment
Share on other sites

I am just starting to look at how to create a PAB for my program.

I captured the only example I could find regarding the setup and it's requirements.

I understand the Example EXCEPT the way that the last word gathers the device name.

In the example, the last word has the count of the size of the filename including the drive, "DSK#" followed by the TEXT directive, "DSK2.FILE1".

But I have a scenario that doesn't know what the path+filename would be as it's generated by the user, and is contained in the following.

 

FNM BSS 16

COUNT DATA 0

And I gather from the user, the path+filename into FNM and the length of the filename into COUNT.

How would I setup my PAB with this information instead of using the TEXT of a defined path?

Thank you.

IMG_20201025_071721.jpg

Edited by GDMike
Link to comment
Share on other sites

At some time you will know how long the user input is; then you set up the PAB. A typical way is to reserve some buffer with BSS and to copy the input into the buffer.

 

Since you have to copy the PAB into VDP memory anyway, you can also write the PAB byte 0-8 into VRAM, then wait for the user input, then append the length byte and the input bytes.

Link to comment
Share on other sites

I'm just wondering what that code would look like, I guess that's what I'm asking.

How do I provide that to the pab without the text. 

I have that info from the user prior to calling the pab into play already.

I'm not understanding how to add my FNM with count to the PAB when I do a,

LI R5,PAB.

Do I merely say, LI R5,PAB+@FNM+@COUNT?

I know this ain't basic, but I've seen some assy code using similar stuff, like LI R6,PAB+9

I suppose it's referring to a DATA statement following the PAB label.

 

 

Edited by GDMike
Link to comment
Share on other sites

2 hours ago, GDMike said:

Do I merely say, LI R5,PAB+@FNM+@COUNT?

 

Immediate instructions cannot use contents of addresses (@FNM). They can only use values such as symbols (FNM) and numbers known at assembly time (10). Something like the above that would assemble, though it would be nonsense, is

       LI   R5,PAB+FNM+COUNT

 

...lee

  • Like 1
Link to comment
Share on other sites

3 hours ago, GDMike said:

I'm not understanding how to add my FNM with count to the PAB when I do a,

LI R5,PAB.

Do I merely say, LI R5,PAB+@FNM+@COUNT?

LI R5,PAB just loads R5 with the address of the first byte of the PAB. If PAB is located at address >A104, R5 will contain that value. What do you want R5 to contain?

 

When you see LI R6,PAB+9, R6 will contain the value >A10D as a result of the addition of the location of PAB and the constant 9.

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...