汇编语言如何编程16进制1位数相加?
input A,B
case A of
'0'。。'9': h1 := ord(A)-ord('0');
'A'。。'F':h2 := ord(A)-ord('A')+1;
end;
case B of
'0'。 。'9': h1 := ord(A)-ord('0');
'A'。。'F':h2 := ord(A)-ord('A')+1;
end;
h := h1+h2;
case h of
'0'。 。'9': print(chr(0+ord(h));
'A'。。'F': print(chr(ord('A')+ord(h)-1);
end;
。全部
input A,B
case A of
'0'。。'9': h1 := ord(A)-ord('0');
'A'。。'F':h2 := ord(A)-ord('A')+1;
end;
case B of
'0'。
。'9': h1 := ord(A)-ord('0');
'A'。。'F':h2 := ord(A)-ord('A')+1;
end;
h := h1+h2;
case h of
'0'。
。'9': print(chr(0+ord(h));
'A'。。'F': print(chr(ord('A')+ord(h)-1);
end;
。收起