Home > front end >  Large array definition problem in emu8086
Large array definition problem in emu8086

Time:06-04

I want to draw the 200x200 sized picture that I have extracted the pixel coordinates to the screen using emu8086.I transfer the coordinates to the array and print to the screen, but I cannot print the entire array.When I checked the status, I noticed that the entire array was not memorized.How can I fix the problem or is there an alternative method? This is a required structure for my project.

My ASM code

 .stack 512
 .MODEL small 
DTSEG    SEGMENT
DATA_IN  DB 0Eh,0Fh,010h,011h,012h,013h,014h,02Bh,02Ch,02Dh,02Eh,02Fh,030h,031h,0Ah,0Bh,0Ch,0Dh,0Eh,0Fh,010h,011h,012h,013h,014h,015h,016h,017h,018h,027h,028h,029h,02Ah,02Bh,02Ch,02Dh,02Eh,02Fh,030h,031h,032h,033h,034h,035h,09h,0Ah,0Bh,0Ch,0Dh,0Eh,0Fh,010h,011h,012h,013h,014h,015h,016h,017h,018h,019h,1Ah,025h,026h,027h,028h,029h,02Ah,02Bh,02Ch,02Dh,02Eh,02Fh,030h,031h,032h,033h,034h,035h,036h,07h,08h,09h,0Ah,0Bh,0Ch,0Dh,0Eh,0Fh,010h,011h,012h,013h,014h,015h,016h,017h,018h,019h,1Ah,01Bh,024h,025h,026h,027h,028h,029h,02Ah,02Bh,02Ch,02Dh,02Eh,02Fh,030h,031h,032h,033h,034h,035h,036h,037h,038h,06h,07h,08h,09h,0Ah,0Bh,0Ch,0Dh,0Eh,0Fh,010h,011h,012h,013h,014h,015h,016h,017h,018h,019h,1Ah,01Bh,01Ch,023h,024h,025h,026h,027h,028h,029h,02Ah,02Bh,02Ch,02Dh,02Eh,02Fh,030h,031h,032h,033h,034h,035h,036h,037h,038h,039h,05h,06h,07h,08h,09h,0Ah,0Bh,0Ch,0Dh,016h,017h,018h,019h,1Ah,01Bh,01Ch,01Dh,022h,023h,024h,025h,026h,027h,028h,029h,032h,033h,034h,035h,036h,037h,038h,039h,03Ah,04h,05h,06h,07h,08h,09h,0Ah,0Bh,018h,019h,1Ah,01Bh,01Ch,01Dh,01Eh,021h,022h,023h,024h,025h,026h,027h,034h,035h,036h,037h,038h,039h,03Ah,03Bh,03h,04h,05h,06h,07h,08h,09h,019h,1Ah,01Bh,01Ch,01Dh,01Eh,01Fh,020h,021h,022h,023h,024h,025h,026h,036h,037h,038h,039h,03Ah,03Bh,03Ch,02h,03h,04h,05h,06h,07h,08h,1Ah,01Bh,01Ch,01Dh,01Eh,01Fh,020h,021h,022h,023h,024h,025h,037h,038h,039h,03Ah,03Bh,03Ch,03Dh,02h,03h,04h,05h,06h,07h,01Bh,01Ch,01Dh,01Eh,01Fh,020h,021h,022h,023h,024h,038h,039h,03Ah,03Bh,03Ch,03Dh,01h,02h,03h,04h,05h,06h,01Ch,01Dh,01Eh,01Fh,020h,021h,022h,023h,039h,03Ah,03Bh,03Ch,03Dh,03Eh,01h,02h,03h,04h,05h,06h,01Dh,01Eh,01Fh,020h,021h,022h,039h,03Ah,03Bh,03Ch,03Dh,03Eh,01h,02h,03h,04h,05h,01Eh,01Fh,020h,021h,03Ah,03Bh,03Ch,03Dh,03Eh,00h,01h,02h,03h,04h,05h,01Fh,020h,03Ah,03Bh,03Ch,03Dh,03Eh,03Fh,00h,01h,02h,03h,04h,03Bh,03Ch,03Dh,03Eh,03Fh,00h,01h,02h,03h,04h,03Bh,03Ch,03Dh,03Eh,03Fh,00h,01h,02h,03h,04h,03Bh,03Ch,03Dh,03Eh,03Fh,00h,01h,02h,03h,03Ch,03Dh,03Eh,03Fh,00h,01h,02h,03h,03Ch,03Dh,03Eh,03Fh,00h,01h,02h,03h,03Ch,03Dh,03Eh,03Fh,00h,01h,02h,03h,03Ch,03Dh,03Eh,03Fh,00h,01h,02h,03h,03Ch,03Dh,03Eh,03Fh,00h,01h,02h,03h,04h,03Bh,03Ch,03Dh,03Eh,03Fh,00h,01h,02h,03h,04h,03Bh,03Ch,03Dh,03Eh,03Fh,00h,01h,02h,03h,04h,03Bh,03Ch,03Dh,03Eh,03Fh,00h,01h,02h,03h,04h,03Bh,03Ch,03Dh,03Eh,03Fh,01h,02h,03h,04h,05h,03Ah,03Bh,03Ch,03Dh,03Eh,01h,02h,03h,04h,05h,03Ah,03Bh,03Ch,03Dh,03Eh,01h,02h,03h,04h,05h,06h,039h,03Ah,03Bh,03Ch,03Dh,03Eh,02h,03h,04h,05h,06h,07h,038h,039h,03Ah,03Bh,03Ch,03Dh,02h,03h,04h,05h,06h,07h,038h,039h,03Ah,03Bh,03Ch,03Dh,03h,04h,05h,06h,07h,08h,037h,038h,039h,03Ah,03Bh,03Ch,04h,05h,06h,07h,08h,09h,036h,037h,038h,039h,03Ah,03Bh,04h,05h,06h,07h,08h,09h,0Ah,035h,036h,037h,038h,039h,03Ah,03Bh,05h,06h,07h,08h,09h,0Ah,0Bh,034h,035h,036h,037h,038h,039h,03Ah,06h,07h,08h,09h,0Ah,0Bh,0Ch,033h,034h,035h,036h,037h,038h,039h,07h,08h,09h,0Ah,0Bh,0Ch,0Dh,032h,033h,034h,035h,036h,037h,038h,08h,09h,0Ah,0Bh,0Ch,0Dh,0Eh,031h,032h,033h,034h,035h,036h,037h,09h,0Ah,0Bh,0Ch,0Dh,0Eh,0Fh,030h,031h,032h,033h,034h,035h,036h,0Ah,0Bh,0Ch,0Dh,0Eh,0Fh,010h,02Fh,030h,031h,032h,033h,034h,035h,0Ah,0Bh,0Ch,0Dh,0Eh,0Fh,010h,011h,02Eh,02Fh,030h,031h,032h,033h,034h,035h,0Bh,0Ch,0Dh,0Eh,0Fh,010h,011h,012h,02Dh,02Eh,02Fh,030h,031h,032h,033h,034h,0Ch,0Dh,0Eh,0Fh,010h,011h,012h,013h,02Ch,02Dh,02Eh,02Fh,030h,031h,032h,033h,0Eh,0Fh,010h,011h,012h,013h,014h,02Bh,02Ch,02Dh,02Eh,02Fh,030h,031h,0Fh,010h,011h,012h,013h,014h,015h,02Ah,02Bh,02Ch,02Dh,02Eh,02Fh,030h,010h,011h,012h,013h,014h,015h,016h,029h,02Ah,02Bh,02Ch,02Dh,02Eh,02Fh,011h,012h,013h,014h,015h,016h,017h,018h,027h,028h,029h,02Ah,02Bh,02Ch,02Dh,02Eh,012h,013h,014h,015h,016h,017h,018h,019h,026h,027h,028h,029h,02Ah,02Bh,02Ch,02Dh,013h,014h,015h,016h,017h,018h,019h,1Ah,025h,026h,027h,028h,029h,02Ah,02Bh,02Ch,014h,015h,016h,017h,018h,019h,1Ah,01Bh,024h,025h,026h,027h,028h,029h,02Ah,02Bh,016h,017h,018h,019h,1Ah,01Bh,01Ch,023h,024h,025h,026h,027h,028h,029h,017h,018h,019h,1Ah,01Bh,01Ch,01Dh,022h,023h,024h,025h,026h,027h,028h,018h,019h,1Ah,01Bh,01Ch,01Dh,01Eh,01Fh,020h,021h,022h,023h,024h,025h,026h,027h,019h,1Ah,01Bh,01Ch,01Dh,01Eh,01Fh,020h,021h,022h,023h,024h,025h,026h,01Ah,01Bh,01Ch,01Dh,01Eh,01Fh,020h,021h,022h,023h,024h,025h,01Bh,01Ch,01Dh,01Eh,01Fh,020h,021h,022h,023h,024h,01Dh,01Eh,01Fh,020h,021h,022h,01Eh,01Fh,020h,021h

