Jump to content
IGNORED

Supernotes


GDMike

Recommended Posts

Ya it can make you crazy when you are used to JMPing whereever you need to.

 

Here is how the DxForth labels look. They are numbered since you don't write walls of code in Forth Assembler, just simple sub-routines.

I think you could get the hang of this pretty quick.

\ =======================================
CODE TEST ( n -- n')
1 $:    R4 DEC,
        R4 400 CI,
        2 $ JEQ,
        R1  DEC,
        R2  INCT,
        R4 R4 MOV,
        1 $ JNE,
2 $:    NEXT,
ENDCODE

CODE TEST3
1 $:   2 LIMI,
       0 LIMI,
       1 $ JMP,
       NEXT,
ENDCODE

CODE BADTEST
1 $:   R1 BEEF LI,
       2 $  ( this will cause  "Un-resolved forward jump")
       1 $ JMP,
      NEXT,
ENDCODE

 

  • Like 1
Link to comment
Share on other sites

Here I can get the time and date as a copy \ paste item in SNP

ITIME  MOV  @POS,R0
       BLWP @VSBR
       MOVB R1,@KYBUF
       BL   @SYSDL
       MOV  @SWDT,R4          * check if clock is on       
       CI   R4,0
       JEQ  ITIMEE            * exit
       LI   R0,0
       LI   R1,ITBUF          * go get the time
       LI   R2,8
       BLWP @VMBR
       MOV  @POS,R0
       BLWP @VMBW
       AI   R0,8
       MOV  R0,@POS           * adjust POS
ITIMEE B    @CUR
***
*
* INSERT DATE
****
IDATE  MOV  @SWDT,R4
       BLWP @VSBR
       MOVB R1,@KYBUF
       BL   @SYSDL
       CI   R4,0
       JEQ  IDATEE
       LI   R0,40
       LI   R1,IDBUF          * go get the date
       LI   R2,8
       BLWP @VMBR
       MOV  @POS,R0
       BLWP @VMBW
       AI   R0,8
       MOV  R0,@POS
IDATEE B    @CUR

 

Link to comment
Share on other sites

7 minutes ago, TheBF said:

I have been threatening to make more normal looking, prefix Forth assembler but did not do it yet.

MPE Forth (UK) has had prefix assemblers in their systems for 40 years. 

i mean, most of what im doing doesnt even require an assembler routine that i can think of actually. BUT its nice to know it can be loaded up when I need, Im sure i can work through it, but I seemed to find a WORD to do what I needed...instead of making a assembled routine...

Link to comment
Share on other sites

I'll finish up with SNP 2.2 and leave ver 3 (DB ver) alone. I think it's just too much to try and add in the DB stuff, and probably should just be a standalone program designated for DB.

I'm happy with SNP and all it can do.

 

I'll probably ease back into Turbo Forth, and start small as my memory only lets me do that.

I do have the quick reference guide to everything you need to know about TF ? handy.

 

 

Link to comment
Share on other sites

I think I'll make a >6000 - >7FFF ram memory display by decimal value, hex and ASCII like I did in assembly, but do it in Forth.

But I'll do it with 80 column style.

And designed for supercart ram.

Plus it's something I know a bit about, like apples and oranges..mmm ..Orange 

IMG_20220716_233643956.jpg

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

9 hours ago, GDMike said:

I think I'll make a >6000 - >7FFF ram memory display by decimal value, hex and ASCII like I did in assembly, but do it in Forth.

But I'll do it with 80 column style.

And designed for supercart ram.

Plus it's something I know a bit about, like apples and oranges..mmm ..Orange 

IMG_20220716_233643956.jpg

If you do this in TF look up the code for DUMP. It will give you lots of ideas how to do this.

  • Like 1
Link to comment
Share on other sites

On 7/17/2022 at 2:47 AM, Lee Stewart said:

It should be as simple as setting up the output string with “AM”, testing for hour > 12 and, if so, subtracting 12 and changing the ‘A’ of “AM” to ‘P’. Post your code for the time and we can work with it.

Not really. Due to the ridiculous way of telling the time this old fashioned way, you should change AM to PM if the hour>12, but compute hour mod 12, then if hour=0 add 12.

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

14 hours ago, GDMike said:

Here I can get the time and date as a copy \ paste item in SNP

ITIME  MOV  @POS,R0
       BLWP @VSBR
       MOVB R1,@KYBUF
       BL   @SYSDL
       MOV  @SWDT,R4          * check if clock is on       
       CI   R4,0
       JEQ  ITIMEE            * exit
       LI   R0,0
       LI   R1,ITBUF          * go get the time
       LI   R2,8
       BLWP @VMBR
       MOV  @POS,R0
       BLWP @VMBW
       AI   R0,8
       MOV  R0,@POS           * adjust POS
ITIMEE B    @CUR
***
*
* INSERT DATE
****
IDATE  MOV  @SWDT,R4
       BLWP @VSBR
       MOVB R1,@KYBUF
       BL   @SYSDL
       CI   R4,0
       JEQ  IDATEE
       LI   R0,40
       LI   R1,IDBUF          * go get the date
       LI   R2,8
       BLWP @VMBR
       MOV  @POS,R0
       BLWP @VMBW
       AI   R0,8
       MOV  R0,@POS
IDATEE B    @CUR

Compare the two. There are some hints about saving memory and time by removing redundant instructions.

Remember that the TMS 9900 is pretty slow to execute an instruction. It usually pays to make an instruction more complex (more complicated addressing), if that means you can remove another instruction.

Never load an immediate as zero, when you have the CLR instruction. Also remember that many instructions, like MOV, compares the result to zero intrinsically.


Here it's improved a bit. You waste a lot of memory with your coding

ITIME  MOV  @POS,R0
       BLWP @VSBR
       MOVB R1,@KYBUF
       BL   @SYSDL
       CLR  R0 				; You may need this reset to zero soon anyway
       C    @SWDT,R0          * check if clock is on - by a direct compare with zero. You dont' need to move what's at SWDT anywhere here      
       JEQ  ITIMEE            * exit
       LI   R1,ITBUF          * go get the time
       LI   R2,8
       BLWP @VMBR
       MOV  @POS,R0
       BLWP @VMBW
       A    R2,@POS           * adjust POS R2 already contains 8
ITIMEE B    @CUR
***
*
* INSERT DATE
****
IDATE  BLWP @VSBR
       MOVB R1,@KYBUF
       BL   @SYSDL
       MOV  @SWDT,R4 ; A MOV compares data to zero
       JEQ  IDATEE
       LI   R0,40
       LI   R1,IDBUF          * go get the date
       LI   R2,8
       BLWP @VMBR
       MOV  @POS,R0
       BLWP @VMBW
       A    R2,@POS ; You stored 8 in R2 a few instructions up
IDATEE B    @CUR

 

  • Like 2
Link to comment
Share on other sites

15 hours ago, GDMike said:

************************************
* PICL      TIPI CLOCK USAGE       *
* 04/09/22* 80 column version 3.0 *
*  modified 06/01/22               *
************************************ 
MDS    DATA 0
MDT    DATA 0
DSRC   MOV  R11,@SAVRTN
       CLR  R4
       MOV  @POS,@MDT
       LI   R0,PABADR
       LI   R1,PAB
       LI   R2,20
       BLWP @VMBW
       MOVB @READ,R1
       LI   R0,PABADR
       BLWP @VSBW
       LI   R6,PABADR+9
       MOV  R6,@POINTR
       BLWP @DSRLNK
       DATA 8
       LI   R0,PABADR+1
       BLWP @VSBR
       MOV  @POS,R0
       SRL  R1,13
       AI   R1,>30
       SLA  R1,8
       CI   R1,>3000
       JEQ  DSRE
       MOV  @POS,R0
       CI   R1,0
       JEQ  DSRERR
DSRE   MOV  @MDS,@POS
       MOV  @MDT,R0
       MOV  @SAVRTN,R11
       RT   *R11

I DINT have time to make comments in this one..

Here's another example of some improvements.

 

************************************
* PICL      TIPI CLOCK USAGE       *
* 04/09/22* 80 column version 3.0 *
*  modified 06/01/22               *
************************************ 
MDS    DATA 0
MDT    DATA 0
DSRC   CLR  R4		; No need to save R11 when you don't do another BL before you return
       MOV  @POS,@MDT
       LI   R0,PABADR
       LI   R1,PAB
       LI   R2,20
       BLWP @VMBW
       MOVB @READ,R1
       LI   R0,PABADR
       BLWP @VSBW
       LI   R6,PABADR+9
       MOV  R6,@POINTR
       BLWP @DSRLNK
       DATA 8
       LI   R0,PABADR+1
       BLWP @VSBR
       MOV  @POS,R0
       SRL  R1,13
       AI   R1,>30
       SLA  R1,8
       CI   R1,>3000
       JEQ  DSRE
       MOV  @POS,R0
       MOV  R1,R1	;Compares R1 to zero, but shorter than CI
       JEQ  DSRERR
DSRE   MOV  @MDS,@POS
       MOV  @MDT,R0
	   RT
; Not RT *R11. RT implies B *R11, so it's already included.

 

  • Like 2
Link to comment
Share on other sites

4 hours ago, apersson850 said:

; Not RT *R11. RT implies B *R11, so it's already included.

It's just my notes written this way. But yeah, this is known already.

I cut the heading in this code by mistake that doesn't show the sav R11, but this is a BL routine, you'd not know that.

It's handled.

Taco night! Whohoo.

 

Thx for your help.

Edited by GDMike
Link to comment
Share on other sites

11 hours ago, GDMike said:

I cut the heading in this code by mistake that doesn't show the sav R11, but this is a BL routine, you'd not know that.

It's handled.

Maybe it's called by a BL. That I can't see here, of course. But that doesn't matter anyway. The important thing is that there is no BL call in this part, only BLWP, so there's no need to save the R11 register. It contains the address to return to, and it's not disturbed by another BL inside this procedure.

Link to comment
Share on other sites

One way to convert 0-23 hours to the old style format.

		MOV  @HOUR,R3  ; Fetch the hour (integer value) from somewhere
		CLR  R2
		LI   R1,12
		DIV  R1,R2
		MOV  R3,R3  ; Check if reminder is zero
		JNE  READY
		MOV  R1,R3	; If zero replace by 12
READY

At READY, you now have the vaule in the range 12, 1-12, 1-11 instead of 0-23. You then have to convert the hour value in R3 to characters to display.

READY  LI   R1,10
       CLR  R2
       DIV  R1,R2      ; Leaves first digit in R2, second in R3
       MOVB @MYWS+5,R3
       ORI  R3,>3030   ; Converted to characters in R3 (if you want both characters in one register)

Another option here is of course to keep the two digits separate, and convert them to characters in the registers where they are and then send them to the screen.

DIV is an instruction with a long execution time, but try divide by ten and calculate both the quotient and the reminder without using DIV, and do it faster. It's not that easy.

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

3 hours ago, apersson850 said:

At READY, you now have the value in the range 12, 1-12, 1-11 instead of 0-23. You then have to convert the hour value in R3 to characters to display.


READY  LI   R1,10
       CLR  R2
       DIV  R2,R1      ; Leaves first digit in R2, second in R3
       MOVB @MYWS+5,R3
       ORI  R3,>3030   ; Converted to characters in R3 (if you want both characters in one register)

 

 

Typo in third line should be

       DIV  R1,R2

 

...lee

  • Like 3
Link to comment
Share on other sites

Here's another way to fix the hour.

 

        MOV  @HOUR,R3  ; Fetch the hour (integer value) from somewhere
        LI   R1,12
        C    R3,R1
        JLT  SMALL
        S    R1,R3
SMALL	MOV  R3,R3
        JNE  READY
        MOV  R1,R3	; If zero replace by 12
READY

Ten words of memory instead of nine, but no DIV, so it should be faster anyway.

DIV is more efficient in the second case, where we need both the quotient and the reminder.

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

latest downloads for SNP - ver 2.2 july 2022

 

ill look for help docs, but there is help with F9 key

program name is SNP

start name is SNP

must have SAMS card (1mb) and F18A 

otherwise ask me for the 40 column vers

 

 

 

SNP

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

A couple helpful items about SNP.

Filename is, like 9 or less characters and so a save would look like: SAVE DSK4.SCHOOL

No lowercase, and a load looks like, LOAD DSK3.SCHOOL

Files should be kept in the same directory as SNP is in, I don't think it can save outside a root folder.

F5 - command line calls.

CALL CHAR (231) would place ASCII character at cursor position.

CALL COLOR (F1) uses hex code for color scheme.

Screen colors  can be local to the page or global to every page.

CALL GOTO (43) would load page 43 to the screen.

 

Import from Windows clipboard, or classic 99. Ctrl M after you have data in the clipboard, follow instructions.

Will overwrite to top of screen if there is too much data in clipboard.

 

 

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

For faster loading of SNP, ill be removing the SAMS INIT page counter that appears at boot and replacing with "Wait".

This will improve performance at boot up.

And I'll be hoping to add a couple more things to SNP soon.

So far I've NOT made version 2.2 a supercart requirement.

SNP will continue to load via editor assembler option 3 and ram requirement of SAMs with F18A.

Edited by GDMike
  • Like 2
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...