+chue Posted June 16, 2017 Share Posted June 16, 2017 So how does global variables work with bank switching? If I put them in the same space as the trampolines and cart headers I have to declare them 4 times with four different symbols. As Tursi said just declare them once. By definition, variables change and therefore are stored in RAM. You shouldn't be bank switching them. Bankswitching is only for ROM content. Is there an easy way to see how much RAM is being used ...? One of the build output files is called "link.map" and contains the ROM/ RAM layout. Look for the ".data" and ".bss" sections, which will show your RAM usage. Here is a sample from the bankswitch project that I uploaded earlier in this thread: .data 0x000000000000a000 0x2 load address 0x000000000000c05e 0x000000000000a000 _data = . persistent/*.o(.data) .data 0x000000000000a000 0x0 persistent/utils.o .data 0x000000000000a000 0x2 persistent/trampolines.o 0x000000000000a000 bankbase .data 0x000000000000a002 0x0 persistent/vdp.o bank0/*.o(.data) .data 0x000000000000a002 0x0 bank0/main.o bank1/*.o(.data) .data 0x000000000000a002 0x0 bank1/functions1.o bank2/*.o(.data) .data 0x000000000000a002 0x0 bank2/functions2.o 0x000000000000a002 _data_end = . .data 0x000000000000a002 0x0 bank0-head/cart_header.o .data 0x000000000000a002 0x0 bank0-head/crt0.o .data 0x000000000000a002 0x0 bank1-head/cart_header.o .data 0x000000000000a002 0x0 bank1-head/crt0.o .data 0x000000000000a002 0x0 bank2-head/cart_header.o .data 0x000000000000a002 0x0 bank2-head/crt0.o .data 0x000000000000a002 0x0 bank3-head/cart_header.o .data 0x000000000000a002 0x0 bank3-head/crt0.o .bss 0x000000000000a002 0x4 load address 0x000000000000c060 0x000000000000a002 _bss = . persistent/*.o(.bss) .bss 0x000000000000a002 0x0 persistent/utils.o .bss 0x000000000000a002 0x2 persistent/trampolines.o 0x000000000000a002 currentbank .bss 0x000000000000a004 0x2 persistent/vdp.o 0x000000000000a004 current_line bank0/*.o(.bss) .bss 0x000000000000a006 0x0 bank0/main.o bank1/*.o(.bss) .bss 0x000000000000a006 0x0 bank1/functions1.o bank2/*.o(.bss) .bss 0x000000000000a006 0x0 bank2/functions2.o 0x000000000000a006 _bss_end = . .bss 0x000000000000a006 0x0 bank0-head/cart_header.o .bss 0x000000000000a006 0x0 bank0-head/crt0.o .bss 0x000000000000a006 0x0 bank1-head/cart_header.o .bss 0x000000000000a006 0x0 bank1-head/crt0.o .bss 0x000000000000a006 0x0 bank2-head/cart_header.o .bss 0x000000000000a006 0x0 bank2-head/crt0.o .bss 0x000000000000a006 0x0 bank3-head/cart_header.o .bss 0x000000000000a006 0x0 bank3-head/crt0.o As you can see it starts at a000 and ends at a006, so the project uses that range for RAM/ variables. Quote Link to comment Share on other sites More sharing options...
mindlord Posted June 17, 2017 Share Posted June 17, 2017 (edited) Thanks Chue and Tursi! I think I've worked out all the kinks. Works on Real Iron! Works on JS99'er with 32K expansion turned off too. I'm excited. Edited June 18, 2017 by mindlord 1 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.