I do it in TASM, I have a question because I am not sure about the correctness of the code. Here is the task. In the data segment, the numbers are placed in succession: -1, 2, + 128,129, + 32769 in the minimum required format. 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'.

.386 dseg segment use16 a db -1 b db 2 c dw +128 d dd +32769 ea dw ? eb dw ? ec dw ? ed dd ? dseg ends cseg segment use16 assume ds:dseg, cs:cseg ; Π·Π°Π³Ρ€ΡƒΠ·ΠΊΠ° рСгистров-ΡƒΠΊΠ°Π·Π°Ρ‚Π΅Π»Π΅ΠΉ m1: mov cx, dseg mov ds, cx ; Ρ€Π°ΡΡˆΠΈΡ€ΠΈΠΌ ΠΏΠ΅Ρ€Π²Ρ‹Π΅ Π΄Π²Π° числа Π΄ΠΎ Ρ„ΠΎΡ€ΠΌΠ°Ρ‚Π° слова movzx ax, ds:[a] movzx bx, ds:[b] mov ds:ea,ax mov ds:eb,bx ; Π—Π°ΠΌΠ΅Π½ΠΈΠΌ 3 число, ΠΌΠ°ΠΊΡΠΈΠΌΠ°Π»ΡŒΠ½Ρ‹ΠΉ Π±Π°ΠΉΡ‚ Π½Π° Ρ€Π΅ΡˆΠ΅Ρ‚ΠΊΡƒ, ΠΌΠΈΠ½ΠΈΠΌΠ°Π»ΡŒΠ½Ρ‹ΠΉ Π½Π° 1 ;Π’Π£Π’ Π£ ΠœΠ•ΠΠ― Π’ΠžΠŸΠ ΠžΠ‘!!! mov cx, ds:c mov ch,'#' mov cl,'1' ; Π—Π°Π²Π΅Ρ€ΡˆΠ΅Π½ΠΈΠ΅ исполнСния mov ah, 4ch int 21h cseg ends end m1 
  • one
    And run and check you what's stopping you? - Vladimir Martyanov
  • @ Vladimir Martiyanov I just get that ds: 000C (where the third number becomes 0). So it turns out that the code does not seem to work quite right, but I don’t know where the error is - papalimer
  • Use the debugger ... - Vladimir Martyanov
  • @ Vladimir Martiyanov: Well, in TD, it turns out that for some reason I have a value of 0 in this memory address. - papalimer
  • one
    Here you have a sequence of commands: mov cx, ds:c; mov ch,'#'; mov cl,'1' mov cx, ds:c; mov ch,'#'; mov cl,'1' mov cx, ds:c; mov ch,'#'; mov cl,'1' (semicolon is just a separator here). You considered the data in the register, replaced the high and low bytes, and so left in the register. Then you have the "completion of execution". How do you think something will appear in the variable ec ? - insolor

1 answer 1

 .386 dseg segment use16 a db -1 b db 2 c dw +128 d dd +32769 ea dw ? eb dw ? ec dw ? ed dd ? dseg ends cseg segment use16 assume ds:dseg, cs:cseg ; Π·Π°Π³Ρ€ΡƒΠ·ΠΊΠ° рСгистров-ΡƒΠΊΠ°Π·Π°Ρ‚Π΅Π»ΠΉ сСгмСнтов ds ΠΈ es m1: mov cx, dseg mov ds, cx ; Ρ€Π°ΡΡˆΠΈΡ€ΠΈΠΌ ΠΏΠ΅Ρ€Π²Ρ‹Π΅ Π΄Π²Π° числа Π΄ΠΎ Ρ„ΠΎΡ€ΠΌΠ°Ρ‚Π° слова, запишСм Π² es:ea movzx ax, ds:[a] movzx bx, ds:[b] mov ds:ea,ax mov ds:eb,bx ; Π—Π°ΠΌΠ΅Π½ΠΈΠΌ 3 число максимум Π½Π° Ρ€Π΅ΡˆΠ΅Ρ‚ΠΊΡƒ, ΠΌΠΈΠ½ΠΈΠΌΡƒΠΌ Π½Π° 1 mov ch,'#' shl cx,8 mov cl,'1' mov ds:ec,cx ; Π—Π°Π²Π΅Ρ€ΡˆΠ΅Π½ΠΈΠ΅ исполнСния mov ah, 4ch int 21h cseg ends end m1