This code builds a Small Model .EXE program, whick allocates several
segments to the program, .stack 100h allocates a 256-byte stack segment and
will initialize SS : SP when the .EXE header is read by the loader,
mov ax, @data
mov ds, ax
is necessary to load DS with the segment address of the data segment
because it will only be known at run-time, this portion of code
will be touched up with the actual address of the segment using
the relocation table after the programs memory has been allocated.
the ptr operator is requisite when using indirect addressing mode,
cmp byte ptr [BX], 'A'
simply means compare byte-sized memory operand 'pointed' to by BX
to the immediate value 65 or 'A'.
DS==ES right when the .EXE (MZ) gains control, they are initialized
with the segment address of the PSP, useful for locating your
program segment prefix.
For a intro look up TASM or Turbo-Assembler Syntax, and
check out the NGASM 8086 Tutorial.
that code actually checks if the letter is uppercase, and if it is, it will change it to lowercase, or the other way around, i don't know how exactly that program does that, can you explain it to me,..
and what if I want to code it, to check if it is lower then change it to upper, and check if upper then change it to lower... how am i suppose to do that..
Sorry about that, I was explaining much of the red-tape that
accompanied the 8086 DOS based assembly language source code.
cmp byte [bx], 'A'
jb is_not ; check if byte at [bx] is lower than upper case 'A' value
cmp byte [bx], 'Z'
ja is_not ; check if byte at [bx] is above upper case 'Z' value
or byte [bx], 32 ; convert to lowercase
Your code is converting a string to all lowercase, but:
BX is uninitialized and
there is not check to ensure the toggled character is in fact a letter.
Other characters lie before, between and after the contiguous
set of letters.
Hope this helps...
if char is (jb) < 'A' or char is (ja) > 'Z' then it is not uppercase
and jumps to OK, otherwise it toggles bit five [ OR BYTE, 32 ]
XOR works to toggle this bit.