SmileeTiger
Programmer
Hi I now want to take a piece of data that is defined in the .data section of a program and place it in cx. Below is what I am trying..
title display (hello.asm)
.model small
.stack 100h
.data
abc dw 0002h
arrayi dw 00A4h, 00A6h, 00A8h, 00AAh
.code
main proc
;this section puts the initial nibble on the screen
mov ax, 0B800h ; Location for the display
mov ds,ax ; Moves the ax val to the data segment
mov ax, @data
mov es,ax ; Moves the ax val to the data segment
mov ax, 0107h ;Sets the character to a blue dot
mov di, offset arrayi
mov cx,abc <-- this is the important line
StartDraw:
mov bx,es:[di]
mov [bx],ax
add di,2
loop StartDraw
mov ax,4C00h
int 21h
main endp
Why doesn't this work?
title display (hello.asm)
.model small
.stack 100h
.data
abc dw 0002h
arrayi dw 00A4h, 00A6h, 00A8h, 00AAh
.code
main proc
;this section puts the initial nibble on the screen
mov ax, 0B800h ; Location for the display
mov ds,ax ; Moves the ax val to the data segment
mov ax, @data
mov es,ax ; Moves the ax val to the data segment
mov ax, 0107h ;Sets the character to a blue dot
mov di, offset arrayi
mov cx,abc <-- this is the important line
StartDraw:
mov bx,es:[di]
mov [bx],ax
add di,2
loop StartDraw
mov ax,4C00h
int 21h
main endp
Why doesn't this work?