will
will

Reputation: 1

Assembly Array data storing

Here is a new update on what i'm doing currently. I'm confused on how to use the data i stored in S2 to search the same word in the whole screen. If found highlight the word.

DOSBOX - compiler : A86

org 100h
;-----------------------------------------------------
lea bp, S1    
mov cx, 35 
mov al, 1   
mov ah, 13h 
mov bh, 0 
mov dl, 0
mov dh, 25
mov bl, 7
int 10h   
;----------------------------------------------------------            ; Asks input'
mov di,1
start:
mov ah, 0
int 16h
mov dx,ax
mov ah, 0eh
cmp dx,4d00h 
je start2
int 10h
mov S2[di], al
inc di
jmp start 

start2 :
mov cx,di
mov di,1
mov si,0

relop :
mov ah,[si]
cmp ah,S2[di]

mov al, 13h
    mov ah, 0
    int 10h     ; set graphics video mode. 
    mov al, 1100b
    mov cx, 10
    mov dx, 20
    mov ah, 0ch
    int 10h     ; set pixel. 

inc di
add si,2
je  relop 

mov ah, 13h 
lea bp, S2
mov al, 1
mov bh, 0
mov bl, 7
mov dl, 0
mov dh, 25
int 10h 



MOV AH, 4CH
INT 21H







S1 DB "EENTER THE WORD TO FIND ON SCREEN : "  
S2 db 1 dup (?) 







; ========= data ===============

I can't use int 21h for input and output but only to end the program ( return )

Upvotes: 0

Views: 1379

Answers (1)

Fifoernik
Fifoernik

Reputation: 9899

mov dl, 0
mov dh, 25

You're printing the prompt beyond the screen! Coords are zero-based and for the row they range from 0 to 24 on the standard text screen.


 mov si,0
relop :
 mov ah,[si]
 cmp ah,S2[di]
 mov al, 13h
 mov ah, 0
 int 10h     ; set graphics video mode. 

If you want to read from the screen then you definitely should not be setting up a new screen on each iteration of this retrievel loop! Furthermore initializing the SI register to 0 won't get to the first character of the inputted word.

Solution:

Display your 35 character long prompt at the first row of the screen (mov dh,0). Now you know the inputted word will be at video memory offset address 70, but in the video memory segment.

 mov ax,0B800h
 mov es,ax
 mov si,70
relop :
 es mov ah,[si]  <-- This is the ASCII code of the 1st inputted character

Best also make these corrections:

S1 DB "ENTER THE WORD TO FIND ON SCREEN : "  
S2 db 44 dup (?)

Upvotes: 1

Related Questions