Re:A 28-byte “hello, world” program assembled with DEBUG.EXE...
by q-big on Sunday October 30, 2022 @05:09PM
(#33398738)
This 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/60805758UPDATE: Under https://news.ycombinator.com/item?id=33398592 userbinator posted an additional possible optimization.
Re:A 28-byte “hello, world” program assembled with DEBUG.EXE...
by ralferoo on Sunday October 30, 2022 @06:11PM
(#33399395)
Not a size optimisation, but a performance optimisation...
INT 21
RET
can be replaced with JP 5
Re:A 28-byte “hello, world” program assembled with DEBUG.EXE...
by blueflow on Sunday October 30, 2022 @07:02PM
(#33399952)
That 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.
Re:A 28-byte “hello, world” program assembled with DEBUG.EXE...
by jart on Monday October 31, 2022 @01:33AM
(#33402389)
Jump parity? But according to http://www.fysnet.net/yourhelp.htm the parity flag is only set in DOS 7.1+
MOV AH, 9
MOV DX, str
INT 21
MOV AH, 0
INT 21
Str:
DB 'hello, world', d, A, '$'