DATA_OUT  DB 03h,03h,03h,03h,03h,03h,03h,03h,03h,03h,03h,03h,03h,03h,04h,04h,04h,04h,04h,04h,04h,04h,04h,04h,04h,04h,04h,04h,04h,04h,04h,04h,04h,04h,04h,04h,04h,04h,04h,04h,04h,04h,04h,04h,05h,05h,05h,05h,05h,05h,05h,05h,05h,05h,05h,05h,05h,05h,05h,05h,05h,05h,05h,05h,05h,05h,05h,05h,05h,05h,05h,05h,05h,05h,05h,05h,05h,05h,05h,05h,06h,06h,06h,06h,06h,06h,06h,06h,06h,06h,06h,06h,06h,06h,06h,06h,06h,06h,06h,06h,06h,06h,06h,06h,06h,06h,06h,06h,06h,06h,06h,06h,06h,06h,06h,06h,06h,06h,06h,06h,06h,06h,07h,07h,07h,07h,07h,07h,07h,07h,07h,07h,07h,07h,07h,07h,07h,07h,07h,07h,07h,07h,07h,07h,07h,07h,07h,07h,07h,07h,07h,07h,07h,07h,07h,07h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,015h,015h,015h,015h,015h,015h,015h,015h,016h,016h,016h,016h,016h,016h,016h,016h,017h,017h,017h,017h,017h,017h,017h,017h,018h,018h,018h,018h,018h,018h,018h,018h,019h,019h,019h,019h,019h,019h,019h,019h,019h,019h,1Ah,1Ah,1Ah,1Ah,1Ah,1Ah,1Ah,1Ah,1Ah,1Ah,01Bh,01Bh,01Bh,01Bh,01Bh,01Bh,01Bh,01Bh,01Bh,01Bh,01Ch,01Ch,01Ch,01Ch,01Ch,01Ch,01Ch,01Ch,01Ch,01Ch,01Dh,01Dh,01Dh,01Dh,01Dh,01Dh,01Dh,01Dh,01Dh,01Dh,01Eh,01Eh,01Eh,01Eh,01Eh,01Eh,01Eh,01Eh,01Eh,01Eh,01Fh,01Fh,01Fh,01Fh,01Fh,01Fh,01Fh,01Fh,01Fh,01Fh,01Fh,01Fh,020h,020h,020h,020h,020h,020h,020h,020h,020h,020h,020h,020h,021h,021h,021h,021h,021h,021h,021h,021h,021h,021h,021h,021h,022h,022h,022h,022h,022h,022h,022h,022h,022h,022h,022h,022h,023h,023h,023h,023h,023h,023h,023h,023h,023h,023h,023h,023h,024h,024h,024h,024h,024h,024h,024h,024h,024h,024h,024h,024h,024h,024h,025h,025h,025h,025h,025h,025h,025h,025h,025h,025h,025h,025h,025h,025h,026h,026h,026h,026h,026h,026h,026h,026h,026h,026h,026h,026h,026h,026h,027h,027h,027h,027h,027h,027h,027h,027h,027h,027h,027h,027h,027h,027h,028h,028h,028h,028h,028h,028h,028h,028h,028h,028h,028h,028h,028h,028h,029h,029h,029h,029h,029h,029h,029h,029h,029h,029h,029h,029h,029h,029h,02Ah,02Ah,02Ah,02Ah,02Ah,02Ah,02Ah,02Ah,02Ah,02Ah,02Ah,02Ah,02Ah,02Ah,02Bh,02Bh,02Bh,02Bh,02Bh,02Bh,02Bh,02Bh,02Bh,02Bh,02Bh,02Bh,02Bh,02Bh,02Bh,02Bh,02Ch,02Ch,02Ch,02Ch,02Ch,02Ch,02Ch,02Ch,02Ch,02Ch,02Ch,02Ch,02Ch,02Ch,02Ch,02Ch,02Dh,02Dh,02Dh,02Dh,02Dh,02Dh,02Dh,02Dh,02Dh,02Dh,02Dh,02Dh,02Dh,02Dh,02Dh,02Dh,02Eh,02Eh,02Eh,02Eh,02Eh,02Eh,02Eh,02Eh,02Eh,02Eh,02Eh,02Eh,02Eh,02Eh,02Fh,02Fh,02Fh,02Fh,02Fh,02Fh,02Fh,02Fh,02Fh,02Fh,02Fh,02Fh,02Fh,02Fh,030h,030h,030h,030h,030h,030h,030h,030h,030h,030h,030h,030h,030h,030h,031h,031h,031h,031h,031h,031h,031h,031h,031h,031h,031h,031h,031h,031h,031h,031h,032h,032h,032h,032h,032h,032h,032h,032h,032h,032h,032h,032h,032h,032h,032h,032h,033h,033h,033h,033h,033h,033h,033h,033h,033h,033h,033h,033h,033h,033h,033h,033h,034h,034h,034h,034h,034h,034h,034h,034h,034h,034h,034h,034h,034h,034h,034h,034h,035h,035h,035h,035h,035h,035h,035h,035h,035h,035h,035h,035h,035h,035h,036h,036h,036h,036h,036h,036h,036h,036h,036h,036h,036h,036h,036h,036h,037h,037h,037h,037h,037h,037h,037h,037h,037h,037h,037h,037h,037h,037h,037h,037h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,038h,039h,039h,039h,039h,039h,039h,039h,039h,039h,039h,039h,039h,03Ah,03Ah,03Ah,03Ah,03Ah,03Ah,03Ah,03Ah,03Ah,03Ah,03Bh,03Bh,03Bh,03Bh,03Bh,03Bh,03Ch,03Ch,03Ch,03Ch

