New multi purpose board:512K RAM Expansion/32x Rom board/256K Ram+2X Rom board

Started by ikonsgr, 18:25, 05 September 22

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

revaldinho

Quote from: d_kef on 10:26, 16 September 22Also the Dk'tronics RAM expansions offered support for C3 mode by overdriving /MREQ and A15.
Discussion here and here.

d_kef
Yes, but as the discussions say there are limitations compared with the actual 6128 implementation. In the 464, reads intended to be taken from remapped memory may not come from RAM if ROM is enabled in the same address space. This is the issue which prevents FutureOS from displaying the mouse pointer correctly for example.

revaldinho

Quote from: ikonsgr on 10:29, 16 September 22Maybe this is feesible using CPLD, but i don't think you can do it, using CLC's from the PIC mcu...  ::)
Anyway, as you also mention, this C3 mode is practically used only with future OS and CPM+, so it doesn't affect the ability to run games and other programs that require 128k ram on cpc 464 (or need 6128 fw+basic too, using the dual mode of 256k ram+2x roms),which i suppose is the "main point" for most cpc464 owners  :D


If you don't currently overdrive A15 at all, you can get the DK'Tronics C3 compatibility with something like this

                                                                ________ Remap <a15,a14>=01 to 11 in C3 mode
                                                               /      __ ..otherwise leave adr15 alone
                                                              /      /
 assign A15 = (overdrive_mode & mode3_q & A14 & !mreq_b ) ? 1'b1 : 1'bz ;
                      \             \        \       \
                       \             \        \_______\_________________ CPU signals
                        \             \_________________________________ (static) mode selection FF
                         \______________________________________________ (static) '464 mode' (DIP SW?) setting

This would give you the 'ROM Remapped' message in Duke's C3 test, and I think that this is enough to run CPM+ on the '464.

TotO

(sorry, already posted)
"You make one mistake in your life and the internet will never let you live it down" (Keith Goodyer)

ikonsgr

I gave a little thought about supporting this "cursed" c3 mode on a CPC464:

Configuration "3":
Z80 Memory Range    Sub-block
&0000-&3fff                0  (internal ram)
&4000-&7fff                3  (internal ram)
&8000-&bfff                2  (internal ram)
&c000-&ffff                3*  (external ram)

