I
idikoko
I am writing an absolute assembler; I am trying to read a file :
.model tiny
.code
org 100H
bgind: mov ax,alist ; address of list
mov bx,ax ; put in bx
mov ax,five ; number of numbers
mov cx,ax ; copy to cx
sub dx,dx ; clear dx
again: mov ax,[bx] ; get a number
add dx,ax ; add to dx
mov ax,one
sub cx,ax ; decrement cx
mov ax,two
add bx,a, ; point to next
mov ax,zero
comp cs,ax ; are we done?
jne again ; no
mov ax,dx
mov sum,ax ; store result
jmp around
alist dw list
sum dw 0
five dw 5
zero dw 0
one dw 1
two dw 2
list dw 45
dw -7
dw 100
dw 44
dw -25
exit dw 4c00H
around: mov ax,exit
dw 021CDh
end begin
line by line and break up each line using a tokenizer from from the
<string> lib however I'm not sure what instruction in the ostream lib
to use to extract line by line from the file. I wanna consider spaces
too. Help anyone?
.model tiny
.code
org 100H
bgind: mov ax,alist ; address of list
mov bx,ax ; put in bx
mov ax,five ; number of numbers
mov cx,ax ; copy to cx
sub dx,dx ; clear dx
again: mov ax,[bx] ; get a number
add dx,ax ; add to dx
mov ax,one
sub cx,ax ; decrement cx
mov ax,two
add bx,a, ; point to next
mov ax,zero
comp cs,ax ; are we done?
jne again ; no
mov ax,dx
mov sum,ax ; store result
jmp around
alist dw list
sum dw 0
five dw 5
zero dw 0
one dw 1
two dw 2
list dw 45
dw -7
dw 100
dw 44
dw -25
exit dw 4c00H
around: mov ax,exit
dw 021CDh
end begin
line by line and break up each line using a tokenizer from from the
<string> lib however I'm not sure what instruction in the ostream lib
to use to extract line by line from the file. I wanna consider spaces
too. Help anyone?