4 ms·
You are right and sister comment to this one is wrong. Thusly: MOV AH, 9 MOV DX, str INT 21 MOV AH, 0 INT 21 Str: DB 'hello, world', d, A, '$'
by dmitrygr 4y ago
You are right and sister comment to this one is wrong. Thusly:
MOV AH, 9
MOV DX, str
INT 21
MOV AH, 0
INT 21
Str:
DB 'hello, world', d, A, '$'
- q-big 4y agoThis program can be simplified further: MOV AH, 9 MOV DX, str INT 21 RET str: DB 'hello, world', d, A, '$' Why can MOV AH, 0 INT 21 be replaced by RET? Here is the answer: https://stackoverflow.com/a/60805758 https://stackoverflow.com/a/60805758 UPDATE: Under https://news.ycombinator.com/item?id=33398592 https://news.ycombinator.com/item?id=33398592 userbinator posted an additional possible optimization.
- ralferoo 4y agoNot a size optimisation, but a performance optimisation... INT 21 RET can be replaced with JP 5
- blueflow 4y agoThat mnemonic would be "JMP" on x86. At address 5 in the PSP is the CP/M-style syscall entry point, it is not advised to not use it because it relies on the A20 line being short-circuited to zero, which cannot be relied on in later MS-DOS versions. I don't see why this would be faster than using RET directly and having the INT 20 opcode at address 0 do the work.
- jart 4y agoJump parity? But according to http://www.fysnet.net/yourhelp.htm http://www.fysnet.net/yourhelp.htm the parity flag is only set in DOS 7.1+