Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

Turbo Pascal overlays & NASM Preprocessor (Announce)

posted by ecm Homepage E-mail, Düsseldorf, Germany, 05.03.2020, 16:42

> Probably not a great example use for overlays, but I tried anyways. (I
> don't know OOP "design patterns" at all.) It could definitely be a useful
> feature, but not so much here. (Remember I rebuilt old NASM 0.98.39 with
> Turbo C++ 1.01? I assume NASM's preprocessor would make a great overlay
> since you only need it at the beginning. But I have no idea how to fix that
> yet. I still need to read the physical manuals there.)

Actually, the NASM preprocessor is run on each pass of the assembler. That's why my sources won't work with nasm -E (preprocess-only mode). For example, I often use constructs like %assign foo $ - $$. Using equ and *then* %assign allows even to learn of numbers that cannot be evaluated (as a critical expression) at that point in the source yet. I barely use the latter as yet, though.

For an example of the former, consider the _386 patch section macro in debug.mac. It uses %assign and then after the to-be-patched part %rep, each with $ (current assembly address).

During the work to split the data/entry section from the code section (and address them using different segments), I had to enable the _WPT_LABELS option, which avoids the %assign trickery in the patch macro. As noted there, this made the assembly take more than 2 minutes. Therefore I disabled this option as I finished the split.

---
l

 

Complete thread:

Back to the forum
Board view  Mix view
22632 Postings in 2109 Threads, 402 registered users, 414 users online (0 registered, 414 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum