Shouldn't the `z_header.flags` value just be copied to a `zword` var and then passed to `SET_WORD( a, v)` to avoid the ambiguity?
Instead of ``` int i; SET_BYTE(H_CONFIG, z_header.config); SET_WORD(H_FLAGS, z_header.flags); ``` do ``` int i; zword zwflags = z_header.flags; SET_BYTE(H_CONFIG, z_header.config); SET_WORD(H_FLAGS, zwflags); ``` On Fri, Oct 4, 2019 at 7:57 AM TK Chia <[email protected]> wrote: > > Hello Steve, hello David, > > > >>> SET_WORD(H_FLAGS, z_header.(struct zcode_header_struct)flags); > >> > >> I am quite sure this change should fix the problem on Turbo C. But it > >> seems to me that it will also inadvertently break the non-DOS ports, > >> which do not define SET_WORD in terms of an asm { ... }. > > > > #ifdef __TURBOC__? > > > Having #ifdef __TURBOC__ in the platform-independent portion of the code > is kind of weird. :-) > > To avoid this, I think one way would be to tweak the (platform-specific) > SET_WORD definition for DOS, to move the use of `v' outside the `asm' block: > > #define SET_WORD(addr, v) do {\ > _AX = (v); \ > asm les bx,zmp;\ > asm add bx,addr;\ > asm xchg al,ah;\ > asm mov es:[bx],ax; } while (0) > > This will allow `v' to be pretty much any arbitrary C expression. It > uses the magic _AX variable which is specific to Turbo C (it works on > Turbo C 2.01, and should work on 3.00 too). > > Thank you! > > -- > https://github.com/tkchia > > > _______________________________________________ > Freedos-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/freedos-devel _______________________________________________ Freedos-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/freedos-devel
