SAM Coupé

User avatar
pgimeno
Top Contributor
Posts: 669
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 246 times
Been thanked: 208 times

SAM Coupé

Unread post by pgimeno »

I can't seem to be able to press the colon key (:). The key where it's supposed to be located according to this image https://upload.wikimedia.org/wikipedia/ ... dow%29.jpg acts like a quote instead, and the key next to that does inverse video. Any idea how to get that key?
bellwood420
Core Developer
Posts: 48
Joined: Fri Dec 11, 2020 2:39 pm
Has thanked: 3 times
Been thanked: 32 times

Re: SAM Coupé

Unread post by bellwood420 »

To input colon (:),
Right shift + semi colon (;) key worked.
Left shift + semi colon (;) key didn't work.
I am using US keyboard.
lroby74
Posts: 111
Joined: Tue May 26, 2020 2:59 pm
Has thanked: 127 times
Been thanked: 15 times

Re: SAM Coupé

Unread post by lroby74 »

bellwood420 wrote: Sun May 16, 2021 2:17 pm To input colon (:),
Right shift + semi colon (;) key worked.
Left shift + semi colon (;) key didn't work.
I am using US keyboard.
From what i've just saw, left shift is for letters and symbols above numbers (first upper row) while right shift works on right keyboard's side (near Enter key) for those symbols..
User avatar
pgimeno
Top Contributor
Posts: 669
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 246 times
Been thanked: 208 times

Re: SAM Coupé

Unread post by pgimeno »

Here's a keyboard matrix test program. To use, insert the disk and type:

boot
load "kmatrix"

If you want a version that you can break with ESC, use 'load "kmatrixbrk"' instead of 'load "kmatrix"'.

There are some problems with the keyboard implementation of the core. Some key combinations (e.g. symbol + colon) can't be used, and for the colon itself, if you release the shift key before you release the colon key, the colon gets stuck. Other weird effects can result when pressing the wrong keys with the right and/or left shift keys, for example.

I would much prefer a direct positional key mapping: using this image as a reference, map the keys to the actual keyboard depending on the positions of the keys. For example, the host left ALT key would be the Sam CTRL, the host right ALT key would be the Sam EDIT, the host CTRL keys would be the Sam SYMBOL, the host '/' key would be the Sam INV, etc. I've implemented that layout in my local copy of SimCoupe and I wrote the key matrix program with it. It works great.
Attachments
kmatrix.zip
(8 KiB) Downloaded 222 times
azesmbog
Posts: 32
Joined: Thu Jun 11, 2020 7:00 am
Has thanked: 22 times
Been thanked: 25 times

Re: SAM Coupé

Unread post by azesmbog »

pgimeno wrote: Sat May 22, 2021 12:18 am
I would much prefer a direct positional key mapping: using this image as a reference, map the keys to the actual keyboard depending on the positions of the keys.
Two questions:
1. Can you make a program "kmatrix" in the form of a tap-file for loading from a tape recorder?
2. The layout of the keyboard in SimCoupe is quite satisfactory, can you be equal to it ??
User avatar
pgimeno
Top Contributor
Posts: 669
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 246 times
Been thanked: 208 times

Re: SAM Coupé

Unread post by pgimeno »

azesmbog wrote: Sat May 22, 2021 10:16 am Two questions:
1. Can you make a program "kmatrix" in the form of a tap-file for loading from a tape recorder?
2. The layout of the keyboard in SimCoupe is quite satisfactory, can you be equal to it ??
1. I don't know of any tool to do this. I also don't have any example SAM TAP file. If you can attach a SAM TAP file, I can probably do this conversion.
2. I don't know what you mean. The core is not mine. If you mean the layout of the screen of kmatrix, it is made to match the hardware matrix; see https://www.worldofsam.org/sites/defaul ... n_v1-0.pdf page 31.

