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
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.
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.
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
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
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.
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.
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
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.
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.
Excellent explanation, thanks!
Charlie