The MASM Forum Archive 2004 to 2012

Miscellaneous Forums => 16 bit DOS Programming => Topic started by: bcddd214 on December 24, 2011, 04:48:58 AM

Title: adding a border
Post by: bcddd214 on December 24, 2011, 04:48:58 AM
I found the 32 version of what I am trying to do but a simple hack of changing the enhanced registers to 16 bit failed miserably. how do I make lines 236 thru 274 16 bit friendly?

http://pastebin.com/cSSTcyvs
Title: Re: adding a border
Post by: bcddd214 on December 24, 2011, 06:38:48 AM
Well, I just figure out the what was giving me headaches was that the code I was drawing from imported libraries I cannot use in 16 bit.

Does anyone have a 16 bit template I can borrow from?
Title: Re: adding a border
Post by: MichaelW on December 24, 2011, 06:45:09 AM
The code that you added is 16-bit code. Here is what ML returns when I try to assemble it:

Assembling: new_dos.asm
new_dos.asm(242) : error A2006: undefined symbol : RightCol
new_dos.asm(246) : error A2006: undefined symbol : Row2
new_dos.asm(247) : error A2006: undefined symbol : Row1
new_dos.asm(249) : error A2006: undefined symbol : Vertical
new_dos.asm(251) : error A2031: must be index or base register
new_dos.asm(256) : error A2031: must be index or base register
new_dos.asm(261) : error A2006: undefined symbol : LowerRow
new_dos.asm(262) : error A2031: must be index or base register
new_dos.asm(265) : error A2006: undefined symbol : Horizontal
new_dos.asm(268) : error A2031: must be index or base register
new_dos.asm(273) : error A2006: undefined symbol : LeftCol
new_dos.asm(274) : error A2031: must be index or base register


It should be obvious to you what the undefined symbol errors are. For the other errors, see the Indirect Memory Operands section  here (http://webster.cs.ucr.edu/Page_TechDocs/MASMDoc/ProgrammersGuide/Chap_03.htm). And as a hint, the two indirect memory operands following the Filler1 label are correct, and the next five are not, because they use a 16-bit register that is not a valid index or base register.
Title: Re: adding a border
Post by: bcddd214 on December 24, 2011, 06:55:04 AM
correct, but all of the symbol definitions appear to call on 32 bit libraries for their directives. Extracting the code seemed over my head as far as in the aspect a a total porting from 32 to 16 bit.

here is the code I am trying to extract from.
http://pastebin.com/U6r3zSdb
Title: Re: adding a border
Post by: bcddd214 on December 24, 2011, 08:46:00 AM
I can't seem to get the variable recognized after I set it @ proc;
makewin     PROC    Row1:DWORD, Row2:DWORD, Horizontal:BYTE

http://www.chasenet.pastebin.ca/2096142


C:\Users\WUZAMA~1\Desktop\asm\ASM-PR~1>make16 newDOS2
Assembling: newDOS2.asm
newDOS2.asm(133) : error A2119: language type must be specified
newDOS2.asm(156) : error A2006: undefined symbol : Row1
newDOS2.asm(160) : error A2006: undefined symbol : ConsoleScreen
newDOS2.asm(163) : error A2006: undefined symbol : upperRow
newDOS2.asm(164) : error A2031: must be index or base register
newDOS2.asm(168) : error A2006: undefined symbol : Horizontal
newDOS2.asm(169) : error A2006: undefined symbol : Horizontal
newDOS2.asm(171) : error A2031: must be index or base register
newDOS2.asm(176) : error A2006: undefined symbol : RightCol
newDOS2.asm(177) : error A2031: must be index or base register
newDOS2.asm(180) : error A2006: undefined symbol : Row2
newDOS2.asm(181) : error A2006: undefined symbol : Row1
newDOS2.asm(183) : error A2006: undefined symbol : Vertical
newDOS2.asm(185) : error A2031: must be index or base register
newDOS2.asm(190) : error A2031: must be index or base register
newDOS2.asm(195) : error A2006: undefined symbol : LowerRow
newDOS2.asm(196) : error A2031: must be index or base register
newDOS2.asm(199) : error A2006: undefined symbol : Horizontal
newDOS2.asm(202) : error A2031: must be index or base register
newDOS2.asm(207) : error A2006: undefined symbol : LeftCol
newDOS2.asm(208) : error A2031: must be index or base register
Press any key to continue . . .
Title: Re: adding a border
Post by: bcddd214 on December 24, 2011, 12:36:51 PM
I fixed most of the errors but I am pretty sure I did it incorrectly. To get the program to recognize the variable, I had to give global variables, I understand this to be a bad thing.
also when I reduces the code to 16 bit, the eax register becomes ax which does not support indexing, to I flip everything from AX to SI and that got rid of those error but I think my logic is jacked up.
I was trying everything that I could last night.

http://pastebin.com/pHJHMiEt

C:\Users\WUZAMA~1\Desktop\asm\ASM-PR~1>make16 newDOS2
Assembling: newDOS2.asm
newDOS2.asm(43) : error A2008: syntax error : ConsoleScreen
newDOS2.asm(136) : error A2119: language type must be specified
newDOS2.asm(137) : error A2006: undefined symbol : WriteConsoleOutput
newDOS2.asm(245) : error A2136: too many arguments to INVOKE
newDOS2.asm(171) : error A2006: undefined symbol : ConsoleScreen
Press any key to continue . . .
Title: Re: adding a border
Post by: MichaelW on December 24, 2011, 01:32:37 PM
Quote from: bcddd214 on December 24, 2011, 12:36:51 PM
I fixed most of the errors but I am pretty sure I did it incorrectly.
In other words you didn't fix the errors, and you introduced some new ones.

Quote
To get the program to recognize the variable, I had to give global variables, I understand this to be a bad thing.
Some global variables are unavoidable. I think you should not worry about using global variables for this.

Quote
also when I reduces the code to 16 bit, the eax register becomes ax which does not support indexing, to I flip everything from AX to SI and that got rid of those error but I think my logic is jacked up.
These two statements:

.model      small
.386p

Taken together, tell MASM to create 16-bit code. Put simply, the main thing that differentiates 16-bit code from 32-bit code is the size of the offset addresses - 16 bits for 16-bit code and 32 bits for 32-bit code. You can use 32-bit registers for indirect memory operands in 16-bit code and by doing so you eliminate most of the limitations of indirect memory operands in 16-bit code. If you had read and understood the Indirect Memory Operands section of the MASM Programmer's Guide, that I took my time to provide a link to, you would have know that, and you would have known that substituting AX for EAX was a waste of time. That said, using SI should be workable, assuming that everything else is right.

Quote
I was trying everything that I could last night.
Including things that make no sense.

And WriteConsoleOutput is a Windows API function, and as such is 32-bit code. You cannot mix 16-bit code and 32-bit code in this way. You need to go with one or the other.

Title: Re: adding a border
Post by: bcddd214 on December 24, 2011, 02:07:58 PM
.model      small
.386p

has always been there and their presence did nothing to solve the error. I tried many thing until google told me about AX not index and an index error is what I was having.
It there another way to fix this?
I would prefer NOT to switch it to SI, but that is the only thing that worked.
Title: Re: adding a border
Post by: bcddd214 on December 24, 2011, 02:09:56 PM
'And WriteConsoleOutput is a Windows API function'   yup, I was telling another gentleman that yesterday.
I need assistance porting it because I am trying to use partial 32 bit and that is a no no...

Do you have a 16 template I could use?