Anyway, SimCoupé supports two layouts, one symbol-oriented and locale-dependent and one raw. I prefer raw, but true raw, where the keys are in the same positions as in a real Sam. That's not how it works in SimCoupé.
azesmbog
Posts: 32
Joined: Thu Jun 11, 2020 7:00 am
Has thanked: 22 times
Been thanked: 25 times

Re: SAM Coupé

Unread post by azesmbog »

In fact, the keyboard mapper is very simple, you can figure it out and arrange the necessary keys as you like :)
https://github.com/MiSTer-devel/SAM-Cou ... eyboard.sv
You need desire and a clear understanding of the goal. Everything.

I have a dozen tap files.
I do not know in what program they were made, but in SimCoupe they are loaded and work.
I can send an archive if there is a desire to figure it out.
I tried the .dsk version in SimCoupe, but I need the .tap version to try it :)
User avatar
pgimeno
Top Contributor
Posts: 669
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 246 times
Been thanked: 208 times

Re: SAM Coupé

Unread post by pgimeno »

azesmbog wrote: Sat May 22, 2021 1:39 pm You need desire and a clear understanding of the goal. Everything.
And an account with Intel, and the wish to run proprietary software, which leaves me out unfortunately.

I can try to post a modified version in the hope that someone is willing to compile it into an RBF file.

azesmbog wrote: Sat May 22, 2021 1:39 pm I have a dozen tap files.
I do not know in what program they were made, but in SimCoupe they are loaded and work.
I can send an archive if there is a desire to figure it out.
I just need one, preferably one that corresponds to a BASIC program. Even a tape with just a line that says 1 REM will suffice. My SimCoupe is old and crashes every time I close the menu, so I don't even know if I can generate TAP files with it.

azesmbog wrote: Sat May 22, 2021 1:39 pm I tried the .dsk version in SimCoupe, but I need the .tap version to try it :)
Not sure what you mean, but you can run the DSK in the MiSTer too. Or do you mean in a real machine? You can dump the DSK to a physical floppy as well.

Edit: The attached loads in FUSE in 48K mode (but it obviously fails to run). See if it works in SimCoupé.
Attachments
kmat.tap.zip
(811 Bytes) Downloaded 212 times
azesmbog
Posts: 32
Joined: Thu Jun 11, 2020 7:00 am
Has thanked: 22 times
Been thanked: 25 times

Re: SAM Coupé

Unread post by azesmbog »

Not.
It does not work in SimCoupe.
I am attaching several files. I have not tested all of them, but they should work under SamKoupe.
Inside any tap, only data files
https://drive.google.com/file/d/1UFYUHV ... sp=sharing

rbf file will not make it difficult for me to compile, only I need to accurately and clearly understand which key from the samkoupe to transfer to which key on the PC keyboard.
User avatar
pgimeno
Top Contributor
Posts: 669
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 246 times
Been thanked: 208 times

Re: SAM Coupé

Unread post by pgimeno »

Thanks. Here's a TAP that I think will work.

It's the breakable version. If you want the non-breakable version, edit line 590 to remove the REM.
Attachments
kmatrixbrk.tap.zip
(890 Bytes) Downloaded 195 times
azesmbog
Posts: 32
Joined: Thu Jun 11, 2020 7:00 am
Has thanked: 22 times
Been thanked: 25 times

Re: SAM Coupé

Unread post by azesmbog »

pgimeno wrote: Sat May 22, 2021 7:09 pm Here's a TAP that I think will work.
Excellent!!
This version is downloaded from SimCoupe.
But it doesn't load on my board yet, while I'm dealing with the line-in.

And a passing question - is the tap version not too difficult to do ??
otherwise I wrote one utility a long time ago, in the .dsk version it works fine, but I would like to try the tap version as well.
The utility is completely in codes, without a BASIC file

fixed the ear
hJV6q.jpg
hJV6q.jpg (33.43 KiB) Viewed 16895 times
I have a slightly different layout:
"," + ":"
"." + ";"
User avatar
pgimeno
Top Contributor
Posts: 669
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 246 times
Been thanked: 208 times

Re: SAM Coupé

Unread post by pgimeno »

