Some coding questions......

Area for discussing ST(E) clones

Moderators: Mug UK, Zorro 2, Greenious, spiny, Moderator Team

braincell1973
Retro freak
Retro freak
Posts: 14
Joined: Mon Jul 25, 2011 10:32 am

Some coding questions......

Postby braincell1973 » Thu Feb 16, 2017 8:57 am

Hello all,
I purchased a MIST board and im trying to learn verilog/vhdl in the hopes of contributing (someday) to the C64 core.

I am having a little trouble understanding the hand off between the FPGA and arm controller.

The config string consists of letters and number for example O2 = option 2 , T3 = toggle 3, fine i got that but what im having trouble with is the file loading in reference to the config string......

1st question, How does the file selection get passed to the fpga, Is the 1st selection index 0 then the 2nd OSD line index 1 ?
ex. LOAD *.PRG - index 0
LOAD *.D64 - index 1 ??????

If the above is true does inserting an item move the index positions ?
ex. LOAD *.PRG - index 0
LOAD *.CRT - index 1
LOAD *.D64 - index 2 ??????

does the options index increment from the next index available.

ex.LOAD *.PRG - index 0
LOAD *.CRT - index 1
LOAD *.D64 - index 2
RESET - T3 or is this T1 ?????

Any help greatly appreciated, Lee

Sorgelig
Captain Atari
Captain Atari
Posts: 452
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Some coding questions......

Postby Sorgelig » Thu Feb 16, 2017 1:03 pm

O2, T3 set exactly bit in status vector. It doesn't matter which line will be used. They will remain 2nd and 3rd bit as requested.
For file loading and mounting - it's position dependent. First LOAD line is index 1, second LOAD line is index 2 and so on. Other options aren't counting. So, second LOAD can be on line 5, but will have index 2.

If you want to add different extensions support, i suggest to combine them into single LOAD to save line in options (you have only 7 lines!). Newer firmwares support up to 4 extensions per LOAD (or MOUNT). Take a look at my ZX core to understand how multiple extensions are handled (look at bits status[7:6]).

braincell1973
Retro freak
Retro freak
Posts: 14
Joined: Mon Jul 25, 2011 10:32 am

Re: Some coding questions......

Postby braincell1973 » Thu Feb 16, 2017 1:42 pm

Ahhhhh, You *are* the man...

thank you , will check out the ZX code right now (im in my lunch break).

Im trying to rough out the address mapping at the moment assuming i can dump the *.CRT file at SDRAM address x020000, so hoping i can get something working over the next week or so.

working on the basis i can implement simple 8k and 16k carts first then extend to support bankswitching etc.

lee

braincell1973
Retro freak
Retro freak
Posts: 14
Joined: Mon Jul 25, 2011 10:32 am

Re: Some coding questions......

Postby braincell1973 » Thu Feb 16, 2017 8:39 pm

OK, So, After some more reading i can see whats happening (i think) the vhdl strips off the first 2 bytes during a *.PRG load to get the load address.

And 7 lines used on the OSD....... Facepalm.

Will have to give this some more thought :D

braincell1973
Retro freak
Retro freak
Posts: 14
Joined: Mon Jul 25, 2011 10:32 am

Re: Some coding questions......

Postby braincell1973 » Sat Feb 18, 2017 10:04 pm

Ok. So i managed to recompile the core with the first file option selecting prg.t64.crt.tap files.........

As the index 0 is the initial core name.rom upload...

My question is now ...... are the 4 options above now all index 1 now??

Prg and d64 work fine still after recompilation. Tomorrow im going to solder debug headers onto the mist board.

The running before walking prize this month goes too........... ME. For trying to :
inout reg [7:0] buffer_header [0:127]

Also...... does firmware oprion 0x56 return selected file size ??

Lee

Sorgelig
Captain Atari
Captain Atari
Posts: 452
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Some coding questions......

Postby Sorgelig » Sat Feb 18, 2017 11:15 pm

braincell1973 wrote:My question is now ...... are the 4 options above now all index 1 now??

As i've wrote above: look at status[7:6](or status(7 downto 6))

braincell1973
Retro freak
Retro freak
Posts: 14
Joined: Mon Jul 25, 2011 10:32 am

Re: Some coding questions......

Postby braincell1973 » Sun Feb 19, 2017 11:25 pm

Sorgelig wrote:
braincell1973 wrote:My question is now ...... are the 4 options above now all index 1 now??

As i've wrote above: look at status[7:6](or status(7 downto 6))


I think you mean bits 7 & 6 of the *index* byte..

I thought bit 6 of the staus was for reset.

I got some serial debug info out of the arm controller which was very helpful.

Is the file size transmitted before the file via spi 0x56?

Lee

Sorgelig
Captain Atari
Captain Atari
Posts: 452
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Some coding questions......

Postby Sorgelig » Mon Feb 20, 2017 10:40 pm

sorry, mistype.. Yes, it should be index[7:6]
File size is calculated by amount of bytes transferred.

braincell1973
Retro freak
Retro freak
Posts: 14
Joined: Mon Jul 25, 2011 10:32 am

Re: Some coding questions......

Postby braincell1973 » Tue Feb 21, 2017 9:02 am

Now i got that right im going to start working on the sdram write to allow a load address for prg and t64 .

Crt can go straight too 0x100000 . Will need to sort out address remapping on cart by cart basis

Tap files will go to 0x200000 ......

