TGB1718 Posted December 26, 2020 Share Posted December 26, 2020 You will notice there's an absence of an unconditional branch instruction i.e. BRA LOOP This can be simulated with a simple macro, it wastes 2 cycles, but it does the job. see this simple example:- it clears the overflow flag then tests if its clear and branches. The main reason for using this instead of a JMP is it makes the code relocatable 20 .MACRO BRA 30 CLV 40 BVC %1 50 .ENDM 60 *= $0600 70 LDA $CC 80 STA $CB 90 BRA ZZ 0100 DAT .BYTE 10,10,20,30,40 0110 ZZ LDA #22 0120 STA $CC 0130 RTS 1 Quote Link to comment Share on other sites More sharing options...
ac.tomo Posted December 27, 2020 Author Share Posted December 27, 2020 (edited) thanks for that. Please can someone remind me of the syntax to obtain the hi and lo bytes of a given address, ie: org $2000 delay_ptr = $cb lda delay hi-byte sta delay_ptr+1 lda delay lo-byte sta delay_ptr+0 delay .byte 'zzzzzzzz' I'd like to know the proper syntax for this method, I don't wish to use any macro's or non (normal) assembler mnemonics, thankyou. Edited December 27, 2020 by ac.tomo Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted December 27, 2020 Share Posted December 27, 2020 depending on the assembler there are usually two ways of doing that: lda #delay/256 sta delay_ptr+1 lda #delay&255 sta delay_ptr+0 or lda #>delay sta delay_ptr+1 lda #<delay sta delay_ptr+0 Quote Link to comment Share on other sites More sharing options...
ac.tomo Posted December 27, 2020 Author Share Posted December 27, 2020 Brill, thankyou for that. I'm using MADS so I think I'll need to use the latter method (unless I'm wrong, in which case please correct me). Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted December 27, 2020 Share Posted December 27, 2020 (edited) lda #delay/256 sta delay_ptr+1 lda #delay&255 sta delay_ptr+0 this method will work with any assembler, the other method is assembler dependent Edited December 27, 2020 by TGB1718 Quote Link to comment Share on other sites More sharing options...
ac.tomo Posted December 28, 2020 Author Share Posted December 28, 2020 (edited) Well, the last couple of days I've been working on a small demo I wanted to show intermediate programmers, it's not a difficult routine (moving coloured bars up and down the screen). I have actually done this routine years ago (in a demo called EGO demo), excuse the use of the word EGO, I didn't know it was such a vain word at the time (!!). Anyway, this time, the routine has been coded a little bit different, it's more complex, but it is far better, but for some unknown reason(s) it's not working as it should! I've tried to debug it and although I have found a couple of bugs it still isn't working. In fact, I've experimented by putting different slices of code in particular areas of the routine to iron out the problems, but the MADS assembler is NOT doing quite what it should. For example; "loop jmp loop" wasn't even working as it should! Anyway, as I just can't seem to find what the problem is I've uploaded it for other programmers to see if they can find what is wrong. I am new to MADS (and in fact ASSEMBLERS in general) (so that could be a contributing problem lol). The program is broken down into 5 parts: initiation and main loop. jsr routines: jsr move_bars according to given positions and flag directions (also set delays before moving on each position) jsr zero_mem zero the memory before: jsr put_bars poking the bars into the given area of memory to fly jsr fly_mem actually put the memory into the colr register and $d4oa (wsync) (fly the memory) The assembly listing has loads of comments for ease of understanding, and the 'labels' are easily named. PLEASE.... Someone show me where I'm going wrong. EDT: I haven't actually finished putting the correct data into the prog. yet, but that can wait for now... bars.asm Edited December 28, 2020 by ac.tomo Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted December 29, 2020 Share Posted December 29, 2020 (edited) Have you got your "#50"'s confused with 80, i.e. they should be $50? the giveaway could be line 101: cpy #50 ;size of fly_mem After the 'cont' label you are using the ytab values for each bar to index into the delay areas, but these are only 50 in size whereas your initial ypos values go up to 80. So even then, the size of fly_mem is 96 and the max value you want as a ypos offset is 80 as you'll add 16 (well 0-15) to it. some recommendations: 1) where you are repeating constant values such as '50' then define that as a constant and use that instead, i.e. one place can then change all. e.g. fly_mem_size = 96 bar_size = 16 max_ypos = (fly_mem_size - bar_size) 2) place labels on their own line, this makes the mnemonics line up better and easier to read (my personal preference, even in MADS, is to end the label with a colon) mov_dwn inc ypos,x ;inc current y pos. lda ypos,x ;once #50 reached -> mov_dwn: inc ypos,x ;inc current y pos. lda ypos,x ;once #50 reached 3) most assemblers will have a 'repeat' feature, so where you want to 'fill' a buffer with a value use that. e.g. fly_mem_size = 96 ... fly_mem: :fly_mem_size .byte "0" Edited December 29, 2020 by Wrathchild with have -> will have Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted December 29, 2020 Share Posted December 29, 2020 Just something I do to try reduce those sort of errors is the following *= $0600 LDY #0 LOOP LDA ($CB),Y STA ($CE),Y CPY #MEMEND-MEM ; use labels to define the size BNE LOOP RTS MEM .BYTE 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 .BYTE 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 MEMEND Quote Link to comment Share on other sites More sharing options...
shanti77 Posted December 29, 2020 Share Posted December 29, 2020 Where is init bytes $cb-$cf and "iny" before "cpy"? Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted December 29, 2020 Share Posted December 29, 2020 27 minutes ago, shanti77 said: Where is init bytes $cb-$cf and "iny" before "cpy"? Doesn't matter, it's just an example showing how to get numbers to move right Quote Link to comment Share on other sites More sharing options...
ac.tomo Posted December 29, 2020 Author Share Posted December 29, 2020 Right, many thanx for your input all, a couple of those CMPared values were wrong and there's no problem with MADS, but the biggest and main problem that I've discovered is that my program doesn't work with Altirra. I loaded it into the atari800win emulator and it works perfectly fine. Anyone know the reason for this? Anyhow, I've uploaded a perfectly fine working copy of this demo especially aimed at intermediate programmers for their interest. Remember though, it wont work on Altirra, only atari800win em. bars.xex bars.asm Quote Link to comment Share on other sites More sharing options...
ivop Posted December 29, 2020 Share Posted December 29, 2020 (edited) Huh? I haven't looked at the assembly code yet, but here it runs exactly the same on atari800 4.2.0, and Altirra 3.90. What do you mean by "it wont work"? What does it not do that you are expecting? Edit: the only thing I see "wrong" is that the upper and lower border "wiggle" by one scan line, which is probably due to you syncing to VCOUNT. Edited December 29, 2020 by ivop Quote Link to comment Share on other sites More sharing options...
ac.tomo Posted December 29, 2020 Author Share Posted December 29, 2020 (edited) 1 hour ago, ivop said: Huh? I haven't looked at the assembly code yet, but here it runs exactly the same on atari800 4.2.0, and Altirra 3.90. What do you mean by "it wont work"? What does it not do that you are expecting? Edit: the only thing I see "wrong" is that the upper and lower border "wiggle" by one scan line, which is probably due to you syncing to VCOUNT. On my Altirra it puts the coloured bars up on the screen but does not move them, whereas on atari800win there's no problem at all. I do have 2 copies of Altirra on my laptop, 1 inside the eclipse environment (the 1 that calls up when you compile and run your assembly programs) and another on my desktop (of which I use for BASIC programming). Could this be a problem? EDT: I just loaded my demo onto my other copy of Altirra and it works fine. Obviously I need to replace Altirra (in eclipse) with my other, anyone foresee any problems? EDT OOPS: I just tried changing the Altirra and I've balls it up completely, I renamed the old (orig eclipse altirra) to put the other altirra in, but it didnt work. So, I put the original back and it doesn't work at all now, perhaps I've got the filename wrong, any input please. EDT (again): I've managed to put the old Altirra back but still have the problem that this program doesnt work on it. Edited December 29, 2020 by ac.tomo Quote Link to comment Share on other sites More sharing options...
ivop Posted December 29, 2020 Share Posted December 29, 2020 (edited) Perhaps you should download a fresh zip from http://www.virtualdub.org/altirra.html Unzip it in a newly created directory. Then point your development environment to that binary. Edit: and you need to setup the new Altirra instance with the right OS ROM files. Edited December 29, 2020 by ivop Quote Link to comment Share on other sites More sharing options...
ac.tomo Posted December 29, 2020 Author Share Posted December 29, 2020 1 hour ago, ivop said: Perhaps you should download a fresh zip from http://www.virtualdub.org/altirra.html Unzip it in a newly created directory. Then point your development environment to that binary. Edit: and you need to setup the new Altirra instance with the right OS ROM files. Seems a bit too technical for me! When you say 'point the environment to' the binary, do you mean to change the existing Altirra file to a 'shortcut' to the newly downloaded one? Concerning the OS files, I've always thought that they come with Altirra? Quote Link to comment Share on other sites More sharing options...
ivop Posted December 29, 2020 Share Posted December 29, 2020 4 minutes ago, ac.tomo said: Seems a bit too technical for me! When you say 'point the environment to' the binary, do you mean to change the existing Altirra file to a 'shortcut' to the newly downloaded one? Sorry, I should have been more specific. I assume you start Altirra from within Eclipse. Somewhere in the settings it should have a path to which Altirra binary it uses. Do you use WUDSN? I also assumed you know how to unzip a file to a specific directory. 4 minutes ago, ac.tomo said: Concerning the OS files, I've always thought that they come with Altirra? Phaeron (the author) has gone to great lengths to reimplement both the OS and BASIC, but they are not 100% the same as the original ROMs. But in your case, I doubt this has anything to do with it. It should work with a standard Altirra 3.90 install, and select 800XL, 64kB. Quote Link to comment Share on other sites More sharing options...
ac.tomo Posted December 29, 2020 Author Share Posted December 29, 2020 Yes, I am using WUDSN. I do know how to unzip. In the settings, I presume you mean somewhere in WUDSN? Quote Link to comment Share on other sites More sharing options...
ivop Posted December 29, 2020 Share Posted December 29, 2020 28 minutes ago, ac.tomo said: Yes, I am using WUDSN. I do know how to unzip. In the settings, I presume you mean somewhere in WUDSN? Yes, I do. Perhaps @JAC! or WUDSN users can help you better. But I expect there's a path somewhere that points to the Altirra.exe binary. Quote Link to comment Share on other sites More sharing options...
ac.tomo Posted December 29, 2020 Author Share Posted December 29, 2020 (edited) 8 minutes ago, ivop said: Yes, I do. Perhaps @JAC! or WUDSN users can help you better. But I expect there's a path somewhere that points to the Altirra.exe binary. I've just had a good look, I can find the path to my program, but not to Altirra or anything else. EDT: I did find 'Altirra' as it's default emu., but couldn't change it. Edited December 29, 2020 by ac.tomo Quote Link to comment Share on other sites More sharing options...
+JAC! Posted December 29, 2020 Share Posted December 29, 2020 Menu: Windows/Preferences and then here. 1 Quote Link to comment Share on other sites More sharing options...
ac.tomo Posted December 29, 2020 Author Share Posted December 29, 2020 (edited) 43 minutes ago, JAC! said: Menu: Windows/Preferences and then here. Thankyou for that JAC!, I'll have a look at that now shortly, but in the meantime here's the coloured_bar routine without the $d40a glitch, I just STA $d40a in between lines 37 and 38. bars.xex Edited December 29, 2020 by ac.tomo Quote Link to comment Share on other sites More sharing options...
ac.tomo Posted December 29, 2020 Author Share Posted December 29, 2020 (edited) Thankyou for that info to change the path for Altirra, there's something weird going on here: I followed your steps so that WUDSN opens my other (1st) Altirra64 which is in a completely different folder and it works fine (other than prompting me to cancel the script or something(!!)), BUT when I put (my 1st) Altirra64 (the 1 I just said works) file into the original WUDSN/Altirra folder - it doesn't work. It loads, but doesn't work properly (as mentioned earlier (not moving the bars)). Does anyone understand what's going on here??? Edited December 29, 2020 by ac.tomo Quote Link to comment Share on other sites More sharing options...
ivop Posted December 30, 2020 Share Posted December 30, 2020 (edited) If I understand you correctly, you are moving around binaries? Or full installation directories of Altirra? You probably can't move just the binary. Edited December 30, 2020 by ivop Quote Link to comment Share on other sites More sharing options...
ac.tomo Posted December 30, 2020 Author Share Posted December 30, 2020 2 minutes ago, ivop said: If I understand you correctly, you are moving around binaries? Or full installation directories of Altirra? You probably can't move just the binary. I'm thinking that. In the original WUDSN Altirra folder there are a couple of other files that I think are also loaded, but because they aint in my other (2nd) folder it cant find anything else, and so isnt loading anything else. This seems to say that 1 or more of those accompanying files are faulty. That's the only conclusion I can think of. Quote Link to comment Share on other sites More sharing options...
ac.tomo Posted December 30, 2020 Author Share Posted December 30, 2020 I had a little tinker around and somehow I now have a working copy of Altirra within WUDSN. Thanks all for your help, hope you enjoy the little demo. It's well explained and can be changed to what you like; you can have more or less bars, larger or smaller bars, different background, different speeds and position delays, mixed bar directions, and with a little addition to the routine you can achieve other little effects. Have fun. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.