azesmbog wrote: Sat May 22, 2021 3:17 pm rbf file will not make it difficult for me to compile, only I need to accurately and clearly understand which key from the samkoupe to transfer to which key on the PC keyboard.
Okay, this is my first time modifying a Verilog file, so I may have done something wrong, but here we go.
keyboard.sv.zip
(3.12 KiB) Downloaded 206 times
The only keys with special treatment are / and * in the numeric keypad, which generate Shift - and Shift + respectively. The rest are raw Sam keys, so the labels in the host keyboard do not always correspond to their Sam equivalent.

The target layout is this:
Coupé.png
Coupé.png (21.67 KiB) Viewed 16898 times
Compare to the original:
https://upload.wikimedia.org/wikipedia/ ... dow%29.jpg

The idea is to give a feeling that you're in front of a real Sam Coupé keyboard, and also that all keys and key combinations are usable.

I don't know if I've read the file correctly, but it seems to me that the auto-start is broken because F9 stays active for just 1 clock pulse. That seems like it could be improved.

azesmbog wrote: Sat May 22, 2021 9:37 pm And a passing question - is the tap version not too difficult to do ??
It's complicated. The header bytes are not in the same positions in the disk compared to the tape as I initially thought (based on the technical reference manual). I had to go through many hoops to make this version, compiling a more recent version of SimCoupe inside a virtual machine, and using the debugger to disassemble the save routines and place a breakpoint while it was saving.
azesmbog
Posts: 32
Joined: Thu Jun 11, 2020 7:00 am
Has thanked: 22 times
Been thanked: 25 times

Re: SAM Coupé

Unread post by azesmbog »

pgimeno wrote: Sun May 23, 2021 1:05 am Okay, this is my first time modifying a Verilog file, so I may have done something wrong, but here we go.
Whaaaah !! Woooooow !!!
I am impressed!!
I can't do that :))) I can change it a little bit, compile it every time and see what happens. Sequential Approximation Method.
I think with such skills you should definitely install Quartus for yourself.
In general, this is what compiled with your file. Try it. Of course, I can also check, but it's a little more difficult for me, my MiSter is a little "sick" :)
https://drive.google.com/drive/folders/ ... sp=sharing
User avatar
ron
Posts: 159
Joined: Sun May 24, 2020 7:02 pm
Has thanked: 67 times
Been thanked: 58 times

Re: SAM Coupé

Unread post by ron »

I have the impression that the SamCoupé's core is not handling write protection lines. Floppy disks would have to be activated using ioreq and the address bus. I meant ports 223 to 231 for FloppyDisc #1 and from 240 to 247 for FloppyDisc #2.

Using it as a normal SamCoupé (SamDOS) seems to work but when loading ProDOS (CP/M) fails thunderously. Sam core is not using the right disk controller for each unit.

The SamCoupé could support two 3.5” Ultraslim Citizen Double Density drives each with their own WD-1770-02 disc controller board allowing both drives to operate independently.
Unformatted capacity 1Mbyte, when formatted with Samdos as double sided, 80 track per side, 10 sectors per track, to the IBM 3740 standard gives 800kB with 776kB usable after directory space and next sector data is subtracted.

MiSTer core uses: https://github.com/MiSTer-devel/SAM-Cou ... /wd1793.sv

If you try to load ProDOS in versions 1.9 or 2.0, the reading of the disks fails and nothing can be done.
By modifying the write protect on the core and the disk selection by port, with ProDOS1.9 you can start WordStar correctly. With the new version of ProDOS (2) it keeps crashing.

I think so Disc selection is made by ASIC and what I see is a Spectrum ULA on steroids.

In the ZXUno FPGA release, there's an ASIC now implemented: https://github.com/zxdos/zxuno/blob/mas ... upe/asic.v

This is all the ASIC on MISTer core:

Code: Select all

