Assembler, help please

  • Replies:1
  • Forum posts: 1

Nov 5, 2021, 10:44:46 AM via Website

In a 20-character feed, count the number of a characters A.

Reply
  • Forum posts: 1,459

Nov 5, 2021, 12:58:41 PM via Website

assume ds:data,cs:code,ss:stack

data segment
str db 'AbBTo09A1ACAHjsjidsa','$'
count db 0
data ends

stact segment para stack
buffer db 128 dup(0)
stact ends

code segment

start:
mov ax,data
mov ds,ax
mov cl,0
lea si,str

lp1:
mov al,[si]
cmp al,'A'
jz sum
cmp al,'$'
jz exit
inc si
jmp lp1

sum:
inc cl
inc si
jmp lp1

exit:
mov count,cl
mov ah,4ch
int 21h

code ends
end start

Download size < 0.08 MB. But also Ad-free, Pure & Accurate enough.
The minimalist app is available on Google Play https://goo.gl/ws42fN
Your 5-star is appreciated. Blog: https://okblackcafe.blogspot.com

Helpful?
Reply