Videopac / Odyssey2 forum
August 18, 2022, 04:26:43 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Join Rafael's Haunted Woods contest and win a copy of the game!
 
   Home   Help Login Register links videopac.nl  
Pages: [1]   Go Down
  Print  
Author Topic: how to assemble 8k program?  (Read 169 times)
maeloterkim
Trying to get the cartridge in...
*
Posts: 3


« on: July 30, 2022, 08:40:07 AM »

Hello all

I am trying to make an 8K program for the videopac g7000
and the problem is that I don't know how to assemble and emulate it

I have read practically all the forum and I have not found anything on this.

I am using asw compiler on linux

the questions are as follows:

Can I compile all 8K into a single file?
What directives should I put so that the compiler knows which bank it is in?

Do I have to compile 4 files of 2K separately ( one for each bank from 400h to BFFh )  and then put them together?

Is there no conflict if I join 4 different files with the same org directives between 400h and BFFh?

When I put them together, how does the compiler and emulator know which bank it is?
Is there a assembler directive that tells the compiler and emulator which bank it's on?

What structure should I use to compile them?

I am using asw compiler on linux

I need only a initial empty estructure thats compiles 8K program

Thank you
« Last Edit: July 30, 2022, 08:52:02 AM by maeloterkim » Logged
Rafael
Pedit5
I take the Videopac and leave the Canoli!
*
Posts: 2837



« Reply #1 on: July 30, 2022, 06:00:59 PM »

I use to make 4 2k bank file and after join all files via DOS
copy/b rom1.bin + rom2.bin + rom.bin + rom4.bin  final.bin
Logged

manopac
Game & App Development
Give this man a Jopac!
*
Posts: 1171



« Reply #2 on: July 30, 2022, 06:19:11 PM »

Lots of questions Cheesy

how you assemble it, Rafael already answered

as for the other questions - well:
every single bank starts at $400 - because the processor can handle only 4K of address - of which the first KByte ($000-$3FF) is hardwired occupied by the BIOS, so it basically leaves a max of 3K of addressable space for programs - and because its easier to program, most programmers use just 2K of those 3 ...

so now you might ask "but there are roms with 8K - how do they do it ??"

well - here comes the beauty of bankswitching ... if you look at the pins of the cartridge you will see that 2 of those are used as address-lines ... by switching those pins on/off you will access a different region of the cartridge basically telling the cartridge which 2K (or 3K) of the 8K (or 12K) you want to access - so the videopac will always only access 3K of cartridge memory - but what the cartridge presents to the processor will differ if those 2 pins are set/cleared ...

so for the assembler you always assemble for a start at $400 in every bank

I hope this makes sense? :-)
Logged

sex, lies, and videopac
maeloterkim
Trying to get the cartridge in...
*
Posts: 3


« Reply #3 on: July 30, 2022, 06:28:43 PM »

I use to make 4 2k bank file and after join all files via DOS
copy/b rom1.bin + rom2.bin + rom.bin + rom4.bin  final.bin

Thanks

I guess rom.bin is rom3.bin


Logged
maeloterkim
Trying to get the cartridge in...
*
Posts: 3


« Reply #4 on: July 30, 2022, 06:30:08 PM »

Lots of questions Cheesy

how you assemble it, Rafael already answered

as for the other questions - well:
every single bank starts at $400 - because the processor can handle only 4K of address - of which the first KByte ($000-$3FF) is hardwired occupied by the BIOS, so it basically leaves a max of 3K of addressable space for programs - and because its easier to program, most programmers use just 2K of those 3 ...

so now you might ask "but there are roms with 8K - how do they do it ??"

well - here comes the beauty of bankswitching ... if you look at the pins of the cartridge you will see that 2 of those are used as address-lines ... by switching those pins on/off you will access a different region of the cartridge basically telling the cartridge which 2K (or 3K) of the 8K (or 12K) you want to access - so the videopac will always only access 3K of cartridge memory - but what the cartridge presents to the processor will differ if those 2 pins are set/cleared ...

so for the assembler you always assemble for a start at $400 in every bank

I hope this makes sense? :-)



Thank you

Is there any emulator that can emulate a 12K program?

Logged
manopac
Game & App Development
Give this man a Jopac!
*
Posts: 1171



« Reply #5 on: July 30, 2022, 08:25:05 PM »

O2EM :-) will run Kill the Attacking Aliens (12K Rom) just fine
Logged

sex, lies, and videopac
TedFoolery
Attacked the Timelord
***
Posts: 108


« Reply #6 on: August 01, 2022, 04:07:46 PM »

A few notes:
--yes, make 4 separate 2k files
--append them as bank0, bank1, bank2, bank3
--The game always starts in the highest bank, so an 8k rom will start in bank3, 4k rom will start at bank1
--you have to manually switch to other banks, ie. if the cpu is at the end of bank0, the game won't advance to bank1. It will just stay in bank0. You have to alter some bits in P1 to get to another bank (then typically do a jmp). There's functions in the bios that help with this starting at $037f
--12k roms won't work on real hardware with the voice module (8k are fine)
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!