|
Post by Jonathan Cauldwell on Jan 18, 2014 14:49:04 GMT
It's possible to include calls to external routines such as Beepola or screen decompressors from anywhere within your game, although it is slightly tricky. Here's how to do it for both the Spectrum and CPC versions:
1. Insert these three placeholder lines in your events code at the point where you wish to call the external routine:
ASM 0 ASM 0 ASM 0
2. Complete the rest of your game design as you would normally, then make a note of the memory addresses it uses and where your external code can be located.
3. Use your external tool and get it to locate its output in an unused area of RAM. Make a note of the start address for this code, then divide that by 256 and jot down the result and the remainder.
4. Go back AGD and replace the three ASM lines with this code:
ASM 205 ASM (remainder) ASM (result)
Save your game IMMEDIATELY without attempting to run it.
5. Use CLEAR (ZX) or MEMORY (CPC) to clear the relevant space, load your code files and start your game as normal. Your game will now call the external routine at the appropriate point.
Here's an example. Say I put in the placeholder lines and my game then has room to spare at address 45000. I could then go off and use a tool to create my status panel or music or whatever at that address. I'd then go back to my AGD game and replace the placeholder lines with these lines:
ASM 205 ASM 200 ASM 175
This is because 45000 / 256 = 175 with a remainder of 200.
|
|
jammajup
Abandoned Uranium Working

