Timeline for Is there an equivalent of "#pragma once" in RGBASM (Gameboy DMG assembly language)?
Current License: CC BY-SA 4.0
12 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 15, 2022 at 12:43 | history | edited | Raffzahn | CC BY-SA 4.0 | added 914 characters in body |
| Jun 15, 2022 at 12:31 | comment | added | Raffzahn | @DaveGold ... while symbols to be exported have to be declared as such. By adding EXPORT updateplayer to PLAYER.ASM (usually at the start to ease reading) the functions address will be made visible to other modules, so they can use it like in a CALL. See section 'Exporting and importing symbols' in the manual. The basic idea here is that the assembler/linker treats everything within a sourcefile by default as private to this compilation unit, allowing reuse of names and hiding of implementation - unless access is explicit granted. | |
| Jun 15, 2022 at 12:25 | comment | added | Raffzahn | @DaveGold No prob,that's what RC is about. Glad to help, but sorry if it's confusing. Assembler works here like C (after all, C is at the core just a fancy wrapper for Assembler). To call a procedure (function) from another unit, one has to declare it as external. In C that's done by including a prototype declared as extern extern void moveleft(); (in many compilers the extern is assumed by default). This works as every function not declared static is exported. In RGBASM it's basically the same, just simplified, as every unknown identifier is assumed extern by default, while ... | |
| Jun 15, 2022 at 10:38 | comment | added | I_Keep_Trying | With that said I very much appreciate the time you spent trying to explain it to me (however perhaps I am just too novice at this moment to understand any of what you are telling me). Thanks again for your time | |
| Jun 15, 2022 at 10:37 | comment | added | I_Keep_Trying | Ok I am very confused sadly. Main.ASM cannot be assembled without Player.asm (AFAIK) because inside Main.asm are calls to Player.updateplayer , player.moveleft and stuff like that. The assembler is already picking up on the duplication but it is not correcting it or finding any way passed it (other than reporting to me the re-use of the label and then quitting without outputting any roms/files) | |
| Jun 14, 2022 at 16:12 | history | edited | Raffzahn | CC BY-SA 4.0 | added 335 characters in body |
| Jun 14, 2022 at 16:09 | comment | added | Raffzahn | @DaveGold THe assembler IS already doing this - with the message given. The normal workflow would be to assemble each ASM source (MAIN.ASM and PLAYER.ASM) with a separate run of RGBASM, so the error would not arise. After that RGBLINK is used to combine them into an executable | |
| Jun 14, 2022 at 16:01 | comment | added | I_Keep_Trying | (I wasn't accusing you of complaining at me for not reading the docs -just to clarify that :P ) ...But hopefully this won't be oneway ticket to doom, because really it is just a way to guard against including a file twice. Rather than doing the work yourself and figuring whether a file is already included, the computer should be able to do that far easier than me :D | |
| Jun 14, 2022 at 15:58 | comment | added | Raffzahn | @DaveGold Context is the most important. Didn't say you didn't read. Documentation of some new tool can be overwhelming. All I suggested was to add a link to the tools you're using (as there are millions around) plus information how they are used. Also, going "Tofro's Way" might be a direct way to doom. Hacking to force a certain structure against your tools is usually no good idea. | |
| Jun 14, 2022 at 15:57 | comment | added | I_Keep_Trying | But for now at least I can continue with my simple game. And I am going to try to implement Tofro's solution when I can. | |
| Jun 14, 2022 at 15:56 | comment | added | I_Keep_Trying | Thanks for your help. I do understand that each assembler can vary a lot and likewise for each of the target machines. I did in the end specify RGBASM and Game Boy. I did also try reading the RGBASM docs but I got overwhelmed. As far as I can tell it doesn't address 'duplicate symbols' (as you correctly point out is a better term for this problem). Thanks again for the help here. I understand I didn't provide any code for your context. This was my mistake (I felt it might bloat the question without any use) | |
| Jun 14, 2022 at 15:53 | history | answered | Raffzahn | CC BY-SA 4.0 |