News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Program issue in MASM

Started by jt75, July 06, 2020, 12:44:45 PM

Previous topic - Next topic

felipe

Quote from: jt75 on July 08, 2020, 03:00:01 AM
If you're needing Irvine's library

No i don't. It's easier to debug the .exe program with the .txt file after downloading both from this site in a .zip file. I don't have all the time to help others. Anyway, don't worry, good luck with your homework.

jt75

I think this is what you're asking. I didn't really understand your meaning. Sorry about that.

jj2007

Your linked list has faulty entries somewhere, therefore it goes in an endless loop in printLL

I attach a debug version. To assemble the source,
- rename your version to *.old
- extract the files to the folder where you want to test it
- study the deb macro
- install MasmBasic

out     eax             252
in      eax             256
ReadFromFile    $edi            300__taylor 287__Thomas 197__brown 250__lee 273__rReynolds 282__lion 192__mack 265__lewis 176__marshall 277__moto 262__vey
toSha 283__bozo 203__WayOut 279__ace 258__aceAgain 245__boyanze 235__thomson 188__onmore 265__ilyed 288__mark 276__beth 166__Timmy 199__cece 209__superman
nHornit 290__ray 229__kidSid 200__kidSyd 188__lastone 245__
getGrade        $esi            300
atoi    maxGrade        300
getNext         $edi:40         Thomas 197__brown 250__lee 273__rReynold ..
getNext         $edi:40         brown 250__lee 273__rReynolds 282__lion  ..
getNext         $edi:40         lee 273__rReynolds 282__lion 192__mack 2 ..
getNext         $edi:40         rReynolds 282__lion 192__mack 265__lewis ..
getNext         $edi:40         lion 192__mack 265__lewis 176__marshall  ..
getNext         $edi:40         mack 265__lewis 176__marshall 277__moto  ..
getNext         $edi:40         lewis 176__marshall 277__moto 262__vey 2 ..
getNext         $edi:40         marshall 277__moto 262__vey 286__knockto ..
getNext         $edi:40         moto 262__vey 286__knocktosee 291__toSha ..
getNext         $edi:40         vey 286__knocktosee 291__toSha 283__bozo ..
getNext         $edi:40         knocktosee 291__toSha 283__bozo 203__Way ..
getNext         $edi:40         toSha 283__bozo 203__WayOut 279__ace 258 ..
getNext         $edi:40         bozo 203__WayOut 279__ace 258__aceAgain  ..
getNext         $edi:40         WayOut 279__ace 258__aceAgain 245__boyan ..
getNext         $edi:40         ace 258__aceAgain 245__boyanze 235__thom ..
getNext         $edi:40         aceAgain 245__boyanze 235__thomson 188__ ..
getNext         $edi:40         boyanze 235__thomson 188__onmore 265__il ..
getNext         $edi:40         thomson 188__onmore 265__ilyed 288__mark ..
getNext         $edi:40         onmore 265__ilyed 288__mark 276__beth 16 ..
getNext         $edi:40         ilyed 288__mark 276__beth 166__Timmy 199 ..
getNext         $edi:40         mark 276__beth 166__Timmy 199__cece 209. ..
getNext         $edi:40         beth 166__Timmy 199__cece 209__superman  ..
getNext         $edi:40         Timmy 199__cece 209__superman 293__batma ..
getNext         $edi:40         cece 209__superman 293__batman 292__Gree ..
getNext         $edi:40         superman 293__batman 292__GreenHornit 29 ..
getNext         $edi:40         batman 292__GreenHornit 290__ray 229__ki ..
getNext         $edi:40         GreenHornit 290__ray 229__kidSid 200__ki ..
getNext         $edi:40         ray 229__kidSid 200__kidSyd 188__lastone ..
getNext         $edi:40         kidSid 200__kidSyd 188__lastone 245__
getNext         $edi:40         kidSyd 188__lastone 245__
getNext         $edi:40         lastone 245__
getNext         $edi:40
printing        eax             0
printing        $esi            âá@
printing        $esi            Knocktosee
printing        $esi            Taylor
printing        $esi            Taylor
printing        $esi            Taylor
printing        $esi            Taylor
printing        $esi            Taylor
printing        $esi            Taylor
printing        $esi            Taylor
----- printing done, counter=21 -----

felipe

Great now i have the grades.txt file with the correct spacing between columns... :angelic:
I'm still willing to help you but WHERE IS THE .EXE FILE??  :undecided:
I have been pretty clear about it. Now, you started this topic in the forum saying this  :icon_idea::

Quote from: jt75 on July 06, 2020, 12:44:45 PM
the code itself compiles,

So why you can't post the .exe (attached in a .zip file, which is perfectly legal, while isn't malware of course  :icon_idea:) so i can easily debug your program and i can be able to help you?  :icon_idea: :icon_idea:

jt75

Alright, here's the .exe file. It's straight from my debug folder and I double checked to make sure it was the correct file you're needing.

felipe

ok then, the program doesn't show an exception, actually it runs indefinitely creating a super big file (results.txt). This file has in it the name taylor with the grade 95 repeatedly until infinite.
I have run the program until that file reached the size of 83.135 KB, with this content:

Quote`@   97                Knocktosee             97                Taylor             95                Taylor             95...(this goes forever)

So you should check you mainloop conditions as a start... :icon_idea:

jt75

Any advice on how I should attack it? I just don't understand why it's doing what it's doing.

jj2007

printing        $esi            âá@
printing        $esi            Knocktosee
printing        $esi            Taylor


It seems the first entry of the linked list is already incorrect - see above. Do you have experience in other programming languages? I.e. is Assembly the problem, or are you generally inexperienced?

felipe

In your printLL procedure  you are doing this:


lea esi, myAry
mov ch, 32
call blankout; clear out esi


But myAry is defined as this:

myAry byte 16 dup(? )


And because after myAry is defined, its defined endl like this:

endl byte 0dh, 0ah, 0


this last one gets overwritten with the spaces. So in this procedure the code that follows:

lea esi, endl
call fileOut; print new line


Doesn't do what its supposed to do. Check that out as a start  :icon_idea:.

Here is a more complete picture of the above:


.data
...
myAry byte 16 dup(? )
endl byte 0dh, 0ah, 0
tab_ byte 09h, 0
...

.code
...
printLL proc

...

lea esi, myAry
mov ch, 32
call blankout; clear out esi

lea esi, endl
call fileOut; print new line
...

printLL endp



:icon_idea:

jt75

Thanks guys, I'll check that out and see what I can do. Yeah I'm a very inexperienced programmer and this is really my first semester dealing with assembly, it's been extremely hard to grasp.

jt75

I made changes to the code in the LL proc, where the array was declared as 16, in the mov ch, I changed it from 32 to 16 and that has the output file printing up and down now instead of straight across, so that much is remedied. I'm still trying to figure out what to do to the endl in that same procedure. I know it needs to go to the next name and print the grade until it runs out of data, but that's been my biggest issue ever since I started getting back results. Originally the exception error was due to my faulty .txt file which I did correct. Now it's just normal output I need to get corrected.

lea esi, myAry
mov ch, 16
call blankout; clear out esi

felipe

can you post the command line or the .bat file you use to assemble and link your project? (i have no time to figure it out... :icon_idea:)

jt75

I don't see a .bat file within my folders, I'm just using VS 2015 with Irvine's addons if that helps.

felipe

I think you should now check the procedure insertNode  :icon_idea: