1 year ago

#298966

test-img

kianhun4167 chai

Retrieve data from an array

So, basically I just want to display the first data from array which is userbalanceIndex1 from userbalanceIndex.

But I get an error which is

DEMO.ASM(29): Out of memory
29 line: mov bl,(userbalanceIndex +1)

Here is my code:

.model small
.stack 100H
.data
    userbalanceIndex db usrbalance1, usrbalance2, usrbalance3, usrbalance4
    usrbalance1 Db 1
    usrbalance2 Db 9
    usrbalance3 Db 6
    usrbalance4 Db 0

.code


OUTPUT MACRO DIGIT
 MOV AH, 02H
 MOV DL, DIGIT
 INT 21H
ENDM

main proc
    MOV AX,@DATA 
    MOV DS,AX

    mov al, userbalanceIndex
    mov cx, 0
    a:  
        inc userbalanceIndex
        mov bl, (userbalanceIndex + 1)
        loop a
        
    OUTPUT bl
    mov ah, 4ch
    int 21h
main endp
end main

arrays

assembly

nasm

dosbox

0 Answers

Your Answer

Accepted video resources