DTSEG ENDS       
        .CODE
screen macro 
    mov ah,00
    mov al,13h
    int 10h
endm

clear_screen macro  
    mov ax,600h 
    mov bh,07h  
    mov cx,0    
    mov bx,184fh 
    int 10h
endm
MAIN    PROC FAR  
        ASSUME DS:DTSEG
        MOV AX,DTSEG
        MOV DS,AX
        MOV AX,0xA000 
        MOV ES,AX
        MOV BX,OFFSET DATA_IN  
        MOV SI,OFFSET DATA_OUT 
        PUSH BX
        screen 
        POP BX 
        MOV CX,906 
   DNG:
        PUSH CX 
        XOR CX,CX
        mov cx,[BX]    
        XOR CH,CH 
        xor dx,dx
        mov dx,[SI] 
        xor dh,dh 
        PUSH BX
        xor bx,bx
        mov bh,0h ;sayfa sayisi
        POP BX
        mov ah,0ch 
        mov al,06
        int 10h
        INC SI
        INC BX  
        POP CX
        LOOP DNG 
        
        INT 21H
MAIN    ENDP
        END MAIN
; add your code here

ret

I tried it for a 64x64 image in the array here and the result is the same. waiting for your help

CodePudding user response:

Seeing MOV CX,906, I'm guessing that, that is all that you could stuff in a single db line. Like @ecm told you in her comment, you should write the data on multiple db lines and preferably have the numbers aligned (for your own viewing pleasure):

