Author Topic: Program issue in MASM  (Read 1286 times)

felipe

  • Member
  • *****
  • Posts: 1336
  • Eagles are just great!
Re: Program issue in MASM
« Reply #15 on: July 08, 2020, 08:17:25 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.
Felipe.

jt75

  • Regular Member
  • *
  • Posts: 12
Re: Program issue in MASM
« Reply #16 on: July 09, 2020, 11:17:41 AM »
I think this is what you're asking. I didn't really understand your meaning. Sorry about that.

jj2007

  • Member
  • *****
  • Posts: 10668
  • Assembler is fun ;-)
    • MasmBasic
Re: Program issue in MASM
« Reply #17 on: July 09, 2020, 06:53:11 PM »
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

Code: [Select]
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

  • Member
  • *****
  • Posts: 1336
  • Eagles are just great!
Re: Program issue in MASM
« Reply #18 on: July 10, 2020, 01:39:38 AM »
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::

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:
Felipe.

jt75

  • Regular Member
  • *
  • Posts: 12
Re: Program issue in MASM
« Reply #19 on: July 10, 2020, 04:25:11 PM »
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

  • Member
  • *****
  • Posts: 1336
  • Eagles are just great!
Re: Program issue in MASM
« Reply #20 on: July 11, 2020, 05:17:19 AM »
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:
Felipe.

jt75

  • Regular Member
  • *
  • Posts: 12
Re: Program issue in MASM
« Reply #21 on: July 12, 2020, 12:45:11 AM »
Any advice on how I should attack it? I just don't understand why it's doing what it's doing.

jj2007

  • Member
  • *****
  • Posts: 10668
  • Assembler is fun ;-)
    • MasmBasic
Re: Program issue in MASM
« Reply #22 on: July 12, 2020, 01:22:40 AM »
Code: [Select]
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

  • Member
  • *****
  • Posts: 1336
  • Eagles are just great!
Re: Program issue in MASM
« Reply #23 on: July 12, 2020, 03:27:58 AM »
In your printLL procedure  you are doing this:

Code: [Select]
lea esi, myAry
mov ch, 32
call blankout; clear out esi

But myAry is defined as this:
Code: [Select]
myAry byte 16 dup(? )

And because after myAry is defined, its defined endl like this:
Code: [Select]
endl byte 0dh, 0ah, 0

this last one gets overwritten with the spaces. So in this procedure the code that follows:
Code: [Select]
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:

Code: [Select]
.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:
Felipe.

jt75

  • Regular Member
  • *
  • Posts: 12
Re: Program issue in MASM
« Reply #24 on: July 12, 2020, 05:54:51 AM »
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

  • Regular Member
  • *
  • Posts: 12
Re: Program issue in MASM
« Reply #25 on: July 12, 2020, 06:48:34 AM »
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.

Code: [Select]
lea esi, myAry
mov ch, 16
call blankout; clear out esi

felipe

  • Member
  • *****
  • Posts: 1336
  • Eagles are just great!
Re: Program issue in MASM
« Reply #26 on: July 12, 2020, 07:11:55 AM »
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:)
Felipe.

jt75

  • Regular Member
  • *
  • Posts: 12
Re: Program issue in MASM
« Reply #27 on: July 12, 2020, 08:11:27 AM »
I don't see a .bat file within my folders, I'm just using VS 2015 with Irvine's addons if that helps.

felipe

  • Member
  • *****
  • Posts: 1336
  • Eagles are just great!
Re: Program issue in MASM
« Reply #28 on: July 12, 2020, 08:27:01 AM »
I think you should now check the procedure insertNode  :icon_idea:
Felipe.