It is currently Wed Jul 18, 2018 11:25 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: asm6 issue
PostPosted: Fri Jun 29, 2018 2:56 pm 
Offline

Joined: Mon Dec 26, 2016 8:58 am
Posts: 22
I believe I may have found an issue with asm6. I am using version 1.6,which is the one given on RomHacking.


Is this program still being maintained? How may I contact the programmer/author?

Thank you
Charlie


Top
 Profile  
 
 Post subject: Re: asm6 issue
PostPosted: Fri Jun 29, 2018 4:59 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 10:52 pm
Posts: 376
Location: UT
Email address should be in the readme. It's not actively maintained, though there are unofficial branches that might be.
If you have issues with it, right here is the best place to talk about it.


Top
 Profile  
 
 Post subject: Re: asm6 issue
PostPosted: Fri Jun 29, 2018 5:05 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10602
Location: Rio de Janeiro - Brazil
If you've really found a bug, sharing it here might be helpful to other members too, as more people will be able to avoid/circumvent the issue until it's fixed.


Top
 Profile  
 
 Post subject: Re: asm6 issue
PostPosted: Sat Jun 30, 2018 5:38 am 
Offline

Joined: Mon Dec 26, 2016 8:58 am
Posts: 22
Thank you. I will make up a code snippet to demonstrate my question.

Regarding the lengthy discussion in reference to homebrew (I admit I did not read it all), I've attached (I hope) a bmp file. It is my "homebrew" game, and is a blatent rip-off of a C64 game "Oils Well" (IIRC). It is not intended for profit, and I am willing to submit it, with source code, to {someplace}, if it is appropriate to do so. Does this type of programming qualify as a "port" of the original? It is not an exact duplicate of the play function, just close enough to make it playable.

Thanks
Charlie


Attachments:
File comment: Screen shot of "NESOil", my port of the Commodore game "Oils Well"
NESOil.bmp
NESOil.bmp [ 238.93 KiB | Viewed 303 times ]
Top
 Profile  
 
 Post subject: Re: asm6 issue
PostPosted: Sat Jun 30, 2018 9:17 am 
Offline

Joined: Mon Dec 26, 2016 8:58 am
Posts: 22
Ok, here is an example of my question:
First the code snippet, file name is "test.asm":
----------------------------------------
someIndex = $2E

.org $c000

Data1:
.db #$00, #$00, #$00, #$00, #$00
Data1Size:
.db (Data1Size - Data1) / 5

Test:
lda someIndex
;cmp #Data2Size ;Uncomment to see issue
cmp #Data1Size

Data2:
.db #$FF, #$FF, #$FF, #$FF, #$FF
Data2Size:
.db (Data2Size - Data2) / 5
-----------------------------------------------

Compiling as is, is ok:

E:\temp>asm6 -L test.asm test.nes test.lst
pass 1..
test.nes written (17 bytes).
test.lst written.

Compiling with the comment removed:

E:\temp>asm6 -L test.asm test.nes test.lst
pass 1..
pass 2..
last try..
test.nes written (20 bytes).
test.lst written.

Note the output "last try...", which would:
(1) seem to indicate an error, even though the list file "test.lst" shows correct data
(2) does not give any indication of the "error". This may be correct, as there doesn't appear to actually be any error.

Note that the difference is that the calculated Size data is, in the first instance, BEFORE the code that uses it, and in the second instance, is AFTER the code that uses it.


Thanks
Charlie


Top
 Profile  
 
 Post subject: Re: asm6 issue
PostPosted: Sat Jun 30, 2018 9:34 am 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10602
Location: Rio de Janeiro - Brazil
You should not be using the "#" in those CMP instructions though. This symbol is for immediate values, so what this will do is compare the accumulator to the ADDRESS that label points to, not the value at that address. The address is a 16-bit value though, so this should be an invalid instruction on 6502 assembly, so the assembler should throw an error, instead of silently using only the lower byte of the address or whatever else it's doing.


Top
 Profile  
 
 Post subject: Re: asm6 issue
PostPosted: Sat Jun 30, 2018 9:42 am 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10602
Location: Rio de Janeiro - Brazil
Maybe what you want to do is this:
Code:
Data1:         
   .db #$00, #$00, #$00, #$00, #$00   
Data1Size = ($ - Data1) / 5 ;this will calculate the value you want, but will not output it to the ROM

   ;(...)

   CMP #Data1Size

Or, if you really want the size to be stored in the ROM with a .db statement, do exactly like you did but remove the # from the CMP instructions. Either way should work fine, regardless of whether there size is calculated before or after it's used.


Top
 Profile  
 
 Post subject: Re: asm6 issue
PostPosted: Sat Jun 30, 2018 1:09 pm 
Offline

Joined: Mon Dec 26, 2016 8:58 am
Posts: 22
Thanks, all, for the info.

I have tried both with and without the "#", using Asm6 and running on the Nintendoulator (my real code, of course, not the sample snippet). In both cases, the Debug Disassembly shows the same code:

D11A A5 2E LDA $2E = 05
D11C CD 60 C4 CMP $C460 = 08
D11F D0 07 BNE $D128

However, removing the "#" DOES eliminate the Asm6 issue, and so I have edited my real code to match.

(Edit: So, maybe the Asm6 message actually WAS an error indicator, since my source actually was incorrect, and an update is needed to add the text of the error message?)

Charlie


Top
 Profile  
 
 Post subject: Re: asm6 issue
PostPosted: Sat Jun 30, 2018 1:23 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 10:52 pm
Posts: 376
Location: UT
charliee1151 wrote:
E:\temp>asm6 -L test.asm test.nes test.lst
pass 1..
pass 2..
last try..
test.nes written (20 bytes).
test.lst written.

Note the output "last try...", which would:
(1) seem to indicate an error, even though the list file "test.lst" shows correct data
(2) does not give any indication of the "error". This may be correct, as there doesn't appear to actually be any error.

"last try.." isn't an error condition. It just means it's the final assembly pass.


Top
 Profile  
 
 Post subject: Re: asm6 issue
PostPosted: Mon Jul 02, 2018 12:01 pm 
Offline
User avatar

Joined: Tue Apr 04, 2017 1:22 pm
Posts: 31
Location: Ohio, USA
charliee1151 wrote:
I have tried both with and without the "#", using Asm6 and running on the Nintendoulator (my real code, of course, not the sample snippet). In both cases, the Debug Disassembly shows the same code:

D11A A5 2E LDA $2E = 05
D11C CD 60 C4 CMP $C460 = 08
D11F D0 07 BNE $D128

However, removing the "#" DOES eliminate the Asm6 issue, and so I have edited my real code to match.


ASM6 tends to assume what you may have meant to do when it sees an invalid operation.
In this case it saw you were trying to use a 16-bit label as an immediate value (using "#"), and it assumed (correctly) that you meant to
Code:
CMP Absolute
instead of
Code:
CMP #Immediate

This is why the disassembly is the same with and without the "#"

As for the "last try" message, that just means the assembler did an extra pass, it is not an error. The extra pass came from your ambiguous "CMP", the assembler first assumed that "Data2Size" would be an 8-bit value that would be defined later in the source. But instead it found it as a 16-bit label, and had to do an extra pass to adjust the original "CMP" opcode to reflect that.

_________________
http://zutanogames.com/ <-- my dev blog


Top
 Profile  
 
 Post subject: Re: asm6 issue
PostPosted: Mon Jul 02, 2018 2:19 pm 
Offline

Joined: Mon Dec 26, 2016 8:58 am
Posts: 22
Excellent explanation, thanks!

Charlie


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group