assembly - Memory usage in assembler 8086 -
i made program in assembler 8086 class , working fine. beside making working program have make use low memory possible. give me tips in aspect? should write , should avoid?
the program supposed first print letter on screen , in avery new line 2 more of letters of next letter in alphabet, stop @ z , after pressing key end program. stopping until key pressed i'm using: mov ah,00h int 16h way it?
most of want can done in 0 memory (counting data, not code itself). in general:
- use registers rather variables in memory
- do not use push/pop
- do not use subroutines
but interact os, need make bios calls and/or os system calls; these require memory (typically small amount of stack space). in case, have to:
- output characters screen
- wait keypress
- exit os
however, if serious doing in minimal memory, there few hacks can use.
output characters screen
on pc, in traditional text mode, can write characters straight video ram (address b800:0000 , further). requires 0 memory.
wait keypress
the cheapest way wait change of bios keyboard buffer head (a change of 16-bit content @ address 041a hex). requires 0 memory. see also: http://support.microsoft.com/kb/60140
exit os
try simple ret
; not recommended might work in versions of ms-dos. uglier escape jump f000:fff0
, reboot machine. that's guaranteed work in 0 memory.
Comments
Post a Comment