4

I'm new in 8086 Assembly programming and I have a question.

I have a string which size is about 1400 characters. When I'm trying to define it like:

.data
mystring DB '(string with 1400 characters)'

I'm getting an error

"Unterminated string".

I'm using emu8086 emulator. I think my string doesn't fit in DB. Is there any way to keep huge string in byte?

Fifoernik
  • 9,779
  • 1
  • 21
  • 27
onurcanak
  • 109
  • 1
  • 9
  • 4
    I've never used emu8086. It could be that the string is effectively too long or that you haven't escaped something (assuming that single quotes are ok to emu8086). If it's really a length problem, just split the string into multiple `db` declarations. – Margaret Bloom Mar 04 '18 at 12:51
  • It is possible that the emu8086 assembler has a line length limit. As Margaret Bloom already said, you need to split up your string. – fuz Mar 04 '18 at 12:56
  • @MargaretBloom I think I need to split the string thank you – onurcanak Mar 04 '18 at 12:58
  • @fuz I consider it as a worst case but I think I should do that – onurcanak Mar 04 '18 at 12:59
  • 1
    Note the only change you need is the split. It will be exactly the same in memory, so no code changes required. – Jester Mar 04 '18 at 13:06

1 Answers1

8

I've checked it manually and it looks like the max length is 1010.

Also on one of the links about emu8086 this can be found:

The expansion of DUP operand should not be over 1020 characters! (the expansion of last example is 13 chars), if you need to declare huge array divide declaration it in two lines (you will get a single huge array in the memory). - source

But as it was suggested in the comments you can put two, or more lines adjacent to each other and in the memory they will be consecutive, with the same layout as if you'd used one large line.

mystring      DB '<1010>*A'
mystring_cont DB 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
Fifoernik
  • 9,779
  • 1
  • 21
  • 27
Paweł Łukasik
  • 3,893
  • 1
  • 24
  • 36