That's "discard", not "skip". Once discarded, they can't be recovered. The arguments for each additional string must, therefore, come after the string that requires the arguments, and before the string for the next cargo.George wrote:We have skip words in stack command for stringsDaleStan wrote:Okay... So that's *completely* not going to work.
The textref stack is filled for all accepted cargos before the line is drawn.
Yes, but those three strings require six stack bytes (Yes, six.) each, before any additional arguments. That's 18 bytes (of 24) for three cargo strings. This leaves (! I got it wrong.) 6 bytes -- 2 bytes per cargo (on average, of course) for any additional arguments. With 2 cargos, you'd have 12 bytes, 6 per cargo. With 1 you'd have 18.George wrote:Because currently we expect only 3 strings to use stack, I think we can take it this way unless we get an easy way to have different stacks for every string.
This is enough space to provide the stockpile sizes for three incoming cargos, and oodles of spare space when you have fewer cargos.
The production side is much less restricted. Although it only has 22 bytes total space, it also only has up to two cargos, and only requires four bytes per cargo, not six. (So 7 each for two and 18 for one.)
For the first cargo, 100h would contain 6, 101h would contain words 1 and 2 (1 in the low word, 2 in the high) and 102h would contain word 3 in its low word.George wrote:Sorry, a bit confused with description. If a string for cargo 1 needs words 1, 2, 3 in stack, and a string for cargo 2 needs words 4, 5, 6, than what should go to registers?DaleStan wrote:Would "Place the number of additional bytes required in (the low byte of) register 100h. The bytes will be copied starting from the low byte of register 101h." work?
For the second cargo the same, except that 101h and 102h contain words 4/5 and 6.
Of course, this would only fit if you didn't have a third cargo.
I would have preferred to put the count in the callback return, instead of in 100h, but I don't see how I can manage that while maintaining backwards compatibility.
For the code you gave me, the relevant sprite would become (note that I changed the width; sign extension is either correct or not an issue here.)
Code: Select all
-1 * 32 02 0A DE 85
1A 20 \w2 \2sto
1A 20 \wx100 \2rst
00 20 FF FF \2sto
1A 00 \wx101
01 DE 80 00 00 00 00 DE 80
You can allot the stack space however you like, provided you remember that each cargo type requires six (or four) bytes, and you only have 24 (or 22) total.George wrote:I'd prefer 10 words per all the strings, than 1 per string, so 1 string could use 5 wprds in stack, while the could not use it.
EDIT: Actually, those limits only apply for industries without production callbacks, and in the fund-industry window. When there's a production callback, the limits are lower: unused cargo slots require 2 bytes there, not zero.