Just started to learn assembler, gave a laboratory, the task is

In the data segment, the following numbers are placed: -1, 2, + 128,129, + 32769 in the minimum format necessary for them. Expand the first two numbers to the format of the word and write down after the original numbers. ON THE PLACE OF THE SENIOR BYTE THIRD NUMBER RECORD THE SYMBOL '#', ON THE PLACE OF THE YOUNGER BYTE - THE SYMBOL '1'.

The problem is that I do not know how to turn to the 3rd number (maybe I did it). Here is my code, it even started (tasm / tlink / tb).

.386 dseg segment use16 a db -1 b db 2 с dw +128 d dd +32769 dseg ends ;Π—ΠΠŸΠ˜Π‘ΠΠ› eseg segment use16 ea dw ? eb dd ? ec dd ? ed dd ? eseg ends cseg segment use16 assume ds:dseg, cs:cseg ; Π·Π°Π³Ρ€ΡƒΠ·ΠΊΠ° рСгистров-ΡƒΠΊΠ°Π·Π°Ρ‚Π΅Π»ΠΉ сСгмСнтов ds ΠΈ es m1: mov cx, dseg mov ds, cx mov cx, cseg mov es, cx ; Ρ€Π°ΡΡˆΠΈΡ€ΠΈΠΌ ΠΏΠ΅Ρ€Π²Ρ‹Π΅ Π΄Π²Π° числа Π΄ΠΎ Ρ„ΠΎΡ€ΠΌΠ°Ρ‚Π° слова, запишСм Π² es:ea movzx ax, ds:a movzx bx, ds:b mov es:ea, ax mov es:eb, bx ; Π—Π°ΠΌΠ΅Π½ΠΈΠΌ 3 число максимум Π½Π° Ρ€Π΅ΡˆΠ΅Ρ‚ΠΊΡƒ, ΠΌΠΈΠ½ΠΈΠΌΡƒΠΌ Π½Π° 1 lea esi,d mov [esi], byte ptr '1' add esi,3 mov [esi], byte ptr '#' ; Π—Π°Π²Π΅Ρ€ΡˆΠ΅Π½ΠΈΠ΅ исполнСния mov ah, 4ch int 21h cseg ends end m1 
  • When you perform the mov eax, '#' operation, you enter the grid code in the low byte of the ax register, resetting the previous value. If you want to place the grid in the high byte eax, then after moving the grid code, you need to cycle the bits to the left. - Komdosh
  • @komdosh Thank you, but I don’t know how to do it 'mov shl, eax,' # '', right? - papalimer
  • one
    First you need to determine the size of the number. If it says +32769, then apparently there is a number with a sign that, with such a value of 2 bytes, can no longer be written, then it must be done by DD. If you want to work with it as with eax, then first we put in eax '#' the usual mov, then we shift it to the left by 24 bits, i.e. shl eax, 24 and then enter '1' in AL. BUT I would understand the question so that you are asked to put in the place of these numbers, i.e. into RAM, not into the register .... By the way, the sign +128 one byte does not fit ... - Mike
  • @Mike Thank you very much, I'll try to fix it now, and how to fix it. I think there will be more questions - papalimer
  • one
    If you decide to write in memory, then I suggest not to pervert, but write down one byte, as requested, that is, something like lea esi, d (or offset d, depending on how your assembler thinks). mov [esi], byte ptr '1'; add esi, 3 (increment the address by 3 bytes); mov [esi], byte ptr '#' - Mike

0