reg [7:0] asic_dout;
always_comb begin
  casex({kbdr_sel, stat_sel, lmpr_sel, hmpr_sel, vid_sel, fdd_sel, kjoy_sel, lptd_sel | lpts_sel})
    'b1XXXXXXX: asic_dout = {soff, ~tape_in, 1'b0, hid_data};
    'b01XXXXXX: asic_dout = {key_data[7:5], ~INT_midi, ~INT_frame, 2'b11, ~INT_line};
    'b001XXXXX: asic_dout = lmpr;
    'b0001XXXX: asic_dout = hmpr;
    'b00001XXX: asic_dout = vid_dout;
    'b000001XX: asic_dout = fdd1_sel ? fdd1_dout : fdd2_dout;
    'b0000001X: asic_dout = {2'b00, joystick_0[5:0] | joystick_1[5:0]};
    'b00000001: asic_dout = 0; // fake LPT port.
    'b00000000: asic_dout = 8'hFF;
  endcase
end
Having a look on this line:

Code: Select all

'b000001XX: asic_dout = fdd1_sel ? fdd1_dout : fdd2_dout;
You will see that the ASIC always returns everything (whatever floppy drive it is) without indicating which disk it comes from. The SamCoupé does this by raising two lines in the ASIC, one as disc 1 and the other as disc 2. Using normal Sam disks it seems to work, but not with those that use CP / M format. By its own management, the data is mixed in each poll.

Regards
azesmbog
Posts: 32
Joined: Thu Jun 11, 2020 7:00 am
Has thanked: 22 times
Been thanked: 25 times

Re: SAM Coupé

Unread post by azesmbog »

The original Sam Coupe project was written by mcleod_ideafix, but no disk drives.
Sorgelig has already added disk devices to the project.
I think if you provide disks for testing - he will take time to deal with the wrong work :)
User avatar
ron
Posts: 159
Joined: Sun May 24, 2020 7:02 pm
Has thanked: 67 times
Been thanked: 58 times

Re: SAM Coupé

Unread post by ron »

Hi, here are disc images.
cpmsam.tar.gz
(1.31 MiB) Downloaded 272 times
Thanks very much.
User avatar
pgimeno
Top Contributor
Posts: 669
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 246 times
Been thanked: 208 times

Re: SAM Coupé

Unread post by pgimeno »

azesmbog wrote: Sun May 23, 2021 8:09 am In general, this is what compiled with your file. Try it. Of course, I can also check, but it's a little more difficult for me, my MiSter is a little "sick" :)
https://drive.google.com/drive/folders/ ... sp=sharing
I hope it gets well soon :)

Thank you very much for the compiled version. Indeed I made something wrong, and I think I know what it is. I think it's because registers are only loaded when ps2_key[10] changes. This doesn't work so well for keys that come from multiple registers. The attached should fix it. These keys will have a one clock cycle delay but I think that's acceptable.

Edit: Fixed another problem with the + and - keys in the keypad.
Attachments
keyboard.sv.zip
(3.12 KiB) Downloaded 197 times
azesmbog
Posts: 32
Joined: Thu Jun 11, 2020 7:00 am
Has thanked: 22 times
Been thanked: 25 times

Re: SAM Coupé

Unread post by azesmbog »

https://drive.google.com/drive/folders/ ... sp=sharing
at the same address second attempt
upd
a few minutes and there will be a third.
updated
third attempt in the same place
User avatar
pgimeno
Top Contributor
Posts: 669
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 246 times
Been thanked: 208 times

Re: SAM Coupé

Unread post by pgimeno »

Thanks, that one works great!.

Any chance you can add it as an attachment (as zip) instead of using Google Drive?

What is tld_sam.bit?
azesmbog
Posts: 32
Joined: Thu Jun 11, 2020 7:00 am
Has thanked: 22 times
Been thanked: 25 times

Re: SAM Coupé

Unread post by azesmbog »

pgimeno wrote: Sun May 23, 2021 12:43 pm What is tld_sam.bit?
This is a bitstream for another devboard, just for which the tap-file was made.
By the way, can you help me make a tap-file from my binary file on the .dsk disk? I would be useful for checking :)
SAMCoupe_3.zip
(1.02 MiB) Downloaded 232 times
User avatar
pgimeno
Top Contributor
Posts: 669
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 246 times
Been thanked: 208 times

