In principle, squaring a register value is not difficult:
mov ax, [var] mov cx, [var] mul cx // square of answer is in DX:AX
But I thought of it - a course that I study very well Assembly for prizes; the difference even on one line less can cost up to 5 points.
I understand that this is micro-optimization, but will the following code work the same way ?:
mov ax, [var] mul ax // is answer still in DX:AX ?
I suggest a much simpler way of expressing my question: is AX (or AL / AH) a valid parameter for commands muland imulin assembly 8086?
mul
imul
Yes, mul axputs ax*axin dx:ax.
mul ax
ax*ax
dx:ax
mul ax, DX: AX = AX * AX , , AX, , , mul bx, BX .
, mul al (mul ah), AX = AXAX, AX = ALAL ( AX = AL * AH), , AX 255, AX, ( AH).
Source: https://habr.com/ru/post/1755218/More articles:Set visible fields of Django ModelForm at runtime? - pythonMySQL: do basic search - pythonNSTimer not working without UIApplication? - objective-cXerces-C ++ DOM node row / column location - c ++I18n website: how can I determine the language? - browserHow to end sessions after a certain amount of time in PHP? - phpASP.NET Form Validation Script - c #Outside of NARC: when to save, when to assign, when to copy - memory-managementCreating an SSH connection in a program? - cIs there a semantic difference between element property syntax and atrribute attribute syntax? - c #All Articles