I have a very long code line in ASM (a very long array declaration).
Is it posible to break it into multiple lines?

thanks!

Dani AI

Generated

Short answer: yes. The most portable, low‑risk approach is to break the array into multiple data directives (put a new db on each source line) so each line contains a logical row of the bitmap — exactly the idea suggested and what confirmed worked in EMU8086. is also correct that some assemblers provide a line‑continuation character, but that behavior is tool‑specific and not as portable as repeating the data directive or using a repetition operator.

Example patterns you can use:

; split into logical rows (portable)
Symbls db 0,1,2,3,4,5,6,7
       db 8,9,10,11,12,13,14,15

; use DUP to compress long runs of the same byte
ZeroRow db 8 dup(0)

Practical tips and cautions: keep each source line to one logical row and add a short end‑of‑line comment with the row index or width for readability; many assemblers have a source‑line length limit so splitting avoids assembler errors; trailing commas or missing commas at line breaks are a common source of syntax errors — match commas carefully; dup syntax varies slightly by assembler, so test a small example if you plan to use it. For larger bitmaps consider generating the db data from a small script (to avoid manual errors) or check whether your assembler supports including raw binary data.

Recommended Answers

All 5 Replies

Which version of ASM?
Do you have an example?

It's an 8086 assembly. I'm working with EMU8086 V4.07
I have a long array holding some bitmap of Icons. I'ts decleration looks like that:

Symbls db 0,0,0,0,0,0,0,0, 0,2,2,0,0,2,2,0, 0,0,2,2,2,2,0,0, 2,2,2,2,2,2,2,2, 0,0,2,2,2,2,0,0, 0,2,2,0,0,2,2,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0Fh,0Fh,0,0Fh,0Fh,0,0, 0,0Fh,0Fh,0,0Fh,0Fh,0,0, 0Fh,0Fh,0Fh,0Fh,0Fh,0Fh,0Fh,0, 0,0Fh,0Fh,0,0Fh,0Fh,0,0, 0Fh,0Fh,0Fh,0Fh,0Fh,0Fh,0Fh,0, 0,0Fh,0Fh,0,0Fh,0Fh,0,0, 0,0Fh,0Fh,0,0Fh,0Fh,0,0, 0,0,0,0,0,0,0,0, 0,1,1,1,1,1,0,0, 1,1,0,0,0,1,1,0, 1,1,0,1,1,1,1,0, 1,1,0,1,1,1,1,0, 1,1,0,1,1,1,1,0, 1,1,0,0,0,0,0,0, 0,1,1,1,1,0,0,0, 0,0,0,0,0,0,0,0, 0,7,0,0,0,0,0,0, 7,7,7,0,0,0,0,0, 0,7,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,

Place another db at the beginning of the new line and another one at the beginning of the next line.

Some assemblers allow you to do that by terminating a line with a backslash, as in:

Symbls db 0,0,0,0,0,0,0,0, 0,2,2,0,0,2,2,0, 0,0,2,2,2,2,0,0, 2,2,2,2,2,2,2,2, \
0,0,2,2,2,2,0,0, 0,2,2,0,0,2,2,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, \
0,0Fh,0Fh,0,0Fh,0Fh,0,0, 0,0Fh,0Fh,0,0Fh,0Fh,0,0, 0Fh,0Fh,0Fh,0Fh,0Fh,0Fh,0Fh,0, \
0,0Fh,0Fh,0,0Fh,0Fh,0,0,

Place another db at the beginning of the new line and another one at the beginning of the next line.

Thank U both!
the db thing works well

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.