Name: ______________
Section:_______________
TITLE Program counts the negative numbers stored in an "array"
.model small ;start all programs you will write
.stack 100h ;for CS2011 with these directives
.data ;the program's variables go here
ourdat dw 400, 16, -25, -49, -160, 18
datlen = ($ - ourdat)/2 ; datlen = length of the data
.code ;the code starts here
.startup ;TASM directive that sets up stack
;segment and data segment
mov bx, offset ourdat ;initialize bx to point to our data
;now write the code for the following instructions (down until the nop)
;store the data length in CX
;move the word pointed to by BX
; to AX
;add 2 to BX
;subtract 1 from CX
label1: ;move (copy) the word pointed to by BX to DX
;compare AX to DX
;if AX <= DX then jump forward to the
; instruction at label2
;move DX to AX
label2: ;add 2 to BX
;subtract 1 from CX
;compare CX to 0
;if CX > 0 then jump back to the
; instruction at label1
label3: nop ;return to DOS - the .exit takes care
;of that!
.exit ;a TASM directive that returns
;control to the calling program.
;Meant to be used in conjunction
;with .startup
end ;end of source code
Once you have successfully built the program, bring up the turbo debugger. Then,
You will need to turn in this handout at the end of your lab session to receive credit for the lab.