Modern SAM Coupé development toolchain

Play it once, SAM. For old times' sake.
Post Reply
User avatar
flatduckrecords
Manic Miner
Posts: 785
Joined: Thu May 07, 2020 11:47 am
Location: Oban, Scotland
Contact:

Modern SAM Coupé development toolchain

Post by flatduckrecords »

Stefan wrote: Tue Jun 13, 2023 7:27 am For coding I currently use vscode + Ant + pyz80 + SimCoupe. I used to use Eclipse + Ant + pyz80 + SimCoupe. Before that, in the nineties, it was Comet + SAM Coupe (which I do not recommend using now).
I've recently started using Simon Owen's pyz80 extension for VS Code which provides a nice wrapper around pyz80 assembler as well as Simon's samdisk tool. It has a few handy keyboard shortcuts to (i) assemble the code, (ii) create a disk image and (iii) optionally send the assembled code to a real SAM via the Trinity ethernet adapter.

It provides Z80 syntax highlighting but it's not as fully featured as ASM Code Lens. VS Code can't use both at the same time, so I sometimes toggle back to that and use VS Code's built-in tasks to run the assembler:

Code: Select all

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
    {
      "label": "pyz80",
      "type": "shell",
      "command": "pyz80.py",    						
      "args": [
        "--obj=${fileBasenameNoExtension}.bin", // assembled binary (optional)
        "-o${fileBasenameNoExtension}.dsk",	// disk image name
        "--nozip",	// don't compress disk image
        "${file}"	// source file
      ],
      "group": {
        "kind": "build",
        "isDefault": true
      }
    }
    ]
}
@Stefan is that similar to how you're using Ant?
User avatar
Stefan
Manic Miner
Posts: 809
Joined: Mon Nov 13, 2017 9:51 pm
Location: Belgium
Contact:

Re: Modern SAM Coupé development toolchain

Post by Stefan »

flatduckrecords wrote: Tue Jun 13, 2023 11:13 am @Stefan is that similar to how you're using Ant?
Yes, you can find various build files in my github repos, see for example SAM MOD player, Leisure Suit Larry, samdos and E-Tracker player.

I started with Ant since that is nicely integrated in Eclipse, which I also use at work.
User avatar
g0blinish
Manic Miner
Posts: 286
Joined: Sun Jun 17, 2018 2:54 pm

Re: Modern SAM Coupé development toolchain

Post by g0blinish »

Recommend a utility that copies files to disk, not in Python
User avatar
flatduckrecords
Manic Miner
Posts: 785
Joined: Thu May 07, 2020 11:47 am
Location: Oban, Scotland
Contact:

Re: Modern SAM Coupé development toolchain

Post by flatduckrecords »

SCADM is good. (Works under Wine)

I use Greaseweazel to create actual disks (eDSK format, not MGT)
User avatar
g0blinish
Manic Miner
Posts: 286
Joined: Sun Jun 17, 2018 2:54 pm

Re: Modern SAM Coupé development toolchain

Post by g0blinish »

Not bad. Are there any cli utilities?
User avatar
Stefan
Manic Miner
Posts: 809
Joined: Mon Nov 13, 2017 9:51 pm
Location: Belgium
Contact:

Re: Modern SAM Coupé development toolchain

Post by Stefan »

g0blinish wrote: Tue Jun 13, 2023 6:21 pm Not bad. Are there any cli utilities?
There’s the SAM .dsk image manipulator at http://www.intensity.org.uk/samcoupe/download.php
User avatar
Spud
Manic Miner
Posts: 375
Joined: Sun Nov 12, 2017 8:50 pm
Contact:

Re: Modern SAM Coupé development toolchain

Post by Spud »

I'm glad you posted this, I will try to use TrinLoad in my tool set in the future. I had forgotten all about it :dance
User avatar
flatduckrecords
Manic Miner
Posts: 785
Joined: Thu May 07, 2020 11:47 am
Location: Oban, Scotland
Contact:

Re: Modern SAM Coupé development toolchain

Post by flatduckrecords »

Spud wrote: Tue Jun 13, 2023 10:44 pm I'm glad you posted this, I will try to use TrinLoad in my tool set in the future. I had forgotten all about it :dance
Yeah it’s really useful. It’s always nice to break out of the emulator and see your work on real hardware, I reckon. I was messing around with so-called “256x384” interlaced images recently, but it only works on certain TVs (and not in SimCoupé) so beaming it over to my telly was the best way to see/test it.

💾 TrinLoad (disk image download at the foot of the article).
User avatar
g0blinish
Manic Miner
Posts: 286
Joined: Sun Jun 17, 2018 2:54 pm

Re: Modern SAM Coupé development toolchain

Post by g0blinish »

