Shop OBEX P1 Docs P2 Docs Learn Events
P2 Taqoz V2.8: Patch for LEN$ — Parallax Forums

P2 Taqoz V2.8: Patch for LEN$

the kernel word LEN$ is not safe, when the serial interrupt occurs during it's execution, as discussed here:
Normally this is not very likely to occur.

The original version is very elegant, fast and compact. So the suggested patch is not so fast and does not fit into the same space and will be sitting in HUB RAM.
As the original word is used by other words, the suggestion is to patch a jump to the new version into the original code in cog memory.

code newLEN$ ( str$ -- length ) ' \ original fails when interrupted
   mov r0,a
   mov a,#0
   .l1 rdbyte r1,r0 wz
      if_z ret
      add r0,#1
      add a,#1
   jmp #l1
   jmp #\0 ' \ dummy to get the code for patch
\ 0BC22 FD80_0000     jmp #\0 ' \ dummy to get the code for patch
' newLEN$ 2+ $FD80_0000 or $7b cog! \ patch jmp to newLEN$ into original cog routine

(Mandatory for this is the use of the version _BOOT_P2.BIX in in . )

@bob_g4bby , perhaps it would be a good idea to place a warning in your Glossary?

Have fun, Christof


Sign In or Register to comment.