Posts: 18
|
Post by jammajup on Jan 18, 2014 17:02:16 GMT
Even though I am new to this and still teaching myself code and stuff it is already apparent that AGD is more than just some simple tool,I am just about to view the tutorial vids.I take it screen compression is to do with memory and using less , not some sort of graphic enhancement?.
|
|
|
Post by Jonathan Cauldwell on Jan 24, 2014 15:19:33 GMT
Yes, this is all to do with squeezing graphics into a smaller amount of memory. Some people like to set up the screen and construct a status panel in BASIC prior to calling the game start address, but there's no reaon why you couldn't use another tool - such as a screen compressor - to create code to draw this for you.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Nov 19, 2014 12:29:11 GMT
Hello, I've added Beepola music to my the menu of my game. Beepola warned me about contended memory so, I stuck my music above the game instead.
My memory addresses are:
Beginning of game: 30214
Unused/End of game: 62915
Start of Beepola Music: 62916
Events Intro/Menu ASM 205
ASM 196
ASM 245 (from 245.76562)
When I load the program, the menu displays and the tune plays as intended, one keypress stops the music, then a second keypress intended to select the keyboard player control from the controlmenu command stops everything and brings up the message:
0 OK, 10:5
How can I stop this happening?
Also I've a bad feeling that I took my snapshots with the loading screen loading in to AGD 4.6 already - is there a poke of some sort I can use to remove it if that is the problem?
|
|
|
Post by Jonathan Cauldwell on Dec 13, 2014 14:17:16 GMT
What you've done looks fine to me. There's something strange going on, but it's difficult to say what. It's almost as if something is being removed from the stack when it shouldn't be.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Dec 15, 2014 17:07:03 GMT
What you've done looks fine to me. There's something strange going on, but it's difficult to say what. It's almost as if something is being removed from the stack when it shouldn't be. Hi Jonathan, thanks for replying. Although I have been reading up on machine code and I do understand then function of the stack, I'm still a bit of a newbie in that area so, I don't think I'll be able to locate that problem. I've also added to the graphics of the game, leaving me with less than half a kilobyte of RAM free so, I've decided just to upload the game with sound effects only.
Thanks again and Merry Christmas!
|
|
|
Post by picachu on Jul 3, 2018 9:56:06 GMT
Greetings. I have tried the code of Jonathan on the calls asm for the music. And it works perfectly for me in the AGD project, but when I save it as a tap, an error occurs in the load and a beep sounds like an alarm.
Why does this happen??
I have tried to put the music in different memory addresses, 45000, 46000, even 60000 and with all the same thing happens.
Please, if someone knows something to comment. Thank you.
|
|
|
Post by lukebord1 on Jul 3, 2018 10:19:58 GMT
Picachu, let's clarify some basic concepts: - an ASM call points to a specific memory address, so the three ASM values change depending by that address (if the ASM worked for you, I'm sure this point is clear); - AGD doesn't save injected assembly code (unless it's nested into the character set), it saves just the game project; - external machine code blocks (e.g. custom sound effects) have to be saved apart and loaded specifically from the Basic loader; - the machine code blocks can be joined in an unique block or saved individually (less elegant). If the above basics aren't absolutely clear, I suggest to read my answer to your previous post here: arcadegamedesigner.proboards.com/thread/590/modify-block-zx-editor
|
|
|
Post by picachu on Jul 3, 2018 12:04:37 GMT
Thank you very much for answering. The case is that I added the music by a .bin and the memory address, just as I do with the sprites. Then I thought it would be enough. But I see no. Then you have to contribute to the loading of the tap the specific file, in that case the music. And as you advise me better, to contribute to the tap the bin file or the tap of the music ?? Picachu, let's clarify some basic concepts: - an ASM call points to a specific memory address, so the three ASM values change depending by that address (if the ASM worked for you, I'm sure this point is clear); - AGD doesn't save injected assembly code (unless it's nested into the character set), it saves just the game project; - external machine code blocks (e.g. custom sound effects) have to be saved apart and loaded specifically from the Basic loader; - the machine code blocks can be joined in an unique block or saved individually (less elegant). If the above basics aren't absolutely clear, I suggest to read my answer to your previous post here: arcadegamedesigner.proboards.com/thread/590/modify-block-zx-editor
|
|
|
Post by lukebord1 on Jul 3, 2018 12:37:47 GMT
Don't inject bin files inside AGD, the project could crash. There's a way to avoid corruptions, that is importing asm into the AGD character-set, as explained in one of my articles: www.funspot.it/store-asm-into-agd-character-set/If you have to store the assembly in high memory, once having saved the final AGD project, the ASM will work only outside the AGD test and only if the assembly is loaded apart (or if it's merged with the game assembly). As said, if the assembly is included into the character-set, then the saved project will include it. Otherwise, you have to transorm the bin file into a tap, and join the various machine code files with the game code block (or with any other assembly extras), if you want an unique code block after the loading screen. Here're the steps to transform a bin file into tap: - you have to know at what memory address the bin file is pointed and its length (let's say e.g. 50000, length 64); - import the bin file into the emulator and create a new blank tap file (in Spectaculator, new file/tap); - set the virtual tape recorder to the record mode (in Spectaculator, the red dot in the tape recorder window); - type from the Spectrum Basic command-line: SAVE "mycode" CODE 50000,64 (sample values for address and length); - stop the virtual tape recorder. Now you have a separate tap file including the code previously stored in a bin.
|
|
|
Post by picachu on Jul 3, 2018 13:13:33 GMT
Okay. Then I am going to import the bin of the audio as it says its manual in the characters section. But apart from this, you also have to save it as a tap to execute it in the spectrum. I hope I have understood it well and have luck. I'm going to try it and I'll tell you. Thank you very much for your help. It's my first game and I have many doubts but also a lot of illusion. Thanks for everything. I will comment the result. Regards!!! By the way, the Beepola program also exports in tap. I think that can work for me. Do not?? Don't inject bin files inside AGD, the project could crash. There's a way to avoid corruptions, that is importing asm into the AGD character-set, as explained in one of my articles: www.funspot.it/store-asm-into-agd-character-set/If you have to store the assembly in high memory, once having saved the final AGD project, the ASM will work only outside the AGD test and only if the assembly is loaded apart (or if it's merged with the game assembly). As said, if the assembly is included into the character-set, then the saved project will include it. Otherwise, you have to transorm the bin file into a tap, and join the various machine code files with the game code block (or with any other assembly extras), if you want an unique code block after the loading screen. Here're the steps to transform a bin file into tap: - you have to know at what memory address the bin file is pointed and its length (let's say e.g. 50000, length 64); - import the bin file into the emulator and create a new blank tap file (in Spectaculator, new file/tap); - set the virtual tape recorder to the record mode (in Spectaculator, the red dot in the tape recorder window); - type from the Spectrum Basic command-line: SAVE "mycode" CODE 50000,64 (sample values for address and length); - stop the virtual tape recorder. Now you have a separate tap file including the code previously stored in a bin.
|
|
|
Post by lukebord1 on Jul 4, 2018 10:05:57 GMT
By the way, the Beepola program also exports in tap. I think that can work for me. Do not?? If it's your first experience with AGD, make it simple: don't complicate your work including advanced stuff like Beepola files... again, I'm here to tell you: move gradually! A good vintage ZX Spectrum game must not include at all costs background audio or external assembly effects. You could simply save an AGD project with loader and see how it works. Then, decide to improve something before propagate the news to the public.
|
|
|
Post by picachu on Jul 4, 2018 18:22:05 GMT
Yes. Yes. I'm doing that. I'm trying things before I start. Then I decide what to use and what not. Thanks for the advice. By the way, the Beepola program also exports in tap. I think that can work for me. Do not?? If it's your first experience with AGD, make it simple: don't complicate your work including advanced stuff like Beepola files... again, I'm here to tell you: move gradually! A good vintage ZX Spectrum game must not include at all costs background audio or external assembly effects. You could simply save an AGD project with loader and see how it works. Then, decide to improve something before propagate the news to the public.
|
|