Re: SAM Coupé

Unread post by pgimeno »

Thanks a lot! If I can get the dsk. sure, I can try.
azesmbog
Posts: 32
Joined: Thu Jun 11, 2020 7:00 am
Has thanked: 22 times
Been thanked: 25 times

Re: SAM Coupé

Unread post by azesmbog »

pgimeno wrote: Sun May 23, 2021 12:52 pm If I can get the dsk. sure, I can try.
saa1099test.zip
(218.8 KiB) Downloaded 241 times

everything is very simple there
the bit file is loaded from address 32768 and started from there.
Made in Spectrum mode - I haven't learned anything else :)
User avatar
pgimeno
Top Contributor
Posts: 669
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 246 times
Been thanked: 208 times

Re: SAM Coupé

Unread post by pgimeno »

Here you go.
Attachments
testsaa.tap.zip
(9 KiB) Downloaded 186 times
azesmbog
Posts: 32
Joined: Thu Jun 11, 2020 7:00 am
Has thanked: 22 times
Been thanked: 25 times

Re: SAM Coupé

Unread post by azesmbog »

pgimeno wrote: Sun May 23, 2021 2:49 pmHere you go.
No, the first attempt is unsuccessful.
I tried it in two emulators and on my devboard.
On the devboard, it seems like the code block is loaded, the stripes go along the border, but when the download is complete, nothing happens. Waiting for loading further.
Maybe you need a simple one-line BASIC bootloader for the code block?
randomize usr 32768 ?
User avatar
pgimeno
Top Contributor
Posts: 669
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 246 times
Been thanked: 208 times

Re: SAM Coupé

Unread post by pgimeno »

Edit: Sent in PM
azesmbog
Posts: 32
Joined: Thu Jun 11, 2020 7:00 am
Has thanked: 22 times
Been thanked: 25 times

Re: SAM Coupé

Unread post by azesmbog »

Understood.
Works.
Thank you !!!
User avatar
Moondandy
Top Contributor
Posts: 535
Joined: Mon May 25, 2020 2:14 am
Location: Edinburgh, Scotland
Has thanked: 32 times
Been thanked: 97 times

Re: SAM Coupé

Unread post by Moondandy »

I popped in a feature request ticket for adding RTC support into the core, for visibility if a developer is looking to update the core:

https://github.com/MiSTer-devel/SAM-Cou ... r/issues/1

The original SAM Coupés have been given RTC support via an add on:

https://www.worldofsam.org/products/sambus

There is also the Dallas clock https://www.worldofsam.org/products/dallas-clock (this link includes schematics)
User avatar
pgimeno
Top Contributor
Posts: 669
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 246 times
Been thanked: 208 times

Re: SAM Coupé

Unread post by pgimeno »

Here's the SAM Coupé core with the patch to use a keyboard layout similar to the original, rebased on top of latest version.

Edit: The source code of the modifications is the same as the one upthread (this one); the same patch is just applied to the latest version. I hope that suffices for GPL compliance.
Attachments
SAMCoupe-kb_20220426.rbf
(2.71 MiB) Downloaded 144 times
User avatar
ron
Posts: 159
Joined: Sun May 24, 2020 7:02 pm
Has thanked: 67 times
Been thanked: 58 times

Re: SAM Coupé

Unread post by ron »

samdskcpm.jpg
samdskcpm.jpg (84.63 KiB) Viewed 9066 times
Some CP/M dsk images began to work !
It's nice !!
User avatar
pgimeno
Top Contributor
Posts: 669
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 246 times
Been thanked: 208 times

Re: SAM Coupé

Unread post by pgimeno »

That was probably pure chance, I didn't do anything to fix it, but if there are timing critical sections, just a recompilation may have made the trick due to the randomness in the compiler. I've just implemented a keyboard patch, that's all.
Post Reply