HX icon indicating copy to clipboard operation
HX copied to clipboard

Contributions

Open awik32 opened this issue 1 year ago • 4 comments

I have modified the sources (really only 1 ASM file). How do I share my code? I'm not very good with Git, so I don't know, eg., how to do a pull request.

awik32 avatar Feb 15 '24 09:02 awik32

Well, just post it here - with a description what it is supposed to do.

Baron-von-Riedesel avatar Feb 17 '24 15:02 Baron-von-Riedesel

The code adds a command line option, "-f<x>", where <x> is a decimal number corresponding to the flags in the HDPMI environment variable. Space between -f and <x> is optional.

--- INIT.ASM.orig	2024-02-18 06:33:24.065361088 +0000
+++ INIT.ASM	2024-02-18 06:59:19.961902270 +0000
@@ -1108,6 +1108,7 @@
 	db "  -e: reenable a disabled instance of %",lf
  endif
 endif
+	db "  -f<x>: set flags (<x>: see documentation for HDPMI variable)",lf
 if ?NOINVLPG
 	db "  -g: don't use INVLPG opcode",lf
 endif
@@ -1737,6 +1738,8 @@
 	jz switchlog
  endif
 endif
+	cmp al,'f'
+	je setflagsopt
 	jmp ishelp
 
 if ?USEOPTTAB
@@ -1851,6 +1854,39 @@
  endif
 	retn
 endif
+
+setflagsopt:
+	push dx
+	push bx
+	xor ax,ax
+	xor bh,bh
+@@:
+	cmp byte ptr es:[si],' '
+	jne @F
+	inc si
+	dec cl
+	jz setflagsopt_out
+	jmp @B
+@@:
+	mov bl,es:[si]
+	sub bl,'0'
+	jc @F
+	mov dx,10
+	cmp bl,dl
+	jnc @F
+	mul dx
+	add ax,bx
+	inc si
+	dec cl
+	jz @F
+	jmp @B
+@@:
+setflagsopt_out:
+	mov wEnvFlags,ax
+	pop bx
+	pop dx
+	retn
+
 if ?EARLYIVTSAVE
 earlyivtsave:
 	or bTmpFlgs, 1

awik32 avatar Feb 18 '24 07:02 awik32

I see. Problem is: I'd rather wanted to get rid of those environment switches - they're way too "technical", and you always need to first read the documentation to get an idea what they're good for.

My idea was: the HDPMI= environment variable will just contain cmdline arguments. New cmdline arguments are added for those environment variable switches that have no cmdline argument equivalent yet.

Baron-von-Riedesel avatar Feb 18 '24 10:02 Baron-von-Riedesel

I agree they're too technical, or perhaps rather too obscure, and yes, you need to read the documentation before you can use them. It would be good if you could get rid of them, without losing anything (such as the ability to run Borland 32RTM programs).

For the time being, these flags fill a need. Adding a new command line option for each of the flags would inevitably make the "usage" help longer, potentially too long to fit in one screenful. However, you could work around that by splitting the "usage" message into parts, such as one "easy" or "normal" part (such as -u and -r), one "compatibility" part, and one for "advanced" options. To keep it tidy, the more obscure parts could be requested with eg. "-??".

awik32 avatar Feb 18 '24 11:02 awik32