0

I've written a 1100 lines Assembly code with Macros in emu8086 (without Macros it would be around 2700 lines) and compiling this program takes arround 2 minutes. It gives me 8 passes. I'd like to ask, whether it is possible to cut down on compile time?

Deividito
  • 23
  • 1
  • 9
  • 1
    without macros you can have subroutines instead of copying the code all around... Anyway, just use some real assembler, like MASM/TASM (will need minimal changes to the code probably), or NASM (you would have to fix all offset vs value memory accesses and some other things, basically reviewing every line) – Ped7g Nov 28 '17 at 10:48
  • Use a better assembler. emu8086 is not very good. I like NASM, but it uses different syntax than emu8086/TASM. Also, [what kind of chip you got in there, a Dorito?](https://www.youtube.com/watch?v=qpMvS1Q1sos) – Peter Cordes Nov 28 '17 at 10:48
  • Using TASM gives 100 errors to me lol. Basically because of conditional jumps... – Deividito Nov 28 '17 at 11:00
  • Do you have conditional jumps that are too far for a SHORT jump to reach? [JCC NEAR (rel16) is a 386 feature](http://www.posix.nl/linuxassembly/nasmdochtml/nasmdoca.html), but probably emu8086 is assembling `jl somewhere` to `jnl @nojump` / `jmp somewhere` / `@nojump:` (i.e. conditionally jumping over a `jmp rel16` which can reach). TASM treats lots of other things as pseudo-instructions when you don't use `.186`, e.g. [`rol ax,8` turns into 8 `rol ax`](https://stackoverflow.com/questions/26318043/assembly-bubble-sort-for-sorting-string/26324630?noredirect=1#comment81930102_26324630). – Peter Cordes Nov 28 '17 at 11:11
  • Do you only want your code to run to run in emu8086, or do you want it to run on modern CPUs in 16-bit mode? – Peter Cordes Nov 28 '17 at 11:14
  • It doesn't matter where i run my code. Maybe I could try to compile exe file in emu, and then copy .exe file to TASM folder and run it? It worked for my friend, but not for me. I take make.exe_ file, copy to TASM folder, delete underscore and in DosBox I write "make" but it says that it is an illegal command – Deividito Nov 28 '17 at 12:17
  • You will have to add syntax sugar to that source to make it valid TASM source. Like allowing 80286 or 80386 instructions (if you are targetting dosbox emulator, it's safe to to use even 80586, but 80386 has already pretty much everything useful for learning x86 hand written asm basics), so using directive `.386` somewhere at start, then pick up correct model like probably `.model small`, etc.. May take 1-3h to fix all of that. But it should be do-able, especially if you can consult with somebody with TASM experience. The "exe" is final binary, you can't do anything with TASM with it. – Ped7g Nov 28 '17 at 13:09
  • You can check for example my answer https://stackoverflow.com/a/47458474/4271923 for working TASM source with all kind of syntax sugar (I used TASM v4.1 to compile it and TLINK v5.0 to link .exe file). Weird, I didn't put there the command line used to build it :/ ... usually I do. I used exactly: `tasm /m5 /w2 /t /l wordgame` `tlink wordgame.obj` with asm file name: `wordgame.asm` – Ped7g Nov 28 '17 at 13:17
  • Thanks guys for your help! My name was inappropriate. Now my code works! – Deividito Nov 28 '17 at 14:16

0 Answers0