Now just have to find some time ;)

Lee

braincell1973
Retro freak
Retro freak
Posts: 14
Joined: Mon Jul 25, 2011 10:32 am

Re: Some coding questions......

Postby braincell1973 » Mon Feb 27, 2017 1:53 pm

OK.......After some hours on the mist this weekend i found this in the SDRAM.V ...


wire [12:0] reset_addr = (reset == 13)?13'b0010000000000:MODE;

wire [12:0] run_addr =
(q == STATE_CMD_START)?{ 5'b00000, addr[15:8]}:{ 5'b00100, addr[7:0]};

assign sd_addr = (reset != 0)?reset_addr:run_addr;

My questions are ?? does this .... { 5'b00000, addr[15:8]} = colunm ??
and does this .... { 5'b00100, addr[7:0]} = row ???

The datasheet is a bit cryptic but this ..

(q == STATE_CMD_START)?addr[20:8]:{ 4'b0010, addr[23], addr[7:0]};

is in the tutorial, would this change above allow 24bit sdram access ??

Any info appreciated, Lee

braincell1973
Retro freak
Retro freak
Posts: 14
Joined: Mon Jul 25, 2011 10:32 am

Re: Some coding questions......

Postby braincell1973 » Mon Feb 27, 2017 8:39 pm

OK, So changed this :----

wire [12:0] reset_addr = (reset == 13)?13'b0010000000000:MODE;

wire [12:0] run_addr =
// (q == STATE_CMD_START)?{ 5'b00000, addr[15:8]}:{ 5'b00100, addr[7:0]};
(q == STATE_CMD_START)?addr[20:8]:{ 4'b0010, addr[23], addr[7:0]};

assign sd_addr = (reset != 0)?reset_addr:run_addr;

//assign sd_ba = 2'b00;
assign sd_ba = addr[22:21];

and changed addr to [24:0]

hopefully this should mean i can use a lot more memory - do i have this correct ??

lee

Sorgelig
Captain Atari
Captain Atari
Posts: 452
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Some coding questions......

Postby Sorgelig » Mon Feb 27, 2017 11:40 pm

braincell1973 wrote:wire [12:0] run_addr =
(q == STATE_CMD_START)?{ 5'b00000, addr[15:8]}:{ 5'b00100, addr[7:0]};


res = condition ? choice_true : choice_false
this is pretty standard C style code. It's one-liner selector.

braincell1973
Retro freak
Retro freak
Posts: 14
Joined: Mon Jul 25, 2011 10:32 am

Re: Some coding questions......

Postby braincell1973 » Tue Feb 28, 2017 12:29 pm

Hi sorgelig.

Yes i understand the 1 line choice part perfectly my question was how the row/columns are selected on the sdram

Aa you can see above i have modified the code to allow more than 64k access.

My original question was......

My questions are ?? does this .... { 5'b00000, addr[15:8]} = colunm ??
and does this .... { 5'b00100, addr[7:0]} = row ???

The datasheet is a bit cryptic but this ..

Lee

Sorgelig
Captain Atari
Captain Atari
Posts: 452
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Some coding questions......

Postby Sorgelig » Tue Feb 28, 2017 8:31 pm

Yes, it's column/row selection. Actually SDRAM module is very simplified. I suggest to adapt my sram.sv module from ZX core. It supports whole SDRAM addressing.

braincell1973
Retro freak
Retro freak
Posts: 14
Joined: Mon Jul 25, 2011 10:32 am

Re: Some coding questions......

Postby braincell1973 » Fri Mar 10, 2017 2:04 pm

Hi,
After losing the whole of last weekend trying to get the crt support working im mostly sure its the SDRAM routine causing me probs.

I looked at Sorgeligs sdram routine but im not confident enough in adapting that for the C64 yet, So im going to try modifying the C16 core as its very close to the c64 core code.

Any tips in addressing more memory ????? IE over 64k. i did post my changes above but they are not working :(.

Lee

braincell1973
Retro freak
Retro freak
Posts: 14
Joined: Mon Jul 25, 2011 10:32 am

Re: Some coding questions......

Postby braincell1973 » Thu Mar 16, 2017 8:06 pm

Mods to the sdram were in fact fine. With some brute-forcing spaghetti code i got some 8k and 16k carts running :)

Long way to go yet :)

Lee

ericgus
Captain Atari
Captain Atari
Posts: 291
Joined: Fri Apr 08, 2016 4:53 am
Location: Boston MA - USA

Re: Some coding questions......

Postby ericgus » Fri Mar 17, 2017 3:24 am

braincell1973 wrote:Mods to the sdram were in fact fine. With some brute-forcing spaghetti code i got some 8k and 16k carts running :)

Long way to go yet :)

Lee


Thanks for plugging away at it.. I know a lot of people will be very happy..

User avatar
vebxenon
Captain Atari
Captain Atari
Posts: 386
Joined: Fri Apr 24, 2015 12:10 pm

Re: Some coding questions......

Postby vebxenon » Fri Mar 17, 2017 8:04 am

braincell1973 wrote:Mods to the sdram were in fact fine. With some brute-forcing spaghetti code i got some 8k and 16k carts running :)

Long way to go yet :)

Lee


Oh, good job! :cheers: Thanks for your hard work, it will be great to have carts on C=64 core :-) .


Social Media

     

Return to “ST(E) Clones (Suska / MiST)”

Who is online

Users browsing this forum: No registered users and 3 guests