How to avoid buffer interference?

All plugins for the HP41

How to avoid buffer interference?

Postby mike-stgt » Tue Mar 08, 2022 11:01 pm

I have no idea so I dare to ask.
Systems alike 41CL Calculator with access to more than 300 modules for sure have a method to avoid use of a ROM-ID more than once the same time. Maybe similar for multiples of same function name. At least I use programs to avoid such interference when "plugging" ROMs for NutEm, alas not yet for NutEm/PC.

This check is possible comparing data contained in the ROMs' FAT. But how to proceed with buffers? Is there a way to detect if and if yes which buffer(s) a module does use? Or is the description the only source of information about this? Who keeps a lists up to date which buffer is used by which module?

Posts: 132
Joined: Tue Dec 24, 2019 12:12 pm

Re: How to avoid buffer interference?

Postby rprosperi » Wed Mar 09, 2022 6:03 pm

The only list I'm aware of is in Poul Kaarup's HP-41 Programmer Handbook (which I think you know about) but that list is definitely not complete.

It's most likely that the best source of a list of these is to ask Angel for it. It is also likely that he has has created more ROMs that use buffers than all others combined. To my knowledge the only thing you can do (assuming you don't have the module's source, but do have the modules in RAM/flash/EPROM/NoV-64, etc.) would be brute force; hack the buffer IDs where allocated and also all the places where it's called, which would be very tedious.
Posts: 59
Joined: Sat Apr 11, 2015 1:03 pm

Re: How to avoid buffer interference?

Postby mike-stgt » Thu Mar 10, 2022 12:42 am

Nice! I have no idea so I dared to ask, you have no idea but dare to reply -- it feels so cosy not to sit alone in a rubber dinghy with neither a safe shore nor dry land at all in sight. Fortunately four eyes see more than just two :mrgreen:

I hoped, the module list at would come with a column showing buffer-IDs, alas no. Seems it's only important for users, not for collectors.

Meanwhile someone was so kind and sent me following cross references: p. 66 p.60 p. 5

This all does not answer my quest about a "canonical" way to prevent trouble using interfering modules.

Posts: 132
Joined: Tue Dec 24, 2019 12:12 pm

Re: How to avoid buffer interference?

Postby mike-stgt » Mon Mar 14, 2022 1:08 am

Instead of brute force I did a simple test, lean, fast but incomplete. Incomplete in two ways, I tested only the modules enclosed with V41 and few more found by chance on my PC, and the test detects only "permanent" buffers (those surviving a power cycle). So use of buffer #7 from Skwid's X-IL (aka EXT-IL) remains undiscovered.

What I did: I prepared a LOD file template with almost all buffers (no buffer #0 as it's questionable it could coexist with key assignments), added a MOD to test, saved the LOD, started V41 with it, switched emulated HP41 on, ended V41 after 2 seconds and analysed the remaining buffers. And same again with next MOD.

Code: Select all
Modules     #0 #1 #2 #3 #4 #5 #6 #7 #8 #9 #A #B #C #D #E #F
ADVANTAGE                  5
BOOST                3                                   F
CCD                        5
CCD-MODIFIED               5
CCD-OSX                    5
CMT-200                                         C
CMT-300                                            D
DAVIDASSM      1  2
ES-41                3  4                             E
EXT-IL                        6
FORTH                                              D
HPIL-DEV                                        C
HPIL-DIAG                                    B
OSX_BS4X                   5
OSX_BS4X-P6                5
OSX_BS4X-P7                5
PLOTTER                                      B
SM_OSX_BS4X_P6             5
SM_OSX_BS4X_P7             5
TIME                                      A
As mentioned afore, vertically incomplete and limited to permanent buffers only.

Conclusion: an automated interference check for buffer-IDs is only possible with an up-to-date table.

For those interested in my script:
Code: Select all
/* which 41-ROM claims which buffer */
call RxFuncAdd 'RxPipe', 'RXPIPE', 'RXPIPE'           /* see PIPE.HTM */

/* mods.list from DIR /B *.MOD > mods.list */
call RxPipe '< mods.list!spec 1;-5!xlate!nfind NUT!change / /%20/!stem mods.'
say 'To do:' mods.0 'MOD files.'

mgr = .WindowsManager~new
dtw = mgr~desktopWindow

do mod = 1 to mods.0
   say 'Testing' mods.mod
   call RxPipe '(end ?) literal $MODULE' mods.mod'!a:fanin!> bufchk.lod',
                                   '? < bufchk.txt!a:'
   '' "start /b C:\prgm\HP-Emulators\V41\V41.exe" ".\bufchk.lod"
   Call SysSleep .2           /* wait until V41 is ready to run */
   dtc = dtw~firstChild
   do until dtc = .nil
      if dtc~wClass = "#109",,
       right(dtc~title, 6) = "bufchk",    /* gotcha */
       then leave
      dtc = dtc~next
   if dtc = .nil then exit MessageDialog("No V41 with bufchk.LOD running?", 0, "Note")
   dtc~sendKeyDown("F2")      /* push ON */
   Call SysSleep .01
   dtc~sendKeyUp("F2")        /* release ON */
   Call SysSleep 2            /* in few cases too short */
   dtc~processMenuCommand("&File", "E&xit")     /* quit */
   Call SysSleep .1
   call RxPipe '< bufchk.lod!frlabel :RAM 0C0!take 32',
               '!nlocate 13-* /A5 5A A5 5A A5 5A/',
               '!nlocate 14 /0/!nlocate 10 /0/!spec 11!uniq',
               '!literal' mods.mod || '!join * /;/!l fs ; f2!>> ubu.txt'

::requires 'winsystm.cls'
::requires "ooDialog.cls"
Posts: 132
Joined: Tue Dec 24, 2019 12:12 pm

Return to Modules

Who is online

Users browsing this forum: No registered users and 1 guest