On at 2022-07-12 15:45 -0400, Steve Nickolas wrote:
I haven't uploaded a copy of the new source anywhere yet - it'll probably be in the next DOSLITE source batch along with my work on a few other DOS commands, but I don't want to replace the copy I've already uploaded, and DOSLITE isn't ready to go onto anything like github or gitlab yet.

I strongly suggest to keep source history. If you'd rather not, you do not need to publish that right now but I do recommend you keep it privately at least. I started in 2010 [1] and it has been a great experience that often proved useful.

As I said, I managed to move the CP437 table into the spot reserved for the resident table (except for the first 3 bytes), which saved good memory, and with C. Masloch's optimizations and by simplifying the version check the file size and resident footprint went down even further.  (In an earlier incarnation, I had to jigger around 'jmp far 0', but it turns out 'jmp 0:0' as mentioned was the solution to that.)

Yes, good catch, it isn't immediately obvious why NASM won't allow a "far" keyword there.

The resident footprint went down 1 paragraph, from 1344 to 1328 - now only 128 bytes larger than the official version.  (I wonder if any of the PSP can be just up and deallocated?)

You can deallocate the PSP (either with some tricks on the parent stack or just split Memory Control Blocks manually), but it will leave a memory "hole" in its place. This is seldom useful. (Bret's and my method relocate the PSP precisely to avoid creating fragmentation holes when allocating the final resident memory.)

The new "new2F":

new2F:    cmp       ah, 0xB0            ; is it ours?
           je        .2
.1:       jmp       0:0
.2:       cmp       al, 1
           ja        .1                  ; >1 - chain
           mov       al, 0xFF            ; needs set for both functions.
           je        .3                  ; 1 - where are we?
           iret                          ; 0 - are we here?
.3:       mov       word ds:[bx], entry
           mov       ds:[bx+2], cs
           iret
old2F     equ       .1+1

...probably as codegolfed as it's going to get.

Not quite: The "ds:" segment override prefixes are unneeded actually. NASM will happily emit them, but they eat memory completely unnecessarily. "mov word [bx], entry" already defaults to ds as its segment. (Unlike addresses including "[bp]" which default to ss.)

I didn't notice those at first because I assumed you were using es. That's what your comment in your caller says:

.21:      mov       ax, 0xB001          ; So where is it?
          mov       bx, whence          ; ES:BX gets this.
          int       0x2F


However, the Interrupt List [2] does say it uses ds:bx so your interrupt handler is correct, your caller's comment is incorrect.

Regards,
ecm


[1]: https://hg.pushbx.org/ecm/ldebug/rev/5eef5847c863
[2]: https://fd.lod.bz/rbil/interrup/video/2fb001.html#5274



_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to