EXTENDED RAM 16K MAPPER for LEVELS GAME

Door gasparrini

Champion (301)

afbeelding van gasparrini

12-04-2019, 22:36

Hello,

After a long time I still write to you on this forum.
In Italy things are really bad! And it makes us feel less and less Italian, but that's another story.
We come to the problem in my question for MSX, as usual.

I ask your always kind help of all time.

I should map to MSX1, using a 16K RAM memory mapper cartridge,
and store the game levels for SCREEN1.
already have ready routines, but not finished, that's why I ask you.

name file BASIC: RAM16K.BAS

10 IF PEEK(&HF677)=128 THEN POKE &HC000,0:POKE&HF677,&HC0:RUN"RAM16K.bas"
20 OUT &HFE,2:BLOAD "LEVELS.BIN":OUT &HFE,1:REM start  LEVELS at 4000h
22 PS=(INP(&HA8)AND192)/64:S=PS+PEEK(&HFCC1+PS)+(PEEK(&HFCC5+PS)
AND192)/16:REM calculate slot ID
24 POKE &HFA00,&HF7:POKE &HFA01,S:POKE &HFA02,&H0
:POKE &HFA03,&H40:POKE &HFA04,&HC9:DEFUSR0=&HFA00 : REM Poke insterslot call to START
26 POKE &HFA05,&HF7:POKE &HFA06,S:POKE &HFA07,&H20
:POKE &HFA08,&H40:POKE &HFA09,&HC9:DEFUSR1=&HFA05 : REM Poke insterslot call to INTON
28 POKE &HFA0A,&HF7:POKE &HFA0B,S:POKE &HFA0C,&H50
:POKE &HFA0D,&H40:POKE &HFA0E,&HC9:DEFUSR2=&HFA0A : REM Poke insterslot call to INTOFF
29 U=USR(0):U=USR1(0): REM start and play
30 REM poke &Hf677,128:run "example.bas":
REM RUN EXAMPLE GAME PROGRAM

This first program is the loader BASIC for LEVELS.BIN in RAM 16K RAM MAPPER

This routine assembler to use for LEVELS GAME for SCREEN1

; Prog:             
; Code: [YOUR HANDLE]
; Date: 7/11/2017
;
; 
;
; Coded in TeddyWareZ' Chaos Assembler 3
;
; (C) 2018 EDIZIONI DATAPRINT MAGAZINE

LDIRVM  .equ $005C     ; routine del BIOS usata per riempire la VRAM
CHRPUT  .equ $1800     ; CHAR PUT  (PRINT BASIC) 


    .org $9000 - 7

    .db $fe
    .dw startProgram,endProgram,startProgram



startProgram:

	jr main
sel:	           ; selezione livello di gioco
	.db 0      ; selezione livello di gioco
main:
	ld ix,table
	ld a,(sel)
	add a,a
	ld c,a
	ld b,0
	add ix,bc
	ld l,(ix+0)
	ld h,(ix+1)

;   ld      hl,LEVEL1  ; READ LEVELS
   ld      de,CHRPUT+64
   ld      bc,32*22
   call    LDIRVM
   RET
table:	.DW LEVEL1,LEVEL2,LEVEL3,LEVEL4,LEVEL5,LEVEL6,LEVEL7,LEVEL8
            .DW LEVEL9
            
LEVEL1: 
  ..............
  ..............
  ..............
LEVEL2:
  ..............
  ..............
  ..............
LEVEL3:
  ..............
  ..............
  ..............

ECT....



endProgram:

.end

This last part you need to use the LEVELS.BIN file that must be stored there

GetPage3Slot:
	call RSLREG
	and %11000000
	rlca
	rlca
	ld c,a
	ld b,0
	ld hl,EXPTBL
	add hl,bc
	ld c,a
	ld a,(hl)
	and $80
	or c
	ld c,a
	inc hl  ; move to SLTTBL
	inc hl
	inc hl
	inc hl
	ld a,(hl)
	and %11000000
	rrca
	rrca
	rrca
	rrca
	or c
	ret
Aangemeld of registreer om reacties te plaatsen

Van gdx

Prophet (3092)

afbeelding van gdx

13-04-2019, 12:44

What mapper do you have?
Have you seen this page?
https://www.msx.org/wiki/Memory_Mapper

Van gasparrini

Champion (301)

afbeelding van gasparrini

13-04-2019, 13:26

Hello GDX,

I have a mapper cartridge national 16K RAM

Unfortunately I don't able to do the assembler routine on my own
that's why I asked for your help here

Van gdx

Prophet (3092)

afbeelding van gdx

13-04-2019, 15:02

Ok, I did not understand your problem. This is not a mapper that you have but this expansion of 16kB RAM for MSX1.

Maybe this will help you:
https://www.msx.org/wiki/Assembler_for_Dummies_%28Z80%29
https://www.msx.org/wiki/Category:Programming#Assemblers_for...

Van gasparrini

Champion (301)

afbeelding van gasparrini

04-05-2019, 15:19

Hello to all you of the world MSX,

perhapes I explained myself wrongly, and I do my excese me.
Now I try to explain myself better.

The point is this:

through the two routers in assembler and the BASIC listing which recalls the routine that must be allocated to page 3 of the RAM, which would require a RAM expansion for the MSX1.

So I need an assembler routine that is allocated to page 3 of the RAM, so that it is allocated on a 16K RAM RAM expansion cartridge.

On this RAM expansion, there must be stored only the game levels of the first routine above as an example.
Then it is called via BASIC with two USRs, for example:

DEFUSR0=&HFA00:DEFUSR1=&HFA05
A=USR(0):A=USR1(0)

Unfortunately the small program in BASIC, shows an example to recall a song in machine code with interrupt-time function.

That's why maybe I explained myself wrongly, sorry if you can.
I'm still waiting for your good news.

Van Wlcracks

Champion (326)

afbeelding van Wlcracks

04-05-2019, 21:07

First 16k isnt a memory mapper. Its an memory expansion i guess. A mapper can map memory on pages, so it contains a mapper mechanism. For 16k this not done. Only >64k ram should have a memory mapper.

Second the expansion will be set at i guess &h8000-&hbfff page or &h4000-&h7fff. Most logic would be for 16kRAM MSX to put it at &h8000-&hbfff.
The MSX will search the slot and i guess and will put the external expansion first before other memory. This should be easy to check with MCM memory map program (msxmem.bas). It would help if you posted the screen, and tell the msx type you use.

I don't understand this sentence: "So I need an assembler routine that is allocated to page 3 of the RAM, so that it is allocated on a 16K RAM RAM expansion cartridge."

I think you want to put your levels in the extra memory cart. But if you want to run the program on other MSXcomputers it will be an hell of a job. Normally if your MSX has <32k or <16kram its would be recommended to use an external 64kram module in one slot. The other (internal) memory is regarded as wasted, or programs in MSXdos2 or higher with memman could use it, depending on your setup.

EDIT: its even mentioned here: https://www.msx.org/wiki/Sony_HBM-16

Its RAM is placed on page 2 (8000h~BFFFh). As such it is only useful to upgrade a 16kB MSX to 32kB. However the systems base memory and the expansion will be in different slots which can cause compatibility problems with some software that blindly assumes all memory to be in a single slot.

"
NOTE!
If you are looking for a memory expansion we recommend to buy another standard expansion. A 64kB RAM expansion, or even better a Memory Mapper cartridge that initializes its segments itself at start up is the best choice.
"

EDIT EDIT: maybe use an compressor like "msx-o-mizer" this would save a lot of memory in level design.