Lillapojkenpåön
Members-
Content Count
486 -
Joined
Content Type
Profiles
Member Map
Forums
Blogs
Gallery
Calendar
Store
Everything posted by Lillapojkenpåön
-
Haha, just realized something ridiculous, if this would have worked why wouldn't you just do y = rand&5 + 1
-
If that's exactly how the code looks I think you should move the data table to where you don't fall into it, like after a goto.
-
Haven't looked at the code, and don't know if rand&5 works, but maybe you can use it elsewhere instead of alot of if...thens temp5 = rand&5 ;get random value between 0 - 5, might not work y = yTable[temp5] ;use it as index data yTable 1, 2, 3, 4, 5, 6 end
-
Using 2 or more if statements in the same line.
Lillapojkenpåön replied to freshbrood's topic in batari Basic
I actually didn't know you could do that, but the first example would be split up on several lines like this if player1y>=76 then skip e=14 if f{1} then e=13 skip It's easier to read, especially if you add more stuff or if statements down the line. You might want to try this instead btw if f{1} then e=13 else e=14 Another good thing is that it's more similar to the assembly it turns into, if you do this.. if player1y>=76 then skip if !f{1} then a e=13 goto skip a e=14 skip you're pretty much writing assembly -
yup, it's just so I can read data from other banks with indirect y, so theres just one jump to each bank in the table, in the correct order
-
Aah, now I get it, ofcourse that code has to be in the same place in all banks 💡 Thanks, it doesn't support returning but I can add that. I'm also trying to save space and I got my previous code down to this lda #>(._ongosub_return2_-1) PHA lda #<(._ongosub_return2_-1) PHA LDX bankNumber LDA _jumptablehi_,x PHA LDA _jumptablelo_,x PHA pha pha jmp BS_jsr just two extra pushes to get the existing bs code to work and return, not shure it would be worth adding another slightly modified version to every bank just to get rid of the extra pushing and pulling, but I sure will try it. What the hell is a macro anyway?
-
I did that, but think I did on gosub to gosub to another bank, so I could return, then I just merged the codes in assembly sta temp7 lda #>(._ongosub_return_-1) PHA lda #<(._ongosub_return_-1) PHA LDX bankNumber LDA _jumptablehi_,x PHA LDA _jumptablelo_,x PHA lda temp7 pha txa pha ldx bankNumber jmp BS_jsr this works perfectly with a regular return otherbank So I'm not trying to get it to work, I'm trying to optimize it by removing as much excess as possible and hopefully get a little bit closer to understanding bankswitching in the process. I don't need to save a and x, but BS_jsr and BS_return (that falls into BS_JSR) tries to pull them from the stack, I think that's what the problem is.
-
If someone can get this to work, I would be happy you gosub to bank 4 by pressing joy0fire, it should change bgcolor to blue bankswitch2.bas and is the jmp BS_jsr+6 in bogax code because you have to do the rts at that address?
-
IObBCC.. I've read several times that macros are slow, so I guess when using it you don't input a copy of that code with the parameters you give? Or if you do does that happen when it turns into machine language? I couldn't use the bankswitch_hotspot constant before without getting an error, now I can for some reason. maybe the problem is that I'm trying to jump to another bank and return to the old bank again, on gosub with bankswitch, which bB doesn't support, this is the first part asm lda #>(._ongosub_return_-1) PHA lda #<(._ongosub_return_-1) PHA LDX bankNumber ; 4 in this case LDA _jumptablehi_,x PHA LDA _jumptablelo_,x PHA lda bankswitch_hotspot-1,x rts _jumptablehi_ .byte #0 .byte #0 .byte #0 .byte >(._bank3data-1) .byte >(._bank4data-1) .byte >(._bank5data-1) .byte >(._bank6data-1) _jumptablelo_ .byte #0 .byte #0 .byte #0 .byte <(._bank3data-1) .byte <(._bank4data-1) .byte <(._bank5data-1) .byte <(._bank6data-1) end _ongosub_return_ I probably need to make a custom return otherbank code also, what do I change? getting rid of the a and x stuff didn't work asm pha ;push a to stack txa pha ; push x to stack tsx ; Transfer Stack ptr to X if bankswitch != 64 lda 4,x ; get high byte of return address rol rol rol rol and #bs_mask ;1 3 or 7 for F8/F6/F4 tax inx else lda 4,x ; get high byte of return address tay ora #$10 ; change our bank nibble into a valid rom mirror sta 4,x tya lsr lsr lsr lsr tax inx endif lda bankswitch_hotspot-1,x pla tax ; *** restore X pla ; *** restore A rts ; *** RTS will "return" to the address we pushed onto the stack earlier end
-
Woops answered here But I still need to know how to put the hotspots in a table or something? hotspots $FFF6 $FFF7 $FFF8 $FFF9 $FFFA $FFFB I tried this lda $fff6,x and -1 to but didn't work
-
What is temp7's purpose when bankswitching? .L08 ; goto _bank2 bank2 sta temp7 lda #>(._bank2-1) pha lda #<(._bank2-1) pha lda temp7 pha txa pha ldx #2 jmp BS_jsr BS_jsr lda bankswitch_hotspot-1,x pla tax pla rts It looks to me like it's just used to push what's currently in the accumulator to the stack, and that you also push x to the stack, is that just so you can continue your code in another bank? There's no way to ldx or lda (without also assigning it to a variable) in bB, and even if there where, wouldn't it be faster to just sta temp1 stx temp2 and load them after the bankswitching lda temp1 ldx temp2 If I don't need to keep what's in a and x would this work lda #>(._bank2-1) pha lda #<(._bank2-1) pha ldx #2 lda bankswitch_hotspot-1,x rts Just tried it and I got error: Unknown Mnemonic 'bankswitch_hotspot-1,x'. Is bankswitch_hotspot a table? I can't find it anywhere.
-
There's only one bit 7, but the counter would be 138, you can turn the first half into a four bit variable aka nibble, it can only count to 15. macro _Set_Lo_Nibble {1}=(({2}^{1})&$0F)^{1} end def PEEK_Counter = x&$0F def POKE_Counter = callmacro _Set_Lo_Nibble x To set it to 0 POKE_Counter 0 ;notice no equal sign To check if it's 15 if PEEK_Counter = 15 then... To add 1 temp5 = (PEEK_Counter) + 1 POKE_Counter temp5 Then you can use bits 4-7 for other things, it won't affect peeking at the counter since it only checks the first four bits
-
DPC+ bB player0 graphics in other banks
Lillapojkenpåön replied to SpiceWare's topic in batari Basic
Related DPC+ question, how would one load data from tables in different banks with "(Indirect),Y" ? -
This would not work, it would only add a to player1y, and in this case it's 0 so nothing would happen, and I don't think 0.5 sets b to five, probaly 128 or something.
-
I did think that it was because the bB code was compiled first and ignored the conditionals, but I didn't know you had to reference an assembly constant like that, thanks! that worked like a charm.
-
Thanks! I sent it.
-
I got that but didn't make a difference, same errors
-
Unfortunately not ☹️
-
Why can't I get this to work, I get a bunch of errors with 2600basic_variable_redefs.h This compiles but doesn't work as it should asm PFRESOLUTION = 22 end asm if PFRESOLUTION == 22 distance = 132 ;66 for two bytes, 132 for four bytes etc. bytesInColumn = 4 increments = 2 padding = 1 ; 1 or 0 endif end asm if PFRESOLUTION == 11 distance = 66 ;66 for two bytes, 132 for four bytes etc. bytesInColumn = 2 increments = 1 padding = 0 ; 1 or 0 endif end and this compiles and work correctly asm PFRESOLUTION = 22 end asm if PFRESOLUTION == 22 end const distance = 132 ;66 for two bytes, 132 for four bytes etc. const bytesInColumn = 4 const increments = 2 const padding = 1 ; 1 or 0 asm endif end but if I add more conditions like that I get a bunch of old value new value/value mismatch errors asm if PFRESOLUTION == 22 end const distance = 132 ;66 for two bytes, 132 for four bytes etc. const bytesInColumn = 4 const increments = 2 const padding = 1 ; 1 or 0 asm endif end asm if PFRESOLUTION == 11 end const distance = 66 ;66 for two bytes, 132 for four bytes etc. const bytesInColumn = 2 const increments = 1 const padding = 0 ; 1 or 0 asm endif end
-
Arguments not working for stack or bit assignment
Lillapojkenpåön replied to wallaby's topic in batari Basic
You've allready pushed color values to the display RAM, the stack works the same way, here's an easy example.. You know how temp1-temp6 doesn't save the values between frames, because they are used when you call drawscreen, well you can push the values they contain to the stack, right before drawscreen stack 6 ; points to the sixth position in the stack (will start pushing to 5) push temp1 temp2 temp3 temp4 temp5 temp6 ; stores temp1 into stack position 5, temp2 into 4.... temp6 into 0 and pull the values from the stack back into the variables right after drawscreen stack 0 ; points to the first position in the stack pull temp1 temp2 temp3 temp4 temp5 temp6 ; stores stack position 0 into temp6, 1 into temp5.... 5 into temp1 Now you can use those temp variables like regular variables. If you only use it like that you don't need to set the stack pointer in the mainloop since it will be at 0 after the pushes, and at 6 after the pulls, so you just need to set it to 6 before the mainloop. stack 6 I think it would be a little more intuitive if you had to write the variables in the reverse order when pulling pull temp6 temp5 temp4 temp3 temp2 temp1 but bB flips it for you instead. -
It was 4.3 I had before, 4.4 is where it changed, something must have changed in stella then, it opens with a smaller window than before since 4.4