I believe it might be done, but it would require quite a lot of extra parts and testing/experimantation. One problem with "backdrive" A15 from '0' to '1' is that, it will also activate &c000-&ffff range, so there must be a way of blocking this activation, in case of having initially &4000-&7fff range (e.g. A15=0, A14=1).
Then,on CPC464, MREQ is suppressed whenever a write (actually i'm using opposite logic of RD=>Read signal=1 e.g. inactive read,using directly signal WR=0, didn't work right) to &c000-&ffff range occurs,in order to avoid shadow write on internal ram at same address. This might complicate things more.
Anyway,what i thought of, is to use a 74LS123 which is a single shot monostable multivibrator that will issue a pulse of ~1us (or a bit less) to A15 whenever a trigger occurs. The trigger would be a logic combination of A14=1&A15=0& MREQ=0, and an extra signal which will be activated whenever a C3 mode is selected (possibly a pin from  PIC mcu)
Of course this would also require an extra logic chip (i can't use CLC from PIC as all available are already in use), and possibly a diode and/or a transistor on the output pulse.
 If this finally works, it would require a complete redesign of the board, and ofcourse there would be a cost increase.
But,to tell you the truth,i don't think that it really worth the trouble, just to be able to run symbos and futureos on a CPC464...  ::)



TotO

The C3 mode is not a must have, most programs (99,9%) do not use it.
It will be more interresting to see more programs using the extra RAM.
"You make one mistake in your life and the internet will never let you live it down" (Keith Goodyer)

d_kef

Quote from: ikonsgr on 10:29, 17 September 22I gave a little thought about supporting this "cursed" c3 mode on a CPC464:

Configuration "3":
Z80 Memory Range    Sub-block
&0000-&3fff                0  (internal ram)
&4000-&7fff                3  (internal ram)
&8000-&bfff                2  (internal ram)
&c000-&ffff                3*  (external ram)

I believe it might be done, but it would require quite a lot of extra parts and testing/experimantation. One problem with "backdrive" A15 from '0' to '1' is that, it will also activate &c000-&ffff range, so there must be a way of blocking this activation, in case of having initially &4000-&7fff range (e.g. A15=0, A14=1).
Then,on CPC464, MREQ is suppressed whenever a write (actually i'm using opposite logic of RD=>Read signal=1 e.g. inactive read,using directly signal WR=0, didn't work right) to &c000-&ffff range occurs,in order to avoid shadow write on internal ram at same address. This might complicate things more.
Anyway,what i thought of, is to use a 74LS123 which is a single shot monostable multivibrator that will issue a pulse of ~1us (or a bit less) to A15 whenever a trigger occurs. The trigger would be a logic combination of A14=1&A15=0& MREQ=0, and an extra signal which will be activated whenever a C3 mode is selected (possibly a pin from  PIC mcu)
Of course this would also require an extra logic chip (i can't use CLC from PIC as all available are already in use), and possibly a diode and/or a transistor on the output pulse.
 If this finally works, it would require a complete redesign of the board, and ofcourse there would be a cost increase.
But,to tell you the truth,i don't think that it really worth the trouble, just to be able to run symbos and futureos on a CPC464...  ::)



You've got a valid point there.
It really doesn't worth the effort.
Maybe it's easier to think about it for USIfAC III, and again it's not a must have.

Can you suggest a few 128k games in order to test the ram rom board with 464 and ga 40007?

d_kef

ikonsgr

Quote from: d_kef on 12:10, 17 September 22Can you suggest a few 128k games in order to test the ram rom board with 464 and ga 40007?
d_kef

 Star sabre and Super edge grinder comes to mind, both very good "modern era" shoot'em ups.
You can also check this list here: https://docs.google.com/spreadsheets/d/1dVFDK63R0wTtEo1vFLDO359uj1w7iHIatQ2Xz-6erfM/edit?usp=sharing

And try games that don't work on a stock CPC464, especially the ones noted "128k".

asertus

Hi @ikonsgr 

I have just seen this message in a Spanish forum, maybe you can reply..

https://www.amstrad.es/forum/viewtopic.php?p=84943#p84943

Usifac II y la memoria
Mensajepor 
Ivan » Sab 17 Sep , 2022 6:47 pm
Hola,
un usuario me ha reportado una imagen ejecutando un juego mío en un Amstrad real. El juego carga de forma correcta, aparece el menú y cuando le da a la opción de 'jugar', el juego crashea dando el error 'línea no existe' (juego realizado en BASIC).
Parece un problema de memoria. Me he bajado el DSK y en el Winape funciona correctamente. El usuario carga el juego desde un Usifac así que mi pregunta es si estos cacharros utilizan parte de la memoria para emular la disquetera.
Pero.... aunque fuera el caso, es un juego sin cargas adicionales, el juego completo se carga de una sola vez. Si fuera por falta de memoria, ¿no debería fallar durante la carga?

ikonsgr

Quote from: asertus on 20:28, 17 September 22Hi @ikonsgr
I have just seen this message in a Spanish forum, maybe you can reply..
https://www.amstrad.es/forum/viewtopic.php?p=84943#p84943
Usifac II y la memoriaMensajepor
Ivan» Sab 17 Sep , 2022 6:47 pm
Hola,
un usuario me ha reportado una imagen ejecutando un juego mío en un Amstrad real. El juego carga de forma correcta, aparece el menú y cuando le da a la opción de 'jugar', el juego crashea dando el error 'línea no existe' (juego realizado en BASIC).
Parece un problema de memoria. Me he bajado el DSK y en el Winape funciona correctamente. El usuario carga el juego desde un Usifac así que mi pregunta es si estos cacharros utilizan parte de la memoria para emular la disquetera.
Pero.... aunque fuera el caso, es un juego sin cargas adicionales, el juego completo se carga de una sola vez. Si fuera por falta de memoria, ¿no debería fallar durante la carga?


 Well, this forum is in spanish, and i'm not a member too  :)  Anyway, the only RAM used by the various load/run routines is the 512byte @ &A9B0 which is commited as load buffer for sectors.

GUNHED

Well, in my opinion a proper &C3 RAM mode (= CPC6128 compatibility) is maybe not a must-have, but nevertheless very important.

Quite some software does use it, especially newer and more complex software uses this great RAM mode.

Don't forget it's a great way to access the video RAM (&C000-&FFFF) from an upper ROM directly. 

In brief it's a great benefit for ROM based games, 
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

d_kef

Quote from: ikonsgr on 13:50, 17 September 22And try games that don't work on a stock CPC464, especially the ones noted "128k".

I tested the following 128K only games:
Altered Beast
Deva Drifter
Gryzor
Operation Wolf
Edge Grinder
Shinobi
Skweek
Star Sabre
Tank
Target Renegade

All of them were tested with  a USIfAC II + RAM/ROM board on a CPC6128 just for reference and started without any problems.

On the CPC464 I could only test them with a M4 + RAM/ROM board with CPC 6128 Basic ROM, AMSDOS ROM and FW ROM installed.
Eight of them played without any problems.
Deva Drift started to load and after drawing the track the game froze showing a black screen.
Star Sabre froze after the loading screen.

Also when the M4 is connected to the RAM/ROM board connector it doesn't "behave" well. Some times it shows a garbled directory after the CAT command and also some artifacts on the screen (see attached photo). The games most of the time load and play normally but about 5% of the loading attempts end up to a freeze or a reset.
When the M4 is connected directly to the cable everything is good.
I re-soldered the 50 way socket on the RAM/ROM board just in case there was a dry join but thet didn't help. I also tried an external PSU but that didn't help either.



d_kef

ikonsgr

Quote from: d_kef on 20:20, 18 September 22I tested the following 128K only games:
Altered Beast
Deva Drifter
Gryzor
Operation Wolf
Edge Grinder
Shinobi
Skweek
Star Sabre
Tank
Target Renegade

I confirm, all these games works fine using USIFAC II with RAM/ROM board and CPC6128

Quote from: d_kef on 20:20, 18 September 22On the CPC464 I could only test them with a M4 + RAM/ROM board with CPC 6128 Basic ROM, AMSDOS ROM and FW ROM installed.
Eight of them played without any problems.
Deva Drift started to load and after drawing the track the game froze showing a black screen.
Star Sabre froze after the loading screen.
All these games run fine using USIfAC II+ram/rom board on my CPC464 (a Schneider CPC464 with 40010GA). Funny thing, star sabre was my main "test game" (used to test both 512k ram mode and 256k/2x rom mode), and always run fine even with the early test boards  ::)

Quote from: d_kef on 20:20, 18 September 22Also when the M4 is connected to the RAM/ROM board connector it doesn't "behave" well. Some times it shows a garbled directory after the CAT command and also some artifacts on the screen (see attached photo). The games most of the time load and play normally but about 5% of the loading attempts end up to a freeze or a reset.
When the M4 is connected directly to the cable everything is good.
I re-soldered the 50 way socket on the RAM/ROM board just in case there was a dry join but thet didn't help. I also tried an external PSU but that didn't help either.

 When you say "the M4 is connected directly to the cable", you mean the cable with 2 female IDC connectors you mentioned in eralier post?
 If that's the case, and  adding the fact that when M4 is connected to the RAM/ROM board connector it doesn't "behave" well, i believe it  confirms that,ram/rom board might need further widen of ground/common traces, and perhaps 5v supply traces too. Internal resistance of ground traces (and sometimes 5v supply traces too),can affect all signals, and although current design seemed to be adequate for USIfAC II board needs (a small pcb with a single chip) , that's might not be the case for the quite larger M4 board, with the much more complex and powerful 32bit RISC mcu, and 5v/3.3v I/O level shifter chip.
 Moreover,the fact that as you wrote:"games most of the time load and play normally" implies that, this could be a "marginal" failure, for the tolerable internal trace resistances.
 I remember that i got same erratic behaviors with the early boards (where ram/rom board's internal resistances of traces, especially for ground/5v supply, where much larger than with current ram/rom board) where using a different ribbon cable or even moving ribbon cable, could affect the functioning of the board! But when i reduce significantly all internal resistances of board traces, problem resolved.

ikonsgr

TO MODERATORS:
 There must be a problem with editing posts. Sometimes, a new post created instead of editing the current post (like this one :-) ).
Also, the recently change of not allowing to edit posts after a while, it's not a very good idea, especially for presentation threads like this one, where very often a constant update for the current state of the project is needed! Until recently, i had made 100's of updates to the 1st post of USIfAC II thread, if i couldn't do it, we would end up to an endless row of extra update posts, mixed with 100's of other posts!
So, maybe you should allow again post editing, at least for the 1st post of each thread, or for specific categories of the forum which definetely needs it, like the CPC hardware.

Takis Kalatzis

Hello from me as well,

First test results connecting the board to an 6128 with also an M4 board (no external power):

- Always get garbled output on CAT command. However, M4 Frontend utility shows directories correctly.
- Games seem to load correctly from M4 SD card (only ran a couple ones, though).
- SymbOS 3.1 seems to start from M4 SD, reports 320K or RAM.
- Llopis diagnostic utility (https://github.com/llopis/amstrad-diagnostics) also seems to report 320K for Upper RAM. Should this be the number?

Will continue with more testing.

Takis

Skunkfish

Quote from: ikonsgr on 08:22, 19 September 22the recently change of not allowing to edit posts after a while, it's not a very good idea

I'm with you on this one. Yes, it prevents incidents like we had of one user going back and turning all their posts to gibberish, but it's not like that is a frequent occurrence and I can't see any of the regulars doing the same.
An expanding array of hardware available at www.cpcstore.co.uk (and issue 4 of CPC Fanzine!)

ikonsgr

Quote from: Takis Kalatzis on 11:44, 19 September 22- SymbOS 3.1 seems to start from M4 SD, reports 320K or RAM.
- Llopis diagnostic utility (https://github.com/llopis/amstrad-diagnostics) also seems to report 320K for Upper RAM. Should this be the number?
If you are in 256k/2xrom dual mode, then yes, 320kb is the total available memory (64kb base+256k expansion). But if you use the default 512K ram mode, you should get 576kb in total. It would be highly unlikely (and never seen before  on many tests i've made so far), to get reports of 320kb ram in the 512k mode...

Takis Kalatzis

Quote from: ikonsgr on 17:10, 19 September 22
Quote from: Takis Kalatzis on 11:44, 19 September 22- SymbOS 3.1 seems to start from M4 SD, reports 320K or RAM.
- Llopis diagnostic utility (https://github.com/llopis/amstrad-diagnostics) also seems to report 320K for Upper RAM. Should this be the number?
If you are in 256k/2xrom dual mode, then yes, 320kb is the total available memory (64kb base+256k expansion). But if you use the default 512K ram mode, you should get 576kb in total. It would be highly unlikely (and never seen before  on many tests i've made so far), to get reports of 320kb ram in the 512k mode...
I tested again today with only the memory expansion board connected. Diagnostic utility shows again 320KB RAM.

I pressed the switching button on the board and re-executed the test, the result was 192KB RAM.

ikonsgr

Quote from: Takis Kalatzis on 09:22, 20 September 22I tested again today with only the memory expansion board connected. Diagnostic utility shows again 320KB RAM.
I pressed the switching button on the board and re-executed the test, the result was 192KB RAM.

That's most unusual, it's like as,for some reason, the upper address bit of external ram is not recognized, and instead of getting 512k and 256k you get 256k and 128k....  ???
Try to press firmly RAM chip on socket, or even unplug and plug it again.
In anycase, did you try to load games/programs and see if it works ok (even with half size...)?

GUNHED

Hi there :-)
What do I need to do if I want to program a ROM (using the 32x ROM mode)?
Couldn't find a hint in the manual how to actually write 16 KB into a ROM.
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

ikonsgr

Quote from: GUNHED on 12:54, 20 September 22Hi there :-)
What do I need to do if I want to program a ROM (using the 32x ROM mode)?
Couldn't find a hint in the manual how to actually write 16 KB into a ROM.
You use "loadrom" utility, which can be found here: https://www.dropbox.com/s/ddu058gqvu4jvn0/RAM-ROM%20BOARD.zip?dl=0
You just give rom filename and the rom number you want to be placed.
All programs are explained in User's guide: https://www.dropbox.com/s/40ocl6dzrdbksz0/Readme.pdf?dl=0

GUNHED

Well, of course I can disassemble your tool. But what I need is to know how to program data into a ROM - for installing FutureOS for example.
Would be great if you can share this information - except it's confidential.  :)
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

ikonsgr

Quote from: GUNHED on 20:01, 21 September 22Well, of course I can disassemble your tool. But what I need is to know how to program data into a ROM - for installing FutureOS for example.
Would be great if you can share this information - except it's confidential.  :)
Ah, i see... you mean the actual code for placing rom files into sram
It's top secret, but i manage to "Steal" the code  :)  :
;; firmware function to find a RSX
.kl_find_command equ &bcd4
name_adr equ &9001
rom_number equ &9000

write"ROM.BIN" 
org &8000

        LD    A,&FB
        iN    A,(&De)
    or    a
    jp    z,usb_dis_err
   
    ld    a,(name_Adr)
    ld    (rom_name_size),a
    ld    hl,name_Adr+1
    ld    (rom_name),hl
   
;    ld    a,&fb
;    in    a,(&d8)                ;a=USIfAC II Rom number
;    ld    (set_dir+2),a

;    jp    jump_1
;;#######################################################

start_:
    CALL    set_directory

    ld    bc,&fbd0
    call    usb_cmd
    ld    a,&2f
    out    (c),a

    ld    c,&d9
    ld    a,1
    out    (c),a
    ld    c,&d0
    ld    a,&FB
        in    a,(&D3)
    or    a
    jp    nz,continue_77

    ld    a,"/"
    out    (c),a

continue_77:   
    ld    hl,(rom_name)
    ld    a,(rom_name_size)
    ld    e,a
name_loop:
    call    upper_case
    out    (c),a
    dec    e   
    jr    z,cont1
    inc    hl
    jr    name_loop
cont1:
    inc    hl
    xor    a
    ld    (hl),a
    out    (c),a
    call    clear_buffer
    call    usb_cmd
    ld    a,&32
    out    (c),a
    call    check_responce
    ld    A,&FB
        in    A,(&D0) 
    cp    &14
    jp    nz,no_file

;;------------------------------------------------
    ld    a,(&9000)            ;rom number to be placed in 512k SRAM   
    call    set_ram_config
    ld    b,&7f
    out    (c),a
    ld    bc,&fbd0
    ld    hl,&4000
next_chunk:   
    ld    e,128
    call    fetch   
    xor    a
    cp    e
    ret    z                ;exit from routine

copy_next_byte:
    inc    c
is_byte_avail:
    in    a,(c)
    jr    z,is_byte_avail
    dec    c
    ini
    inc    b
    dec    e
    jr    nz,copy_next_byte
   
    call    clear_buffer            ;update read file pointer
    ld    a,&57
    out    (c),a           
    ld    a,&ab
    out    (c),a
    ld    a,&3b
    out    (c),a
    call    check_responce
    in    a,(c)   
    jr    next_chunk

;------------------------------------------------------------
check_responce:
        LD A,&FB
        iN A,(&D1) 
        DEC A
        JR Z,check_responce
    ret
;------------------------------------------------------------
print_msg:
    ld    a,(hl)
    or    a
    ret    z
    call    &bb5a
    inc    hl
    jr    print_msg
;------------------------------------------------------------
no_file:
    ld    hl,no_file_msg
    call    print_msg
    ret
;;------------------------------------------------------------------
error1:
    ld    hl,message1
    call    print_msg
    ret
;;------------------------------------------------------------------
usb_dis_err:
    ld    hl,dis_usb_message
    call    print_msg
    ret
;;------------------------------------------------------------------
;usb_cmd:
;    ld    a,&57
;    out    (c),a           
;    ld    a,&ab
;    out    (c),a
;    ret
;----------------------------------------------------------------------
upper_case:
    ld    a,(hl)
    cp 'a'                ; A-'a'  C=1 if A<'a'
    jr c, no_offset          ; if character < 'a' is not a lowercase
    cp 'z'+1              ; A-'z'+1 C=0 if A>'z' 
    jr nc, no_offset      ; if character > 'z' is not a lowercase
    sub 32                ; sub 32 to convert it to UPPER case
;    ld    (hl),a
no_offset:
    ret
;------------------------------
clear_buffer:
    inc    c                    ;clear buffer
    ld    a,1
    out    (c),a
    dec    c
    ret
;------------------------------

dis_usb_message:
    defb "USB Device Disabled",13,10,0

no_file_msg:
    defb    "Disk/Image not found,or error",13,10,0

message1:
    defb    "Error Loading Rom File!",13,0

;------------------------------
fetch:
    call    clear_buffer
    call    usb_cmd
    ld    a,&3a
    out    (c),a
    out    (c),e            ;number of bytes to be fetched
    xor    a
    out    (c),a
    call    check_responce
    in    a,(c)
    call    clear_buffer
    call    usb_cmd
    ld    a,&27
    out    (c),a           
    call    check_responce
    in    a,(c)
    jp    z,close_file
    call    check_responce
    ret

close_file:
    ld    e,a
    ld    bc,&7fc0
    out    (c),c
    ld    bc,&fbd0
    call    clear_buffer
    call    usb_cmd
    ld    a,&36
    out    (c),a   
    xor    a
    out    (c),a       
    ret

set_ram_config:
    ld    e,a
    and    3
    ld    d,a
    ld    a,e
    and    252        ;11111100
    add    a,a        ;double a
    add    a,196
    add    a,d        ;a has the Ram configuration byte for the requested Rom number
    ret

set_directory:

add_sub_dirs2:   
    ld    bc,&fbd9
    ld    a,1
    out    (c),a
    ld    a,&FB
        in    a,(&D3)
    cp    "/"       
    jp    nz,continue_usbcat2

add_sub_dirs:       
                ;Add sub dirs
    ld    bc,&fbd0
;    call    clear_buffer
    call    usb_cmd3   
    ld    a,&2f
    out    (c),a
   
    ld    a,&FB
        in    a,(&D6)
    CP    2
    jr    nz,dir_catname

    ld    a,"/"
    out    (c),a
       
dir_catname:
    ld    a,&FB
        in    a,(&D3)   
    cp    "/"
    jr    z,continue_subdir_loop
    or    a
    jr    z,continue_subdir_loop
    out    (c),a
    jr    dir_catname

continue_subdir_loop:
    ld    d,a
    call    usb_cmd2
    ld    a,&32
    call    usb_cmd4
    cp    &41
    jp    nz,no_file
    ld    a,d
    or    a
    jr    z,continue_usbcat
    jp    add_sub_dirs

continue_usbcat2:
    ld    d,"/"
    ret
continue_usbcat:
    ld    d,0
    ret

usb_cmd2:
    xor    a
    out    (c),a   
usb_cmd:
    inc    c            ;clear input buffer
    ld    a,1
    out    (c),a
    dec    c   
usb_cmd3:
    ld    a,&57
    out    (c),a           
    ld    a,&ab
    out    (c),a
    ret
;-----------------------------
usb_cmd4:
    out    (c),a
usb_cmd5:
    call    check_responce2
    in    a,(c)
    ret

check_responce2:   
        ld    a,&FB
        in    a,(&D1) 
        dec    a
        jr    z,check_responce2
    ret


rom_name:
    dw    0
rom_name_size:
    defb    0

GUNHED

Awesome! Thank's to your great hack of the code now we all can support this new card even more!  :) :) :)

BTW: Whats expected at 'name_Adr'?

For common usage however it could be nice to have something very simple just to copy 16 KB from RAM to ROM.
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

GUNHED

Well, the way I understand it is this:
To upload a 16 KB data block into an expansion ROM you do actually use expansion RAM, right?

That's done by this code I guess...


ld  e,a ;A (ROM number) shall be %0001 1111 = 0-31
and a,3  ;Mask %0000 0011
ld  d,a  ; D = %0000 00bb
ld  a,e
and a,252 ;Mask for A  %1111 1100
add a,a  ;double a to %??nn n000
add a,196 ;+ &C4    = %1100 0100 becomes %11nn n100
add a,d  ;A has the RAM configuration byte for the requested ROM number = %11nn n1bb

Hope this helps you all.  :)
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

ikonsgr

Quote from: GUNHED on 16:06, 22 September 22BTW: Whats expected at 'name_Adr'?
name_adr=&9001: number of chararacters of rom filename (e.g. for "amsdos.rom"=10)
&9002-: actual characters of rom filename.
You can also use predetermined rom filenames, by declaring:
name_adr:
  defb  10,"amsdos.rom"

instead of:
name_adr equ &9001
Quote from: GUNHED on 16:06, 22 September 22For common usage however it could be nice to have something very simple just to copy 16 KB from RAM to ROM.
I suppose loading roms (which actually are into 512k ram expansion) from  the 64k basic ram,would be much easier than from file. you can have the rom file into basic ram block 3 (&c000-&ffff), set ram configuration for having block 1 (&4000-&7fff) to be the desired 16k block of 512k external ram and you just copy from block3 to block1. Such routine could be as simple as this small code:
ld a,X ;X is rom number to be placed in 512k SRAM
call set_ram_config
ld b,&7f
out (c),a
ld hl,&c000
ld de,&4000
ld bc,&ffff
ldir
        ret

set_ram_config:
ld e,a
and 3
ld d,a
ld a,e
and 252 ;11111100
add a,a ;double a
add a,196
add a,d ;a has the Ram configuration byte for the requested Rom number
ret

Now, as i note in user's guide,you can also easily load specific roms, using this small basic code:

5 MEMORY &7FFF:LOAD"ROM.BIN",&8000   
10 a$="ROM_NAME.ROM":num=XX
20 GOSUB 200
40 end
200 POKE &9000,NUM:POKE &9001,LEN(A$)   
210 FOR I=1 TO LEN(A$):POKE &9001+I,ASC(MID$(A$,I,1)):NEXT I     
220 CALL &8000
230 RETURN

Number 'XX' can be 0-31 for 32X ROM mode, or 0-1 for Dual 256k/2X ROM mode.
Lines 10-20 can be repeated for as many roms you want to load.
And of course, "Rom.bin" is the binary produced by the assembly code shown before.

Powered by SMFPacks Menu Editor Mod