I need new routine for MSX1, save and load TXT page in videoram for SCREEN1

Door gamecast

Expert (101)

afbeelding van gamecast

12-08-2011, 00:29

Hello Guys,

This time I'm writing because I need a new routine in assembler for MSX1 to save and load the video pages on the TXT videoram of MSX1, for screen1.
below is a source assembler that works for the MSX2, but this routine must be modified to run only 16K videoram for MSX1.

See you to soon.....
^_^
Andrea.

 

; ************************************************************
;  MSX Z80 source file.
;
; Prog: SCROLL 64 in VRAM for SCREEN1 and SCREEN4           
; Code: SAVE TXT and LOAD TXT in VRAM + SCROLL
; Code: Horizzontal(X) LEFT and RIGHT  
; Date: 1/7/09
; ************************************************************
; cmnt:  Sjoerd Mastijn (C) 2009
;
; Coded in TeddyWareZ' Chaos Assembler 3
;
; (C) 2009  Sjoerd Mastijn
;  E-mail: smastijn@gmail.com
; ************************************************************
; Per usare questo programma caricare BLOAD"SCROLL64.BIN",R
; USR7(n) <n> numero di pagina per SAVE TXT in VRAM
; USR8(n) <n> numero di pagina per LOAD TXT in VRAM
; I valori delle pagine vanno da 0 a 63 sulla VRAM.
; USR9(x) <x> x è la posizione di tutte le 64 pagine txt
; salvate con USR7(n) le pagine possono scrollare a sinistra
; e a destra. Il valore di x va da 0 fino a 2016
; x posizione=32*pagina.
; The pages can to scroll to LEFT and RIGHT
; ************************************************************
; E' possibile salvare i dati degli schemi salvati con USR7(n)
; con BSAVE e BLOAD per il caricamento, seguire le istruzioni:
; Per salvare i dati della Video RAM fare:
; POKE&HFCAF,8:BSAVE"TEST.VRM",&H4000,&HFFFF,S:POKE&HFCAF,1
; Per caricare i dati della Video RAM fare:
; POKE&HFCAF,8:BLOAD"TEST.VRM",S:POKE&HFCAF,1
; ************************************************************       

    .org $E000 - 7

    .db $fe
    .dw startProgram,endProgram,startProgram

startProgram:

; scroll64.asm

; 64 screens in VRAM

  .byte 254
  .word start
  .word end
  .word init

  .org 0E000h

start:

init:
  ld hl,tobuf
  ld (0f3a8h),hl
  ld hl,frombuf
  ld (0f3aah),hl
  ld hl,frombufx
  ld (0f3ach),hl
  ret

getpar:
  ld a,(0f663h)
  cp 2
  jr nz,gpret
  ld hl,(0f7f8h)
  ret
gpret:
  pop af
  ret

frombufx:
  call getpar
  jr fbhop

frombuf:
  call getpar
  add hl,hl
  add hl,hl
  add hl,hl
  add hl,hl
  add hl,hl
fbhop:
  ld de,16384
  add hl,de
  ld (readadr),hl
  ld hl,6144+64
  ld (writeadr),hl

copyfrom:
  ld bc,22*256+152
  di
floopy:
  push bc
  ld hl,(readadr)
  call setvramread
  ld de,2048
  add hl,de
  ld (readadr),hl
  ld hl,buffer
  ld b,32
finloop:
  ini
  jr nz,finloop
  ld hl,(writeadr)
  call setvramwrite
  ld de,32
  add hl,de
  ld (writeadr),hl
  ld hl,buffer
  ld b,32
foutloop:
  outi
  jr nz,foutloop
  pop bc
  djnz floopy
  ret

tobuf:
  call getpar
  add hl,hl
  add hl,hl
  add hl,hl
  add hl,hl
  add hl,hl
  ld de,16384
  add hl,de
  ld (writeadr),hl
  ld hl,6144+64
  ld (readadr),hl

copyto:
  ld bc,22*256+152
  di
tloopy:
  push bc
  ld hl,(readadr)
  call setvramread
  ld de,32
  add hl,de
  ld (readadr),hl
  ld hl,buffer
  ld b,32
tinloop:
  ini
  jr nz,tinloop
  ld hl,(writeadr)
  call setvramwrite
  ld de,2048
  add hl,de
  ld (writeadr),hl
  ld hl,buffer
  ld b,32
toutloop:
  outi
  jr nz,toutloop
  pop bc
  djnz tloopy
  ret

setvramread:
  ld a,h
  rlca
  rlca
  and 3
  out (99h),a
  ld a,14+128
  out (99h),a
  ld a,l
  out (99h),a
  ld a,h
  and 63
  out (99h),a
  ret

setvramwrite:
  ld a,h
  rlca
  rlca
  and 3
  out (99h),a
  ld a,14+128
  out (99h),a
  ld a,l
  out (99h),a
  ld a,h
  or 64
  and 127
  out (99h),a
  ret

readadr:
  .word 0
writeadr:
  .word 0
buffer:
  .ds 32

end:
 

endProgram:

.end

Aangemeld of registreer om reacties te plaatsen

Van pitpan

Prophet (3131)

afbeelding van pitpan

12-08-2011, 09:05

Do you mean a RAM -> VRAM / VRAM -> RAM copy routines for the name table in screen 1? That's just a LDIRMV / LDIRVM call Wink

Van gamecast

Expert (101)

afbeelding van gamecast

12-08-2011, 10:40

no, wait, basically using the command A = USR7 (X) copy all the characters on screen1 and stores them on the VRAM and USR8 with A = (X) loads a page with a video saved screen1 USR7, X stands for the number video of the page that goes from 0 to 63.

Now This routine assembler work only MSX2, but I would like that worked for only MSX1.

But what I wanted to change this routine is for MSX1!
Which has only 16K VRAM.
I hope I explained myself well.

Van pitpan

Prophet (3131)

afbeelding van pitpan

12-08-2011, 10:53

Then it's like I said: LDIRVM and LDIRMV. You CAN do that by yourself, just check the BIOS function input parameters.

Van gamecast

Expert (101)

afbeelding van gamecast

12-08-2011, 17:16

However, if you please explain to me the BIOS settings of MSX1, I alone am not able, sorry ....

If for you is so simple and easy, I could put a post with the routine changed for MSX1 16K VRAM, please?
A after .....
Andrea ^ _ ^

Van Manuel

Ascended (15822)

afbeelding van Manuel

12-08-2011, 21:39

gamecast: I'd really recommend to try these things yourself a bit and if you get stuck in the attempt, then ask questions on how to proceed. You'll never learn it if you ask others to write your routines...