Page 1 of 3

use OSDK under Linux ?

Posted: Wed Sep 09, 2020 4:08 pm
by goyo
Hi,

I would like to use OSDK on Linux. Is it possible ? Is there a turorial about this ?

May I compile Oricutron and XA compiler ? with which compiler cc , gcc, g++ ? :shock:

Re: use OSDK under Linux ?

Posted: Wed Sep 09, 2020 5:57 pm
by Dbug
It does compile on Linux, thanks to mmu_man and Jylam, maybe you could ask on the osdn.net forum, see if we can have all the information there (they are both on the project list, so they should see the message):

https://osdn.net/projects/oricsdk/forums/

Re: use OSDK under Linux ?

Posted: Wed Sep 09, 2020 6:28 pm
by Chema
I think you should use wine, but some other user (who?) was porting it, not without difficulty.

EDIT: crossed posting with Dbug. His answer is better.

Re: use OSDK under Linux ?

Posted: Wed Sep 09, 2020 6:45 pm
by goyo
Thanks to you two :)

Re: use OSDK under Linux ?

Posted: Fri Sep 11, 2020 8:39 pm
by mmu_man
Yeah it should compile but I don't think I wrote the install rules to have it installed properly somewhere. Also most examples are using batch files so you'd have to add proper makefiles (I did write a template that even extracted the infos from the .bat though).
I'll have to look at it again.

Re: use OSDK under Linux ?

Posted: Tue May 25, 2021 10:38 am
by xahmol
Any update on this?
I am looking to move all my retro build chains (next to the Oric, also Commodore, ZX Spectrum and TI-99/4a targets) to the fullest extent possible to Linux (Ubuntu) on a dedicated Linux PC.

Now use mostly Windows Subsystems for Linux (with Ubuntu), with for the Oric now a hybrid build chain with CC65 under WSL and OSDK under Windows, which is not ideal.
And generally now more and more like to develop using Linux over Windows, especially as keeping build chains up to date directly from the latest sources is much more convenient using Linux (the C complier for the TI is only available in a Linux version, and both CC65 and Z88Dk are much easier to compile from latest source on Linux. Also for Oricutron, compiling for Linux seems easier from the repo than setting up a Windows build environment to compile from source).

Re: use OSDK under Linux ?

Posted: Tue May 25, 2021 4:09 pm
by xahmol
See meanwhile that the repo at https://osdn.net/projects/oricsdk/scm/s ... osdk/main/ does include Makefiles.

So will try to build using them after I succeeded in setting up my Linux PC.

Re: use OSDK under Linux ?

Posted: Thu May 27, 2021 10:15 am
by xahmol
Question (and sorry to be a Linux n00b):
If I try to build using the makefile under Linux, first thing I encounter is that it includes a rules.mk which seem not to be included. What should be the content of that file?

And would the absence of that file why I, after commenting out this include for rules.mk, get errors for two header files missing:
- debug.c: for this commenting out seems to work fine
- direct.h: apparently a Microsoft C lib if I google, but replacing with unistd.h (as suggested on most Google answers) still gives missing fuctions.

So not able to build in Linux yet, If somebody can give me some pointers, appreciated!

Re: use OSDK under Linux ?

Posted: Thu May 27, 2021 2:54 pm
by iss
xahmol wrote: Thu May 27, 2021 10:15 am So not able to build in Linux yet, If somebody can give me some pointers, appreciated!
EDIT: Well, here we go:
1. Create a working directory in your home (for instance OSDK-build) and cd to it:

Code: Select all

mkdir ~/OSDK-build
cd ~/OSDK-build
2. Download attached bash script and extract it to ~/OSDK-build. Make it executable and execute it:

Code: Select all

$ chmod +x doit-osdk.sh
$ ./doit-osdk.sh
3. As result you should nave:

Code: Select all

DONE! Your OSDK for Linux is in: ~/OSDK-build/pc/tools/osdk/main/osdk-linux/
Probably you will need the development package of freeimage for pictconv.
This is for Fedora, for your distribution install it with your package manager.

Code: Select all

$dnf install freeimage freeimage-devel
Package freeimage-3.18.0-7.fc32.x86_64 is already installed.
Package freeimage-devel-3.18.0-7.fc32.x86_64 is already installed.
That's all! Try it and post some feedback ;).

Re: use OSDK under Linux ?

Posted: Thu May 27, 2021 6:16 pm
by xahmol
Thank you so much, Iss!
Works perfectly. Now have the OSDK tools working under Ubuntu.

Re: use OSDK under Linux ?

Posted: Thu May 27, 2021 6:36 pm
by iss
I'm very glad to help!
Now It's up to you what to use for your projects: bash-scripts, makefiles, cmake ... etc or even code::blocks or vscode as replacement of the MSDOS batch files :). I've made a Makefile-based project management system and we (with @rax) are using it for our projects.

Re: use OSDK under Linux ?

Posted: Thu May 27, 2021 7:03 pm
by xahmol
I am certainly going to use make, as I use that already on my TI, Commodore and Spectrum projects. Like the flexibility of make, but your project management system probably is way more advanced ;-)
Actually was already using a makefile for my Ludo game to build the binaries from source under WSL, just used a Windows batch file afterwards to build the .DSK from the generated .TAP files.

Re: use OSDK under Linux ?

Posted: Sat May 29, 2021 11:14 pm
by xahmol
Update:
Now have my Oric build chain fully converted to Linux (Ubuntu):
- CC65 compiled for Linux
- OSDK compiled for Linux
- Oricutron compiled for Linux
- and even the HxC software tools compiled for Linux, including a command line version to include in my Makefile.

To investigate:
- OricExplorer should be able to compile for Linux using Mono, but as I am completely new to .Net that for me is still a somewhat daunting endeavour. Anybody hacing experience with compiling Oric Explorer for Linux?

So now use this makefile to build binaries, DSK file and convert to HFE automatically in one go:

Code: Select all

OSDK = /home/xahmol/OSDK-build/pc/tools/osdk/main/osdk-linux/bin/
YM2MYM = $(OSDK)Ym2Mym -h1 -m8192
HXCFE = /home/xahmol/retro/oric/hxcfloppyemu-code/HxCFloppyEmulator/HxCFloppyEmulator_cmdline/trunk/build/
WORKDIR = $(shell pwd)

SOURCES = src/main.c
LIBOBJECTS = include/libsedoric-ca65.s include/MYM.s include/ijkdriver-ca65.s

TESTSOURCES = src/savetest.c
TESTOBJECTS = include/libsedoric-ca65.s

DISK = BUILD/LUDO.dsk
PROGRAM = BUILD/LUDOMAIN.bin
TESTPROG = BUILD/SAVETEST.bin

CC65_TARGET = atmos
CC = cl65
CFLAGS  = -t $(CC65_TARGET) --create-dep $(<:.c=.d) -Oirs -I include
LDFLAGS = -t $(CC65_TARGET) -m $(PROGRAM).map
LDFLAGSTEST = -t $(CC65_TARGET) -m $(TESTPROG).map

########################################

.SUFFIXES:
.PHONY: all clean
all: $(PROGRAM) $(TESTPROG) $(DISK)

ifneq ($(MAKECMDGOALS),clean)
-include $(SOURCES:.c=.d) $(SOURCESUPD:.c=.d)
endif

%.o: %.c
	$(CC) -c $(CFLAGS) -o $@ $<
  
$(PROGRAM): $(SOURCES:.c=.o)
	$(CC) $(LDFLAGS) -o $@ $^ $(LIBOBJECTS)

$(TESTPROG): $(TESTSOURCES:.c=.o)
	$(CC) $(LDFLAGSTEST) -o $@ $^ $(TESTOBJECTS)

$(DISK): $(PROGRAM) $(TESTPROG)
	$(OSDK)header $(PROGRAM) BUILD/LUDOMAIN.tap 0x0501
	$(OSDK)header $(TESTPROG) BUILD/SAVETEST.tap 0x0501
	$(OSDK)header data/LUDODATA.bin BUILD/LUDODATA.tap 0xb000
	$(YM2MYM) "music/R-Type  2 - level 1.ym" BUILD/R-Type.tap		0x7e00 "LUDOMUS1"
	$(YM2MYM) "music/Wizball 1.ym" BUILD/Wizzball.tap               0x7e00 "LUDOMUS2"
	$(YM2MYM) "music/Defender of the Crown 1.ym" BUILD/Defender.tap 0x7e00 "LUDOMUS3"
	$(OSDK)tap2dsk -iCLS:LUDOMAIN -c20:3 -nLUDO BUILD/LUDOMAIN.tap BUILD/SAVETEST.tap screen/LUDOTITL.tap screen/LUDOSCRM.tap BUILD/LUDODATA.tap BUILD/R-Type.tap BUILD/Defender.tap BUILD/Wizzball.tap $(DISK)
	$(OSDK)old2mfm $(DISK)
	cd $(HXCFE); hxcfe -finput:"$(WORKDIR)/$(DISK)" -foutput:"$(WORKDIR)/BUILD/LUDO.hfe" -conv:HXC_HFE

clean:
	$(RM) $(SOURCES:.c=.o) $(SOURCES:.c=.d) $(TESTSOURCES:.c=.o) $(TESTSOURCES:.c=.d) $(PROGRAM) $(PROGRAM).map $(TESTPROG) $(TESTPROG).map
	
I am pretty sure this Makefile can be further optimised, but it works!
Schermafdruk van 2021-05-30 00-09-25.png

Re: use OSDK under Linux ?

Posted: Sun May 30, 2021 12:42 pm
by Dbug
Well done :)

Re: use OSDK under Linux ?

Posted: Sun May 30, 2021 1:10 pm
by Chema
Indeed! :)