Stefan wrote: Tue Jun 13, 2023 9:45 pm There’s the SAM .dsk image manipulator at http://www.intensity.org.uk/samcoupe/download.php
i mean - CLI

tested mgtman - https://github.com/dandoore/mgtman
it gives wrong result
User avatar
g0blinish
Manic Miner
Posts: 286
Joined: Sun Jun 17, 2018 2:54 pm

Re: Modern SAM Coupé development toolchain

Post by g0blinish »

User avatar
Stefan
Manic Miner
Posts: 809
Joined: Mon Nov 13, 2017 9:51 pm
Location: Belgium
Contact:

Re: Modern SAM Coupé development toolchain

Post by Stefan »

g0blinish wrote: Wed Jun 14, 2023 3:20 am i mean - CLI
Which is exactly what the Sam .dsk image manipulator does and which Dan's mgtman is a fork of...
User avatar
Stefan
Manic Miner
Posts: 809
Joined: Mon Nov 13, 2017 9:51 pm
Location: Belgium
Contact:

Re: Modern SAM Coupé development toolchain

Post by Stefan »

g0blinish wrote: Wed Jun 14, 2023 3:20 am tested mgtman - https://github.com/dandoore/mgtman
it gives wrong result
Thanks for opening an issue so that that can be fixed.
User avatar
g0blinish
Manic Miner
Posts: 286
Joined: Sun Jun 17, 2018 2:54 pm

Re: Modern SAM Coupé development toolchain

Post by g0blinish »

Stefan wrote: Wed Jun 14, 2023 6:19 am Which is exactly what the Sam .dsk image manipulator does and which Dan's mgtman is a fork of...
I used mgtman and got incorrect result: wrong type, start address, filesize. Maybe parameters incorrect?

code(sjasmplus)

Code: Select all

	device zxspectrum48
        ORG #8000
begin
;
; Print an ASCII Table with 96 Characters
;
print_test:			LD 		B,96				; We want 96 characters in our ASCII Tabe
				LD 		A,32				; 32 is the ASCII code for space

loop2:				LD		C,A				; Temp store for the A Register as it's zeroed by the RST 16 call below
				RST 		16				; Output A to current stream (Print the character in the A Register)
				LD		A,C				; Retrieve the A Register 
				ADD 		A,1				; Set for the next ASCII Character
				CP 		B				; Check if we've reached the last character
				JR 		NZ,loop2			; Keep looping until A=96
;
; Print a Text String
;
print_text:			LD 		HL,text2			; Set pointer to start of text 
				LD 		B,20				; Set up loop counter, 20 characters to print

print_loop:			LD 		A,(HL)				; Get character from pointer
				RST 		16				; Print character
				INC 		HL				; Move to next character
				DJNZ 		print_loop			; If we've not yet reach the last character, then loop
;
; Now we wait for the User to press a key
;
wait_for_key:			CALL		$0169				; Read the Keyboard (Zero if no key)
       				JR 		Z,wait_for_key  		; If no key pressed, then loop
										; A key was pressed....				
				RET						; Return back to BASIC
;
; Some Text Data
;
text2:				DM 		"Howsaboutis, then!!!"
end
	display /d,end-begin
	savebin "hlw.cde",begin,end-begin

parameters for mgtman:

Code: Select all

mgtman -w test.dsk hlw.cde 32768 32768
Result(incorrect filetype $DD not $13)

Image
User avatar
DanDoore
Drutt
Posts: 2
Joined: Wed Jun 14, 2023 11:44 am

Re: Modern SAM Coupé development toolchain

Post by DanDoore »

g0blinish wrote: Wed Jun 14, 2023 6:32 am
parameters for mgtman:

Code: Select all

mgtman -w test.dsk hlw.cde 32768 32768
Result(incorrect filetype $DD not $13)

Image
Whoops, broke that in a commit :(

Fix here:

https://github.com/dandoore/mgtman/releases


Dan.
User avatar
g0blinish
Manic Miner
Posts: 286
Joined: Sun Jun 17, 2018 2:54 pm

Re: Modern SAM Coupé development toolchain

Post by g0blinish »

DanDoore wrote: Wed Jun 14, 2023 11:49 am Whoops, broke that in a commit :(

Fix here:

https://github.com/dandoore/mgtman/releases


Dan.
I used -wc, is OK with message?
Image
User avatar
DanDoore
Drutt
Posts: 2
Joined: Wed Jun 14, 2023 11:44 am

Re: Modern SAM Coupé development toolchain

Post by DanDoore »

That message is just because the autoboot file isn't found so normal, do a DIR1 and you should see your file.

Note also that the first file on the disk needs to be a copy of SAMDOS2 (or another if you prefer) to allow it to boot properly (SimCoupé has a helper that means you don't need to) - there is a copy of that in the repo under 'Resources'.

Dan.
Post Reply