This shows you the differences between two versions of the page.
— |
blog:pushbx:2024:0812_early_august_work [2024-08-12 19:21:40 +0200 Aug Mon] (current) ecm created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Early August work ====== | ||
+ | |||
+ | |||
+ | **2024-08-11** | ||
+ | |||
+ | ===== EIDL ===== | ||
+ | |||
+ | EIDL was a simple TSR that installed an int 28h handler which runs a '' | ||
+ | |||
+ | Because the example does not leave a PSP allocated, the updated EIDL uses less memory than the original. Despite this the program can detect that it is already installed ([[https:// | ||
+ | |||
+ | I reported my adaptation of EIDL [[https:// | ||
+ | |||
+ | < | ||
+ | |||
+ | Repo is at https:// | ||
+ | |||
+ | |||
+ | ===== WarpLink ===== | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | Having added the first change I [[https:// | ||
+ | |||
+ | |||
+ | ===== TracList ===== | ||
+ | |||
+ | Two small updates to the convlist.pl script: | ||
+ | |||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | |||
+ | The JWasm change was likely needed for Enhanced DR-DOS' | ||
+ | |||
+ | |||
+ | ===== kernwrap ===== | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | |||
+ | ===== lDebug ===== | ||
+ | |||
+ | * Add DAO flag [[https:// | ||
+ | * Fix: [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | |||
+ | |||
+ | ===== Enhanced DR-DOS ===== | ||
+ | |||
+ | The code [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | The change isn't particularly nice, but the BPB returned from a block device doesn' | ||
+ | |||
+ | |||
+ | ==== DRDOS port to NASM ==== | ||
+ | |||
+ | I've [[https:// | ||
+ | |||
+ | The original update to the public repo was lacking a macro file, nasmorg.mac, | ||
+ | |||
+ | |||
+ | ==== DRBIO port to NASM ==== | ||
+ | |||
+ | This port is ongoing as of today. Like the DRDOS port, it caused several updates to both the fixmem.pl script and ident86. | ||
+ | |||
+ | |||
+ | ===== x2b2 ===== | ||
+ | |||
+ | To better integrate with the EDR-DOS build scripts [[https:// | ||
+ | |||
+ | |||
+ | ===== ident86 ===== | ||
+ | |||
+ | Many smaller changes. The major improvements are as follows: | ||
+ | |||
+ | * Detect source file and line to patch for several types of hints | ||
+ | * Add switch to specify build scriptlet (-b) | ||
+ | * Dump detected source file part (-S) | ||
+ | * Edit detected source part (-E) | ||
+ | * Specify patterns to find source file from trace listing source (-p) | ||
+ | * Run and display checksums (-P) | ||
+ | * Emit timestamps into reports (-t and -T) | ||
+ | * Repeat after an edit (-r, requires -e -E -b and uses the same checksum as -P) | ||
+ | |||
+ | |||
+ | A few more recent, smaller changes: | ||
+ | |||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * Improve .tls scan for data directives [[https:// | ||
+ | |||
+ | |||
+ | ===== fixmem ===== | ||
+ | |||
+ | These scripts and macros were [[https:// | ||
+ | |||
+ | |||
+ | ==== Memory references ==== | ||
+ | |||
+ | The basic task of fixing memory references involves detecting several types of operands: | ||
+ | |||
+ | * Registers (all 8086 registers are recognised) | ||
+ | * Register '' | ||
+ | * Address already with brackets | ||
+ | * Plain number | ||
+ | * Equate mapped to a plain number | ||
+ | * Variable to be used as an address | ||
+ | * Variable with an '' | ||
+ | * Address marked by segment override but no brackets | ||
+ | |||
+ | Depending on which operand types are found, the script may have to add brackets and a size keyword to the instruction. Single-operand instructions are a little easier because they cannot operate on immediates. Two-operand instructions can operate on immediates (albeit technically only as source operands). | ||
+ | |||
+ | |||
+ | ==== Memory operand sizes ==== | ||
+ | |||
+ | A memory access' | ||
+ | |||
+ | |||
+ | ==== labelsize defines ==== | ||
+ | |||
+ | As NASM equates have no way to store a size or an address involving registers, fixmem.pl rewrites these into a use of the labelsize macro. In the resulting NASM source text the second operand to this macro, the size, is actually ignored. It is used during fixmem.pl operation however. The companion macro file nasm.mac has an mmacro for labelsize definitions. This mmacro uses '' | ||
+ | |||
+ | There are three possible pitfalls in using NASM's '' | ||
+ | |||
+ | Neither of these three problems has actually occurred in the source texts that I have worked on yet. (ETA: The use before definition [[https:// | ||
+ | |||
+ | |||
+ | ==== String instructions and xlatb ==== | ||
+ | |||
+ | Some instructions may have explicit memory operands which are used only to select a size and/or a segment override. The script translates these instructions to NASM's native format in which segment overrides are used as mnemonic prefixes (without a colon) and the access size is indicated by a trailing size letter of the string instruction. | ||
+ | |||
+ | In MASM-compatible source texts, the size letter form of a string instruction may be combined with an explicit operand so that the operand only specifies a segment. Both string instructions and xlatb may be given with a variable to access. Segment overrides may be implied by this variable and the current '' | ||
+ | |||
+ | |||
+ | ==== Segment overrides ==== | ||
+ | |||
+ | The fixmem.pl script will not detect segment prefixes based on '' | ||
+ | |||
+ | |||
+ | ==== Two-byte text literals ==== | ||
+ | |||
+ | The MASM-compatible source texts assume that a 16-bit immediate operand to an instruction that is composed of two bytes of text will store the first byte of the text in the upper half of the numeric 16-bit value. That means if such a value is stored to memory, or compared with data from memory, the text literals are swapped as opposed to writing the two text bytes as a string. | ||
+ | |||
+ | NASM changes the order of text literals so that they match text stored in memory. For instance, '' | ||
+ | |||
+ | The fixmem.pl script tries to detect uses of such immediates and will swap them as appropriate. It will mark lines in which this occurred with a comment. If this comment is found in the input, or both bytes of the text literal are the same value, then no swapping takes place. | ||
+ | |||
+ | |||
+ | ==== NASM port labels and equates ==== | ||
+ | |||
+ | Port labels and port equates are emitted when fixmem.pl detects uses of a label or equate that do not match NASM's view of this value. The original case for this was capitalisation differences. Another, later case involved structure members accessed using the name of the structure followed by a dot and the name of a member of that structure. | ||
+ | |||
+ | Because of how NASM's structures work, all structure member names must carry unique (global) labels. This is a problem occasionally. | ||
+ | |||
+ | |||
+ | ==== Unneeded segment prefixes and sizes ==== | ||
+ | |||
+ | The '' | ||
+ | |||
+ | Further, MASM will accept useless '' | ||
+ | |||
+ | The useless segment overrides may be used to disambiguate memory accesses. This is not needed for NASM syntax which always uses square brackets to indicate explicit memory operands. | ||
+ | |||
+ | |||
+ | ==== Rerunnability ==== | ||
+ | |||
+ | All changes done by fixmem.pl are intended to be safely parseable as input for another fixmem.pl run. This is one reason that the script doesn' | ||
+ | |||
+ | |||
+ | ==== Segments and groups ==== | ||
+ | |||
+ | There is some support for converting segment and group directives. NASM requires a segment directive to start with the directive keyword ('' | ||
+ | |||
+ | NASM will warn if an existing segment is used again with any attributes, even if the attributes match those used originally. The fixmem scripting doesn' | ||
+ | |||
+ | NASM's '' | ||
+ | |||
+ | |||
+ | ==== Multi-pass operation ==== | ||
+ | |||
+ | The fixmem.pl script does not support multi-pass operation by itself. However, it does come with some support for two ways to simulate it. Either the same input file may be specified twice to fixmem.pl, or an input file may be copied into a temporary file and this copy may be specified before the regular input file. If the temporary file is used, it should be named with a filename ending in '' | ||
+ | |||
+ | Both ways should work to pick up variable definitions after their uses in the source text. The multi-pass operation for group directives works better with the temporary file way. Variables with unknown sizes also cause the error messages to be prepended with a '' | ||
+ | |||
+ | |||
+ | ==== Macro file support ==== | ||
+ | |||
+ | To handle macro files needed to process an input file, the macro files should be specified as input files on the same command line, before the regular input file that is to be processed. Multiple input files that are to be assembled by one run of the assembler (ie, they are linked by '' | ||
+ | |||
+ | {{tag> | ||
+ | |||
+ | |||
+ | ~~DISCUSSION~~ | ||