News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

How do I access more than 64kb in pasmo?

Started by ssr86, 14:21, 15 April 15

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ssr86

I need to know how do I insert some code in the additional memory in pasmo assembler... :-[
I remember that with winape built-in assembler that was achieved with "write direct -1,-1,mem_config" changing the current memory banks configuration. But how do I do it in pasmo (and maybe sjasm, although I'm currently using pasmo)?


arnoldemu

I would use (and have used) this method:

Create 1 asm file for each bank and 1 asm file in main ram.

e.g.

main.asm @ &100 (any size. e.g. &100-&a700)
bank1.asm @ &4000 (max 16384 bytes)
bank2.asm @ &4000 (max 16384 bytes)
bank3.asm @ &4000 (max 16384 bytes)

Use pasmo to build the banks and output a list file. This is the best part. The listing file is

label equ <value> so you can include it in your main.asm!

to build:

pasmo --amsdos bank1.asm bank1.bin bank1.lst
pasmo --amsdos bank2.asm bank2.bin bank2.lst
pasmo --amsdos bank3.asm bank3.bin bank3.lst
pasmo --amsdos main.asm main.bin

Build main last so you can include the listing files (which are label equ value).

Each bank looks like this:


org &4000

;; bank code/data

;; keep data to less than 16384 bytes
bank1_function:
ret


I think there may be a way to get pasmo to generate an error if you exceed the end of the bank.
Something like



if $>=&8000
.error "Bank too large
endif



In main.asm you can do this:


include "bank1.lst"
include "bank2.lst"
include "bank3.lst"

org &100

ld bc,&7fc4
out (c),c
call bank1_function

ld bc,&7fc5
out (c),c
call bank2_function



Now you also need a loader that looks a bit like this (basic used here):


10 out &7f00,&c4:load"bank1.bin",&4000
20 out &7f00,&c5:load"bank2.bin",&4000
30 out &7f00,&c6:load"bank3.bin",&4000
40 out &7f00,&c0:run"main


The basic program loads the banks, restores the normal configuration and then loads the main which can be any size.

The main code can page in the banks and call functions, or use data from the banks.

This works great but you can't use the same label in each bank if you include the listing files because the labels will collide.

I have a fully setup example which I will attach when I find it.

Now, if you had said "how do I do it using sdcc", well that's an example I haven't prepared yet and involves a bit more work ;)
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Munchausen


ssr86

Thank you as always, arnoldemu :)

Powered by SMFPacks Menu Editor Mod