SmileeTiger
Programmer
Hi,
I am trying to use an array as part of my final project for comp arch II however I am running into a little trouble. What I am trying to do is have an array contain the positions of characters on the screen then display a given character at these positions.
Here is my sample code not using the array:
.model small
.stack 100h
.data
.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, 0107h ;Sets the character to a blue dot
mov bx,0A4h ; Starting point
mov [bx],ax
add bx,2
mov [bx],ax
main endp
This outputs 2 blue dots as the 3rd & 4th characters of the second line.
I now want to modify this program to use an array. What I have thus far is as follows:
title display (hello.asm)
.model small
.stack 100h
.data
arrayi dw 00A4h, 00A6h
.code
main proc
call outline
;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, 0107h ;Sets the character to a blue dot
mov di, offset arrayi
mov bx,[di]
mov [bx],ax
add di,2
mov bx,[di]
mov [bx],ax
mov ax,4C00h
int 21h
main endp
Any idea why this doesn't work?
I am trying to use an array as part of my final project for comp arch II however I am running into a little trouble. What I am trying to do is have an array contain the positions of characters on the screen then display a given character at these positions.
Here is my sample code not using the array:
.model small
.stack 100h
.data
.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, 0107h ;Sets the character to a blue dot
mov bx,0A4h ; Starting point
mov [bx],ax
add bx,2
mov [bx],ax
main endp
This outputs 2 blue dots as the 3rd & 4th characters of the second line.
I now want to modify this program to use an array. What I have thus far is as follows:
title display (hello.asm)
.model small
.stack 100h
.data
arrayi dw 00A4h, 00A6h
.code
main proc
call outline
;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, 0107h ;Sets the character to a blue dot
mov di, offset arrayi
mov bx,[di]
mov [bx],ax
add di,2
mov bx,[di]
mov [bx],ax
mov ax,4C00h
int 21h
main endp
Any idea why this doesn't work?