[b][red]This message was edited by oldandtired at 2006-3-5 21:13:49[/red][/b][hr]
[b][red]This message was edited by oldandtired at 2006-3-5 21:13:7[/red][/b][hr]
I'm a beginning assembler. I'm supposed to open and read a text file, then print the contents to the screen. It opens the file, reads the file and outputs it to the screen, but a load of random characters follow. Could someone please look at my code and see if you can figure this out? I copied the screen output and pasted it in at the bottom so you can see what I mean. There should be enough comments to help you figure out what I'm doing. Thanks-C
(top part of code-I think it has to do with this section. FYI- I set aside 200 bytes of buffer area in my code)
;directive to define byte data
;string data definition
TITLE1 DB 'Hello world',13,10,'$'
FILENAME BYTE 'D:DATA.TXT',0 ;(0 terminates string)
INHANDLE WORD ?
BYTESREAD WORD ?
BUFFER BYTE ?
STACK SEGMENT STACK
;generates a repeated storage allocation, using constant expression as counter
DB 32 DUP ('STACK ')
Hey Paul, do you understand how we did this?
Yo Kira, how does this look now?
STACK STACK STACK STACK STACK STACK STACK STACK STACK STACK
STACK STACK STACK STACK STACK STACK STACK STACK STACK P
? + ? ? ?? n?^?V ??2 ?-?+n?+?+ ??-? -!+lq+ ? +? -!r3
? ??? + ? -!r ? ?+ ??-? ? -!r
>?? -!r + L-!NNB08`? CV?
? ? ? ? ?Tenth10.obj6 ? ?? /Microsoft (R) Macro
Assembler Version 6.15.8803?6-??-?? K?
M?? O?+h??+F+?-x?% =? ?s?x?
j?? ?p??t??h???P+p%+L+?+dJ-!X?+ ?+ ? [?+O?- +-?, ?+t??
3+?+!++ ?+!3-6+!?+ ?+!=u?T = tKVP=? u86+!;t.:? t)< t:?l?u?FV?:
? t :?+ d?ZZT??ZZT( X^-F-?Fdnd>!?!u?du>!?!u?d>!Press any key to
continue . . .