简体   繁体   English

如何实施新生产线

[英]how to implement a new line

i'm working in text mode 80x25 and am expecting some string of characters terminated by 0 to print (no CRLF before). 我正在以80x25的文本模式工作,并且期望以0结尾的某些字符串输出(之前没有CRLF)。 how can I then jump to the next line? 然后我如何跳到下一行? what i actualy need is aligning the es:edi (0:b8000) offset to next multiplier of 160, but i have no idea how to do it somehow smart. 我实际上需要的是将es:edi(0:b8000)偏移量与下一个160乘数对齐,但是我不知道如何以某种方式做到这一点。 if you have already done this or have any idea please share it with me or give me a hint. 如果您已经这样做或有任何想法,请与我分享或给我一个提示。 i don't want any interrupts and solutions without division are prefered. 我不希望有任何中断,并且最好采用无除法的解决方案。 thx stu 斯图

As Anders said, I'd do something like: 正如安德斯所说,我会做类似的事情:

nextlineoffset = offset + (160 - ((offset + 160) mod 160))

That is, 那是,

  1. Add a line to offset 添加一行以抵消
  2. Subtract away the extra offset 减去多余的偏移

It uses one division, but does away the need of a multiplication. 它使用一个除法,但是不需要乘法。

How about a switch -like construction? switch式结构怎么样? If you'r only interested in 160 character chunks on an 80x25 screen there are only thirteen cases to account for, and that should be a manageable (and renderable) sequence of CMP and conditional jumps. 如果您只对80x25屏幕上的160个字符块感兴趣,则只考虑13种情况,那应该是CMP和条件跳转的可管理(可渲染)序列。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM