Sign in Join
Wiki copytemporary

Human 68k: what changed

Revision 2 to 3. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
1-The Human 68k port is an experimental [[m68k]] target, mainly aimed at retro computer enthusiasts. It targets the Sharp X68000 line of computers, that existed from the mid-80s to the mid-90s as a Japanese-only home computer and gaming console, and their operating system, the MS-DOS-alike Human 68k by Hudson Soft. The initial version of the Human 68k port was implemented by Karoly Balogh.
1+The Human 68k port is an experimental [[m68k]] target, mainly aimed at retro computer enthusiasts. It targets the Sharp X68000 line of computers, that existed from the mid-80s to the mid-90s as a Japanese-only home computer and gaming console, and their operating system, the MS-DOS-alike Human 68k by Hudson Soft. The initial version of the Human 68k port was implemented by [Karoly Balogh](</User:Chain-Q> "User:Chain-Q").
22
33# Status
44
5-This port is currently a cross-compiler only target. This is mostly due to hardware limitations of the original unexpanded platform.
5+This port is currently a cross-compiler only target. This is mostly due to hardware limitations of the original unexpanded platform.
66
77# Requirements
88
9-The compiled binaries - depending on the size - should be able to run on any Sharp X68000. Memory expansion for more complex programs is highly recommended.
9+The compiled binaries - depending on the size - should be able to run on any Sharp X68000. Memory expansion for more complex programs is highly recommended.
1010
1111# Identification
1212
13-To identify the Human 68k target compile-time, use **{\$IFDEF HUMAN68K}**.
13+To identify the Human 68k target compile-time, use **{$IFDEF HUMAN68K}**.
1414
1515# SysCalls
1616
17-Free Pascal supports generating Human 68k style system calls. Inline assembly code is not needed to call a system function. The syntax to declare Human 68k-style system calls is the following:
18-
19-``` pascal
17+Free Pascal supports generating Human 68k style system calls. Inline assembly code is not needed to call a system function. The syntax to declare Human 68k-style system calls is the following:
18+```
2019function h68kdos_write(fileno: word; buffer: pointer; len: longint): longint; syscall $ff40;
2120```
2221
23-Note the syscall modifier in the function declaration. The argument to the syscall modifier is the DOS function number to call. All syscall parameters are passed on the stack in right-to-left order, and they're word (2 byte) aligned. For further examples, see *rtl/human68k/h68kdos.inc* in the RTL source.
22+Note the syscall modifier in the function declaration. The argument to the syscall modifier is the DOS function number to call. All syscall parameters are passed on the stack in right-to-left order, and they're word (2 byte) aligned. For further examples, see _rtl/human68k/h68kdos.inc_ in the RTL source.
2423
24+
25+
2526# Defaults
2627
27-This section documents several compiler default settings, which are specific to the Human 68k target. Settings not documented here are usually the default for the m68k CPU architecture.
28+This section documents several compiler default settings, which are specific to the Human 68k target. Settings not documented here are usually the default for the m68k CPU architecture.
2829
2930## CPU
3031
31-The default CPU target for the Human 68k target is the 68000. This is different from most other [[m68k]] targets where the default is the 68020. SoftFPU is enabled by default.
32+The default CPU target for the Human 68k target is the 68000. This is different from most other [[m68k]] targets where the default is the 68020. SoftFPU is enabled by default.
3233
3334## Alignment
3435
35-Record elements are aligned to WORD (2 bytes) by default. Use the **{\$PACKRECORDS n}** compiler directive, if you want to change the default aligment. For byte aligned records, a packed record is also possible. Free Pascal also has support for the 68000 [[m68k|special alignment requirements]].
36+Record elements are aligned to WORD (2 bytes) by default. Use the **{$PACKRECORDS n}** compiler directive, if you want to change the default aligment. For byte aligned records, a packed record is also possible. Free Pascal also has support for the 68000 [[m68k|special alignment requirements]].
3637
3738## Stack
3839
39-The default stack size is set to 16 KiB, which is quite small for a complex Pascal program. For more complex programs you'll probably need to increase it. To change the stack size, use the **{SMEMORY \<stacksize\>,\<heapsize\>}** directive, or the **-Cs** command line argument. See the details in the documentation.
40+The default stack size is set to 16 KiB, which is quite small for a complex Pascal program. For more complex programs you'll probably need to increase it. To change the stack size, use the **{SMEMORY <stacksize>,<heapsize>}** directive, or the **-Cs** command line argument. See the details in the documentation.
4041
42+
43+
4144# External Dependencies
4245
43-The Human 68k port depends on **vasm** and **vlink**, as external assembler and linker.
46+The Human 68k port depends on **vasm** and **vlink** , as external assembler and linker.
4447
4548## Assembler
4649
47-The only supported assembler for the Human 68k port is **vasm**, which is also the default. The Human 68k port uses **ELF** as the default object format. This means using **vasm** also requires **vlink** as linker. **vasm** is open source, and it is available [here](http://sun.hasenbraten.de/vasm). Only **vasm** versions 1.9f and newer were tested with the Human 68k port, older versions might not work.
50+The only supported assembler for the Human 68k port is **vasm** , which is also the default. The Human 68k port uses **ELF** as the default object format. This means using **vasm** also requires **vlink** as linker. **vasm** is open source, and it is available [here](<http://sun.hasenbraten.de/vasm>). Only **vasm** versions 1.9f and newer were tested with the Human 68k port, older versions might not work.
4851
4952### Building vasm
5053
51-Note that **vasm** for [[m68k]] needs to be built with the *standard* syntax module to work with Free Pascal. This is not the default, as most programmers and compilers prefer the *Motorola* syntax module. A **vasm** version with the *standard* syntax module can be built with the following command, issued in the root of the **vasm** source tree:
52-
53-``` bash
54- make CPU=m68k SYNTAX=std
54+Note that **vasm** for [[m68k]] needs to be built with the _standard_ syntax module to work with Free Pascal. This is not the default, as most programmers and compilers prefer the _Motorola_ syntax module. A **vasm** version with the _standard_ syntax module can be built with the following command, issued in the root of the **vasm** source tree:
5555```
56+make CPU=m68k SYNTAX=std
57+```
5658
57-The resulting *vasmm68k_std* executable file is the assembler Free Pascal needs.
59+The resulting _vasmm68k_std_ executable file is the assembler Free Pascal needs.
5860
5961## Linker
6062
61-The Human 68k port defaults to **vlink** by Frank Wille as the default linker, which is the only supported linker for this target. **vlink** is open source, and it is available [here](http://sun.hasenbraten.de/vlink).
63+The Human 68k port defaults to **vlink** by Frank Wille as the default linker, which is the only supported linker for this target. **vlink** is open source, and it is available [here](<http://sun.hasenbraten.de/vlink>).
6264
63-Please make sure you use **vlink** version 0.17a or newer. Earlier versions were never tested.
65+Please make sure you use **vlink** version 0.17a or newer. Earlier versions were never tested.
6466
6567## Licensing
6668
67-Please note that the license of **vasm** and **vlink** does not allow development of commercial applications. If you plan to develop and sell a commercial application using these tools, you need their author's written consent. Please see the documentation of [vasm](http://sun.hasenbraten.de/vasm/release/vasm.html) and [vlink](http://sun.hasenbraten.de/vlink/release/vlink.pdf) for details.
69+Please note that the license of **vasm** and **vlink** does not allow development of commercial applications. If you plan to develop and sell a commercial application using these tools, you need their author's written consent. Please see the documentation of [vasm](<http://sun.hasenbraten.de/vasm/release/vasm.html>) and [vlink](<http://sun.hasenbraten.de/vlink/release/vlink.pdf>) for details.
6870
71+
72+
6973# Cross compiling
7074
7175## Dependencies
7276
73-Free Pascal needs **vlink** and **vasm** for the Human 68k target. Using GNU binutils is not supported for now. To get vlink and vasm built, see the relevant sections above.
77+Free Pascal needs **vlink** and **vasm** for the Human 68k target. Using GNU binutils is not supported for now. To get vlink and vasm built, see the relevant sections above.
7478
7579## Building
7680
77-To build a Human 68k cross-compiler, use the following steps:
81+To build a Human 68k cross-compiler, use the following steps:
7882
79-1. Install the latest stable FPC version, at the time of the writing of this article this is FPC 3.2.2. This will be used as the startup compiler.
80-2. Clone the FPC git repository.
81-3. Make sure you have vlink and vasm in the path
82-4. Go to the repository's directory, make sure you are on the **main** branch and use the following command to build an FPC cross-compiler:
83+ 1. Install the latest stable FPC version, at the time of the writing of this article this is FPC 3.2.2. This will be used as the startup compiler.
84+ 2. Clone the FPC git repository.
85+ 3. Make sure you have vlink and vasm in the path
86+ 4. Go to the repository's directory, make sure you are on the **main** branch and use the following command to build an FPC cross-compiler:
8387
84-``` bash
85- make clean crossall crossinstall OS_TARGET=human68k CPU_TARGET=m68k INSTALL_PREFIX="<path/to/install>"
8688```
87-
88-If you've done everything right, you should find a working Human 68k cross-compiler in the install path you've specified.
89+make clean crossall crossinstall OS_TARGET=human68k CPU_TARGET=m68k INSTALL_PREFIX="<path/to/install>"
90+```
8991
90-Now, lets create a default fpc.cfg for Human 68k cross compiling. Create a file called **\<path/to/install\>/lib/fpc/etc/fpc.cfg**. Put the following lines into that file, and fix up the paths:
92+If you've done everything right, you should find a working Human 68k cross-compiler in the install path you've specified.
9193
92-```text
94+Now, lets create a default fpc.cfg for Human 68k cross compiling. Create a file called **< path/to/install>/lib/fpc/etc/fpc.cfg**. Put the following lines into that file, and fix up the paths:
95+```
9396#IFDEF CPUM68K
94--Fu<path/to/install>/lib/fpc/$fpcversion/units/$FPCTARGET
95--Fu<path/to/install>/lib/fpc/$fpcversion/units/$FPCTARGET/*
96-#IFDEF HUMAN68K
97--FD</path/to/human68k-binutils>
98--Cp68000
99-#ENDIF
100-#ENDIF
97+ -Fu<path/to/install>/lib/fpc/$fpcversion/units/$FPCTARGET
98+ -Fu<path/to/install>/lib/fpc/$fpcversion/units/$FPCTARGET/*
99+ #IFDEF HUMAN68K
100+ -FD</path/to/human68k-binutils>
101+ -Cp68000
102+ #ENDIF
103+ #ENDIF
101104```
102105
103-Optionally add **\<path/to/install\>/lib/fpc/3.3.1/** directory to the PATH, so you'll have direct access to the cross-compiler. If you've done everything right, you now should be able to build Human 68k executables:
104-
105-```text
106+Optionally add **< path/to/install>/lib/fpc/3.3.1/** directory to the PATH, so you'll have direct access to the cross-compiler. If you've done everything right, you now should be able to build Human 68k executables:
107+```
106108ppcross68k -Thuman68k <source.pas>
107109```
108110
111+
112+
109113# OS Bindings
110114
111-There's a **h68units** package, that contains support code for calling OS functions and addressing the X68000 hardware directly. Currently this is mostly limited to DOS functions. The package is named **h68units**, and not **h68kunits** to support the 8+3 filename limitations of the target platform. This allows a future native compiler run, even if this is not possible at the moment.
115+There's a **h68units** package, that contains support code for calling OS functions and addressing the X68000 hardware directly. Currently this is mostly limited to DOS functions. The package is named **h68units** , and not **h68kunits** to support the 8+3 filename limitations of the target platform. This allows a future native compiler run, even if this is not possible at the moment.
112116
113117# Other resources
114118
115-- [GCC, binutils, and newlib port for Human 68k on GitHub by Lyderic "Lydux" Maillet](https://github.com/lydux)
119+ * [GCC, binutils, and newlib port for Human 68k on GitHub by Lyderic "Lydux" Maillet](<https://github.com/lydux>)
120+ * [X68000 C programming tutorials on GitHub by Federico Roviralta](<https://github.com/FedericoTech/X68KTutorials>)
116121
117122---
118-*From the Free Pascal wiki, page "Human 68k", as it stood on 2023-12-11 after a change by Chain-Q, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
119-Category: Operating Systems and Platforms
123+*From the Free Pascal wiki, page "Human 68k", as the Internet Archive kept it on 2026-01-16, last changed on 2024-07-29. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history