Skip to content

Instantly share code, notes, and snippets.

@tylor
Last active December 16, 2015 18:09
Show Gist options
  • Save tylor/5475887 to your computer and use it in GitHub Desktop.
Save tylor/5475887 to your computer and use it in GitHub Desktop.
Old assembly program
0AEA:0100 mov cx,0 # move 0 into CX
0AEA:0103 mov ah,1 # move 1 into AH
0AEA:0105 int 21 # interrupt: read character (AH=1), drop in AL
0AEA:0107 push ax # push AX (AH, AL) onto stack
0AEA:0108 inc cx # increment CX
0AEA:0109 cmp al,20 # compare AL with 0x20 (space character)
0AEA:010B jnz 105 # jump if not zero to 0105
0AEA:010D pop dx # pop stack into DX
0AEA:010E sub dx,20 # subtract 0x20 from DX (making characters uppercase)
0AEA:0111 mov ah,2 # mov 2 into AH
0AEA:0113 int 21 # interrupt: output character (AH=2) from DL (DX)
0AEA:0115 loop 10D # decrement CX and if 0 then continue, else goto 010D
0AEA:0117 int 20 # exit program
This program should take characters lowercase until a space character,
make them uppercase, and print them backwards: hello<space> becomes OLLEH
This program is run from DEBUG in MS-DOS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment