User Tools

Site Tools


blog:pushbx:2024:0408_ldebug_work_in_early_april

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

blog:pushbx:2024:0408_ldebug_work_in_early_april [2024-04-08 19:51:40 +0200 Apr Mon] (current)
ecm created
Line 1: Line 1:
 +====== lDebug work in early April ======
 +
 +
 +**2024-04-07**
 +
 +===== Updates to the manual =====
 +
 +Only listing the most important changesets:
 +
 +  * [[https://hg.pushbx.org/ecm/ldebug/rev/3e8eaeedee80|List INSTALL TOGGLE]]
 +  * List more INSTALL nouns ([[https://hg.pushbx.org/ecm/ldebug/rev/934308d8787c|1]], [[https://hg.pushbx.org/ecm/ldebug/rev/827fe5c28673|2]], [[https://hg.pushbx.org/ecm/ldebug/rev/e2315c772824|3]])
 +  * [[https://hg.pushbx.org/ecm/ldebug/rev/c5fe06cad09d|Document L and W commands]] for sectors
 +  * [[https://hg.pushbx.org/ecm/ldebug/rev/508b4d2e91be|Update vardco]] with 7th variables
 +
 +
 +===== Code changes =====
 +
 +  * init and qq [[https://hg.pushbx.org/ecm/ldebug/rev/0bf78e8b7340|will disable interrupts]] while relocating EBDA
 +  * bb: Many comments added and updated
 +  * bb: Various optimisations
 +  * bb: [[https://hg.pushbx.org/ecm/ldebug/rev/5c8648e9483f|Share the skipcomma call]] done by almost every dispatch destination
 +  * bb: [[https://hg.pushbx.org/ecm/ldebug/rev/a05481b34e10|Put some variables]] into DATASTACK section
 +  * bb: [[https://hg.pushbx.org/ecm/ldebug/rev/9c8477393361|Share setting di for common handler]] using another dispatch table
 +  * bb: [[https://hg.pushbx.org/ecm/ldebug/rev/c10075adc186|Fix, BL command segment display]] works in PM
 +  * isstring: [[https://hg.pushbx.org/ecm/ldebug/rev/36f89620dc7f|Return CF status]] for match or mismatch
 +  * expr: [[https://hg.pushbx.org/ecm/ldebug/rev/f5f87f442622|Use isstring? CF return]] for getrange_length
 +  * expr: [[https://hg.pushbx.org/ecm/ldebug/rev/c3ad1ea23cd1|Fix, allow comma]] after length number
 +  * expr: [[https://hg.pushbx.org/ecm/ldebug/rev/5e26aa834e1c|Optimise operator_default_strings table]] to drop unused entries ([[https://hg.pushbx.org/ecm/ldebug/rev/212dc2dc73f7|re-ordered first]] to make this optimisation easier)
 +  * expr: Several optimisations to operator dispatchers, using common code paths and nearby operator indexes
 +  * [[https://hg.pushbx.org/ecm/ldebug/rev/71fe60d709d5|Move inclusion of rr.asm]] to behind expr.asm to prepare for next change
 +  * In rr.asm rr4 [[https://hg.pushbx.org/ecm/ldebug/rev/84c5670e6042|add build checks]] that the boolean and bitwise operators are in the expected order
 +
 +
 +==== In detail: Truncated tables ====
 +
 +The new bb dispatch table for the DI value as well as the optimised operator default index table for the DX value share one thing: These tables are truncated. That means when the dispatch occurs to a handler without a corresponding entry in the truncated table, the respective register is initialised to a randomly read value within the data/entry section. The table read thus can overflow the table.
 +
 +This is not a problem for these handlers because they do not depend on any particular value in the register, and are themselves allowed to change it. (Eg the operator dispatchers have "CHG: dx".)
 +
 +It does pose a small problem when debugging the debugger: If access variables are used to detect a read or access to a variable, the table overflow could register as an access to the variable despite actually accessing the truncated table. This is considered acceptable.
 +
 +The truncation of the tables in both cases involved re-ordering the tables so that all the in-use entries are first. Previously, unused entries were filled with zeroes to pad out the tables up to the first in-use entry.
 +
 +There is an alternative: The base of the table could be an equate that displaces the table so that only the in-use entries are actually present, without re-ordering the existing tables. However, the re-ordering I considered to be simpler than that. (I have [[https://hg.pushbx.org/ecm/edrdos/file/b18815accefc/drdos/redir.a86#l274|seen a table with such a displacement]] in the Enhanced DR-DOS kernel sources for redirector functions.)
 +
 +
 +==== Operator dispatchers ====
 +
 +The optimisations to the operator dispatchers used several facts. First, some of the used operator index values were right next to each other, allowing an ''inc bx'' or ''dec bx'' instruction to adjust from one to the other. (These are single-byte instructions.)
 +
 +Second, some code pathes turned out to be duplicated for different operators. These were merged.
 +
 +Third, the boolean and bitwise OR/AND/XOR operators using the non-keyword symbols all compared the next text byte with the matched symbol (conveniently passed in AL) and did a certain adjustment to the default operator index in case a match is found. The adjustment happens to match the same simple addition for every one of these operators. So the entire code for these three operator dispatchers is now shared.
 +
 +(By re-ordering the bitwise and boolean operators the latter adjustment could be done using just an ''inc'' or ''dec'' but it would be more difficult to insure that all uses of the operators are updated for this. One such use is in rr4.)
 +
 +
 +===== Consideration: ELD linkage =====
 +
 +I idly wondered whether an Extension for lDebug being loaded into the debugger could extend the GNU GPL copyleft to the debugger. In practice this doesn't matter because the debugger is freer than copyleft, as it follows a "copycentre" approach. (Go down to the copycentre and make as many copies as you like!)
 +
 +I believe that the code links and data links that the ELD linker gets from the debugger constitute dynamic linking of the ELD to the debugger. Therefore if the ELD is under the GNU GPL, the debugger and likely all other ELDs used at the same time also need to be GPL-compatible. (As to the exact timing there was [[https://opensource.stackexchange.com/questions/14676/when-does-agpl-license-come-into-effect-when-loading-a-shared-gpl-licensed-lib|a recent stackexchange question]] about this. No answers yet. (Update: There is an answer now, focusing on distribution being allowed or not.))
 +
 +Moreover, if an ELD is under the GNU LGPL, then it (and/or the debugger) must follow a certain specification of the links and interfaces in order to enable swapping the LGPLed module by an independent implementation at link time (that is, run time of the ELD being loaded).
 +
 +In addition to the earlier considerations, there is yet to be even a single ELD not written by me. The only case in which an ELD I wrote is not under [[https://hg.pushbx.org/ecm/ldebug/raw-file/86c2e10a833d/license.txt|the lDebug licenses]] or in the Public Domain is in the dbitmap.eld use of a font that is under [[https://pushbx.org/ecm/doc/ldebug.htm#auc-font|CC-BY-SA 4.0 International]].
 +
 +{{tag>ldebug eld edrdos copyleft gpl}}
 +
 +
 +~~DISCUSSION~~
  
blog/pushbx/2024/0408_ldebug_work_in_early_april.txt ยท Last modified: 2024-04-08 19:51:40 +0200 Apr Mon by ecm