CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: arrays

  1. #1
    Join Date
    Feb 2006
    Posts
    127

    arrays

    Hello, I am suppose to write a program in which you can enter grades for a certain number of students. I am using NASM.

    I declare unassigned memory like that:

    .UDATA

    student resb 20*300 ; for the array of student names
    grades resw 20*4 ; and for the array of grades

    This is how I try to enter the student names:

    mov ax,0 ; and clear ax
    start:
    ;
    nwln ;
    PutStr msg1 ; inc ax ;
    PutInt ax ;
    PutCh ":" ;
    mov dx,[student] ;
    GetStr dx,30 ;
    add dx,30 ;
    cmp ax,cx ;
    jl start ;

    once I entered all student names and I assigned grades to it (the same way) I try to retrieve the names like this:

    mov dx,[student] ;
    PutStr dx ;
    add dx,30 ; for 30 character
    ..and repeat the whole thing

    Obviously I am doing something wrong.
    Can anybody give me an advice or an example on how to read / retrieve strings and numbers ?
    Any help is appreciated.

  2. #2
    Join Date
    Nov 2004
    Posts
    34

    Re: arrays

    This is NASM? What's with all the comment characters? Or are semicolons used as statement separators here?

    I think your problem may be with addressing:

    mov dx,[student] ; Load dx with word value at label 'student'

    try:
    mov dx, student ; Load dx with address of label 'student'

    If this doesn't work, 16 bit NASM is not a part of my training, so I can't help further.

    You could join the NASM groups in yahoo

    http://groups.yahoo.com/group/win32-...guid=164610442
    http://groups.yahoo.com/group/linux-...guid=164610442

    Although the groups are not focused on DOS, there are users there who are familiar enough with DOS to possibly help you out.
    Last edited by kahlinor; March 27th, 2007 at 12:47 AM.

  3. #3
    Join Date
    Feb 2006
    Posts
    127

    Re: arrays

    Thank you. I will give the NASM newsgroup a shot.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured