Replies: 64 comments 60 replies
-
I think @tkchia is working on porting some functions that will make it easier to port games. |
Beta Was this translation helpful? Give feedback.
-
Hello @tyama501,
That is cool, but keep in mind that ELKS doesn't know anything about UTF-8. It doesn't parse the sequences, nor does it drop or rewrite any. Thus, it is merely just passing the stream contents through to your terminal, which interprets them. I haven't looked at Angband yet, this could seemingly work, but only if the output were viewed on a UTF-8 terminal on a serial port. I have been working on a library, also in elkscmd/tui, that allows for conversion of UTF-8 sequences to CP437, which is used for the
You're welcome to enhance the routine. Perhaps just copy the entire curses.c into your port directory at first, we can then back port to TUI later. The function could should send an ANSI escape sequence to the console/terminal to report the cursor position, and then read it back. This is already done (and a bit complicated) in unikey.c::tty_getsize(). A much simpler way might be to just track the position in curses.c and report that back without emitting an ANSI sequence. This could get complicated, perhaps understanding why getxy() is needed would also help its implementation.
Have you checked to see how large this program is compiled on Linux? It seems there's lots of code here, perhaps check early if it has much chance of fitting into 64k data (128 code for medium model). I only tried to port a very simplified version of curses, which does not implement subwindows, nor lots of the routines. It does implement color support though.
Yes. However I would advise not to attempt to interpret all the Thank you! |
Beta Was this translation helpful? Give feedback.
-
Thank you @ghaerr , 〉Have you checked to see how large this program is compiled on Linux? I was worrying about this. I already closed PC for today but I think it was about 5MByte or so. 〉I only tried to port a very simplified version of curses, which does not implement subwindows, Yes, I know. I copied the curses.h of the tui and I am checking what is there and what is not. I only think modifing the main_gcu.c, makefiles etc, and not whole configure. Thank you. |
Beta Was this translation helpful? Give feedback.
-
Hello @tyama501,
Both are huge! If
Yes, pretty much you'll need to compile it to see how large it is. But even basic guessing would be looking at the 32-bit version. If its much over 128-200k, it will be too large. Most usually though the biggest problems come with the 64K data limitation. This can be ascertained using Thank you! |
Beta Was this translation helpful? Give feedback.
-
This is 64-bit linux version but maybe it is too big. I also forgot that my PC-9801BX has only 5MByte ram including protected memory... |
Beta Was this translation helpful? Give feedback.
-
Hello @tyama501,
That amount of RAM does not affect the ability to run large programs on ELKS, as ELKS programs are limited to 128k max code and 64k data = 192k. (That is, a 512k RAM system would be able to run any ELKS executable). From the For programs or games you really want to port, sometimes it's worth it to try to find very early versions, which are usually quite a bit smaller. Thank you! |
Beta Was this translation helpful? Give feedback.
-
I tried UMoria 5.6, the base of the angband. It is much smaller than the angband, 5.6 has amiga, atari, ms-dos ports. The main repository 5.7 moved to C++ and |
Beta Was this translation helpful? Give feedback.
-
Hello @ghaerr , BTW, just curious Thank you. |
Beta Was this translation helpful? Give feedback.
-
Hello @tyama501,
Yes, but still huge. Perhaps the v5.6 DOS port would be something to look at.
With our ia16-elf toolchain on ELKS, only small and medium model are supported. In medium model, procedure calls are far, but they are each aggregated by the linker into a total of two segments: the main one (which is also used for near procedures), and a far segment, whose size is also limited to 64k. Thus the 128k limitation. Microsoft's DOS toolchain doesn't have this issue in their medium model, so one still needs to be careful trying to determine whether a DOS version can be ported to ELKS. Thank you! |
Beta Was this translation helpful? Give feedback.
-
I compiled it anyway (with deleting a lot of unimplemented io functions), ia16-elf-gcc -fno-inline -melks-libc -mcmodel=small -mno-segment-relocation-stuff -mtune=i8086 -Wall -Os -maout-heap=0xffff -o moria_e main.o misc1.o misc2.o misc3.o misc4.o store1.o files.o io.o create.o desc.o generate.o sets.o dungeon.o creature.o death.o eat.o help.o magic.o potions.o prayer.o save.o staffs.o wands.o scrolls.o spells.o wizard.o store2.o signals.o moria1.o moria2.o moria3.o moria4.o monsters.o treasure.o variable.o rnd.o recall.o unix.o player.o tables.o curses.o curses2.o tty.o runes.o unikey.o |
Beta Was this translation helpful? Give feedback.
-
Just for Information, -rw-r--r-- 1 tyama wheel 19848 Jan 4 00:38 ../source_tes | -rw-r--r-- 1 tyama wheel 11940 Jan 7 04:02 ./create.o |
Beta Was this translation helpful? Give feedback.
-
Hello @tyama501,
The error message shows that you are 0x35460 - 0x20000 = 0x15460 = ~84k over the initial 64k allowed in small model. That is, the linker puts the first 64k at 0x10000 internally then allocates a second (maximum) far segment at 0x20000. Thus it seems the program code segment required is approximately 64k + 84k = 148k, or at least 20k over the 128k max limit.
You're still compiling in small model - you'd need -mcmodel=medium and -msegment-relocation-stuff in order to turn on medium model. This won't change the link result however, and the far calls will actually add more code requirement. See elkscmd/nano/Make.defs for more information on the
Running It appears you could be close at just 20k over our 128k code size limit, it remains to be seen whether the data segment size might be too large. Thank you! |
Beta Was this translation helpful? Give feedback.
-
Thank you @ghaerr ! That is closer than I thought. |
Beta Was this translation helpful? Give feedback.
-
Yes, with the medium model compilation /mnt/hdisk/git/elks_pc98/elks/cross/lib/gcc/ia16-elf/6.3.0/../../../../ia16-elf/bin/ld.gold: error: load segment overlap [0x20000 -> 0x38f10] and [0x30000 -> 0x4ccc0] |
Beta Was this translation helpful? Give feedback.
-
I created the fork repository from Umoria 5.6. I modified Readme and update LICENSE file to GPL3(from GPL2) since 5.6 is GPL3.
There are a lot to go but Thank you. |
Beta Was this translation helpful? Give feedback.
-
Hello @ghaerr , Thank you for the comment.
It runs and we can work around town. (There are some people but no stores.)
I need some alternative since it gets no display after showing some files.
Yes, I think this is good for portability.
I don't think multiple windows are used, but this is similar to reading VRAM isn't it?
I don't think it is easy to redisplay game screen itself for now, since it depends on curses saving, Thank you! |
Beta Was this translation helpful? Give feedback.
-
The problem with reading/writing console RAM directly is that the game will only run on the console, and worse, if run on a serial port, would write to the console when dealing with the popup - so basically this is probably a bad design, especially since otherwise the game should run on a serial terminal from ELKS and over networking.
I suppose it really depends on whether the game has data structures that determine what is shown, in which case a routine may be able to be written to use them to recreate the game screen at any point from scratch. In particular, the routine that updates the matrix area on the screen may be able to be enhanced to redisplay the entire matrix, rather than just the most recent player move. Then, redisplaying the more static portions of the screen may be easier. |
Beta Was this translation helpful? Give feedback.
-
Hello @ghaerr , I found draw_cave() function already exists, so I used it to restore screen. Here is playing video. Thank you! |
Beta Was this translation helpful? Give feedback.
-
Hello @tyama501, Fantastic progress! Is the cave size required to be small because of lack of data segment space, or is this how the game starts? Glad you've found the draw_cave() function, that simplifies curses considerably. Have you tried running on serial to see if that also works? (For the time being, you may have to set the terminal emulator lines/cols to 25x80 or larger on the serial line but the curses code should work for an ANSI terminal.) Thank you! |
Beta Was this translation helpful? Give feedback.
-
Hello, Additional video, elksmoria_20230212.mp4 |
Beta Was this translation helpful? Give feedback.
-
There may be a lot of bugs, but I released the first binary for test play. https://github.com/tyama501/ELKSmoria/releases I modified the binary name again to "elksmori" with in 8 letters since Right now, ./morifile/license morisave and moriscor files are also created under current directory after save the game. When starting the new game, you can select whether you use the Umoria original key or Rougue key. You can see the help file for keys by hitting "?" after creating character and starting the game. First you will be in the Town(without any stores...). You have Soft Leather Armor, Cloak. Dagger, and 5 Woodden Torches at the beginning. There is no potion at the begining, but you can heal yourself by You can attack monsters by just moving toward them. Ctrl-X will save the game and Exit. Known ISSUE (but I don't know how to fix yet) (2) Rest not working Not checked Well, that's all for now |
Beta Was this translation helpful? Give feedback.
-
Hello @ghaerr ,
It seems that ESC key has been defined as follows and it is compared to the result returned from getch(). constant.h io.c create.c
This worked with increasing stack from 2048 to 2240. Thank you! |
Beta Was this translation helpful? Give feedback.
-
Hello @tyama501, I'm not sure about the ESC issue, my first guess is that Umoria has ANSI keyboard processing built into the game, where, if a single ESC is found, it assumes that it is an incoming arrow/function key, and reads more bytes, in order to recognize the multibyte keystroke. you should look into this. However, curses is supposed to handle this. Otherwise, put a check within
Great. I would assume you are quite tight on stack space, but if any other .data segment can be lowered, stack can be increased, since they live in the same segment. Thank you! |
Beta Was this translation helpful? Give feedback.
-
Sorry, one quick question. |
Beta Was this translation helpful? Give feedback.
-
I restarted this to debug since there may be chance to compile with the large model in the future. |
Beta Was this translation helpful? Give feedback.
-
That is very strange! All control keys should work with curses. We can test that using the
Oh geez! I'll look at that also. I had thought that UNIX-style jobs were disabled in the shell, and perhaps the kernel should that have that turned off as well. If |
Beta Was this translation helpful? Give feedback.
-
@tyama501 So now ELKSmoria can benefit from less code removal using OWC (Open Watcom Compiler) The compact model is currently available, which means more space for data. |
Beta Was this translation helpful? Give feedback.
-
Release and Updates. Second test release for ELKSmoria. Updated
This version is built with gcc-ia16, medium model. I will try to build with OpenWatcom large model for next release. Thank you! |
Beta Was this translation helpful? Give feedback.
-
@tyama501, looks like you've got the game running pretty well! It will be interesting to see whether any source changes are required for OWC compilation or not. If there is no ASM source, I am hoping that the game ports and runs with no modifications. |
Beta Was this translation helpful? Give feedback.
-
I will add setuid and setgid system calls ASAP, you should be OK commenting out that code for the time being. I just added bsr in the last commit or so to ELKS, bring over file elkscmd/tui/bsr.c. I will add that to the watcom/ library I think. For abs, you can write your own function for now:
I will look into why abs is missing - it seems it is supposed to be standard but is many times a macro. |
Beta Was this translation helpful? Give feedback.
-
Hello,
As I noted it on #1387 (comment),
I could display UTF-8 with the serial terminal,
I started to think porting Angband (Roguelike game using UTF-8) with elkscmd/tui/curses.c.
https://github.com/angband/angband
The main for curses is angband/src/main-gcu.c.
Just Idea but subwindow fuctions are substituted with a single window.
Maybe no color for the first try.
It seems that at least getyx function is needed in elkscmd/tui/curses.c.
/* Get current cursor position */
getyx(stdscr, y, x);
mvwaddnwstr is preferred but maybe it can be substituted with mvaddch.
@ghaerr ,
Is it possible to add getyx(stdscr, y, x) in tui/curses.c?
Do you think there is a chance to port simplified version of the angband?
As @toncho11 saying it is nice to add if we could add some game.
Thank you!
EDIT :
Angband is too big to port to elks.
Currently targeting UMoria to port.
UMoria
https://github.com/HunterZ/umoria
ELKSmoria
https://github.com/tyama501/ELKSmoria
Beta Was this translation helpful? Give feedback.
All reactions