X db  0Eh, 0Fh,010h,011h,012h,013h,014h,02Bh
  db 02Ch,02Dh,02Eh,02Fh,030h,031h, 0Ah, 0Bh 
  db  0Ch, 0Dh, 0Eh, 0Fh,010h,011h,012h,013h
  db 014h,015h,016h,017h,018h,027h,028h,029h
  db ...

Y db 03h,03h,03h,03h,03h,03h,03h,03h
  db 03h,03h,03h,03h,03h,03h,04h,04h
  db 04h,04h,04h,04h,04h,04h,04h,04h
  db 04h,04h,04h,04h,04h,04h,04h,04h
  db ...

Because your DATA_IN and DATA_OUT arrays are actually X and Y coordinates, why don't you name them more aptly X and Y?


The code has some more problems:

  • In the clear_screen macro, the mov bx,184fh instruction is wrong in two ways. The LowerRightCorner must go in DX and for the 320x200 256-color screen (13h), the number of columns is 40, therefore 4Fh is not the correct value. Use mov dx, 1827h.

  • Because you wrote mov bh,0h ;sayfa sayisi followed by POP BX, you will not have setup the DisplayPage in BH.

  • The INT 21H instruction down below is missing its function number in AH. Probably you meant mov ax, 4C00h int 21h.


Quick fix so you can see what more improvements were possible!

        ...
        MOV  AX, DTSEG
        MOV  DS, AX
        screen
        MOV  si, OFFSET X  
        MOV  di, OFFSET Y 
        mov  bh, 0          ;sayfa sayisi
        MOV  CX, 906 
   DNG:
        PUSH CX 
        XOR  CX, CX
        mov  cl, [si]    
        xor  dx, dx
        mov  dl, [di]
        mov  ah, 0Ch 
        mov  al, 6         ; Brown
        int  10h
        INC  si
        INC  di 
        POP  CX
        LOOP DNG 
        
        mov  ax, 4C00h
        INT  21h
        ...
  • Related