HNHacker News
TopNewBestAskShowJobs

nanochess

1,327 karma · joined January 8, 2017

nanochess.at.hn

Living at Mexico. Always programming new things. 5x IOCCC winner. Wrote the JS1K Chess.

* Website: [nanochess.org](https://nanochess.org/) * Mastodon: [@nanochess@mastodon.social](https://mastodon.social/@nanochess) * Twitter: [@nanochess](https://x.com/nanochess) * My books: [Lulu.com](https://lulu.com/spotlight/nanochess) * Instagram: [@nanochess](https://instagram.com/nanochess)

![nanochess](https://nanochess.org/img/myself.jpg)

submissionscomments
nanochess··on La Cueva BBS in Mexico in 1993 (session replay)
Cool! I was also registered in Tierras Extrañas. I just have added a link to a FB group for Mexican BBS people.
nanochess··on La Cueva BBS in Mexico in 1993 (session replay)
You're welcome. I was just commenting with a friend that I should have captured a lot more of my BBS sessions. There was some amazing ANSI art I never saw again. People really put effort in making their BBS look original and attractive.
nanochess··on La Cueva BBS in Mexico in 1993 (session replay)
I'm pretty sure I wrote Z280 checking yep, the Zilog Z280 can address 16 MB of memory. It has separated MMU mapping for code and data (64K + 64K mapped anywhere) ideal for operating systems, but if you never enter this mode, then you can access at the same time 64K at the lowest memory address using the normal instructions, 64K using LDUP, and 64K using LDUD. Of course, you can update the MMU registers as required to access other memory spaces, I used the 8K page size. Besides the CPU has a small cache, so it was faster by a magnitude than a Z80.
nanochess··on Ask HN: Who's still keeping a DOS machine up because the business depends on it?
I've an AMD K5 processor machine running at 100 mhz. for testing Transputer ISA cards when someone buys one, I also use the same machine to format and copy my Pascal compiler into a pair of 5 1/4" floppy disks. All using DOS.
nanochess··on Making portable my unportable transputer C compiler
It is a simple debugger log in the transputer emulator (enabled by compilation option) which outputs each instruction executed so far, around 70 bytes per line displaying the 3 registers, the stack pointer, the instruction pointer, and the disassembled instruction.

The emulated C compiler processed a whole file ccvars.c before getting stuck in ccinter.c (this is the 5gb mark, approximately 78 millions of instructions executed). I stopped the process as soon as I saw it was stuck, but the emulator is fast, and I got extra 3 gb in the log. All this happened in less than two minutes.

nanochess··on Unearthing my 1996 windowed OS in machine code for Am29000 homebrew computer
Amazing! I didn't knew about the gr2 and gr3 register. I just searched for these in the user's manual, very sparse documentation. Thank you!
nanochess··on Unearthing my 1996 windowed OS in machine code for Am29000 homebrew computer
The article ended so big for my own measures, but I'm glad to know you want more of my wall of text. Thank you!
nanochess··on Unearthing my 1996 windowed OS in machine code for Am29000 homebrew computer
There was so much stuff to cover but there's a slight mention saying " had to add the LOADM and STOREM instructions as these handle the spilling of local registers to memory when the register stack is full" I can add an extra explanation there.
nanochess··on Unearthing my 1996 windowed OS in machine code for Am29000 homebrew computer
Wow! Thank you! The floating-point implementation in the Am29050 is really great as it ran in parallel with the integer unit. Sorry, I need to ask, maybe you don't remember. What happens if you write into gr2-gr63? Not really needed to know, but I've been curious the last 30 years.
nanochess··on Unearthing my 1996 windowed OS in machine code for Am29000 homebrew computer
I'm glad you enjoyed it. It is my longest article so far and it took a lot of effort. Thank you!
nanochess··on Elon Musk's X down for users
I don't publish anymore in X, so I don't mind it. And by the number of points, I can see it is pretty obvious no one cares anymore. The owner is giving a great lesson on how to destroy a social network, while alienating the remaining users.
nanochess··on Completing a BASIC language interpreter in 2025
First time I heard of it. I should know better as the TI-99/4A forum is just one click away from the Intellivision forum. Thanks for the heads up!
nanochess··on Development of a transputer ISA board
The practical advantage is that the 74LS chips are available in several corner stores at 25 or 35 cents each one, and I preferred the logic to be the same family.

You cannot choose the source, these come mixed from ST, TI, and other manufacturers. I preferred the laser-engraved ones instead of the white ink ones just to have an uniform look.

The crystal oscillator needs something faster so it requires 74F04, and the link communication buffer requires 74F244 or 74AS244. These are more expensive, the 74F are 2 dollars each chip, and the 74AS are 4 dollars each chip.

nanochess··on My teen years: The transputer operating system
These brochures were amazing. Just like video games, the cover promised a lot!
nanochess··on My teen years: The transputer operating system
Thanks! I love the "Fire in the Valley" book of Michael Swaine. I've read it so many times and always find it very inspiring.
nanochess··on My teen years: The transputer operating system
I didn't know it was "oddball". I had brochures, official Inmos datasheets, and reference books about it, along magazines articles citing it as the "faster processor in the world". I believed it was pretty popular until Internet put me down in Earth, and I discovered the transputer was pretty much dead since 1994.

I was already proficient in Z80 and 16-bit x86, so learning another instruction set was pretty welcome. The fun came from developing things for the first time and discovering how to actually do things, a 32-bit operating system, a K&R C compiler, and the assorted utilities.

Enforcing limitations was inspired by the IOCCC, and later by my boot sector programs. The type of things you do after work, just to test yourself and have some fun.

nanochess··on My teen years: The transputer operating system
It is something you can download and test, and it includes the source code for the emulator, the operating system, the C compiler, and everything else.

Just provide the emulator with an ISO CD image, and once it boots up, type DIR D: this single operation requires just about 28 kb of transputer RAM memory for the operating system, the command-line processor, and the buffers.

There's a file browser embedded in the text editor, so you can navigate using the arrows keys and choosing text files to read.

In fact, we need very little info to read CD-ROM directories. A directory search only requires a 2 kb buffer and some variables to keep track, read until you find the first part of the path, read that block, and repeat recursively until you find the desired file.

Reading a file from the CD-ROM can also be done just keeping a 2 kb. buffer and some position variables. My transputer operating system is inefficient in this because it reads the CD-ROM discs in terms of 512-byte sectors, cached by the host system.

nanochess··on My teen years: The transputer operating system
Thanks for sharing! Mine was a pretty similar experience in the eighties, because you could learn so much just by reading books and doing experiments. Recently, I got three Commodore 64 (the descendants of the PET) and I just want to type some BASIC games and start learning. I'm very humbled by the experience of writing "Programming Boot Sector Games", because like you, many people have told me about having a nice experience reading and learning with it, and I'm glad the effort was worth it.
nanochess··on My teen years: The transputer operating system
Wow! Thank you!
nanochess··on My teen years: The transputer operating system
Thanks for the suggestions! I've updated the article.
nanochess··on Bootstrapping a Small-C compiler for transputer and Operating System in 1995
Thanks! First time I see this book. I just noticed it is also based on Small-C and contains the whole compiler. Nice!
nanochess··on I coded a Pascal compiler for transputer as a teen in 1993
I've included a transputer emulator in the git for using the Pascal compiler. The FILE functions are missing probably because I couldn't figure a method to ask for host services and interleave data in the input/output channel.
nanochess··on Show HN: Markdown HN profiles at {user}.at.hn
Really nice! For a moment I thought it was official. Anyway I've edited my bio and have been waiting like 20 minutes for it to be updated in the site.
nanochess··on Intel 8080 emulator. 19th IOCCC. Best of Show
The simplest emulator in the world would be like this one:

unsigned char memory[65536];

int reg[8];

int main(void)

{

    int pc = 0;

    /* In this point you read something into memory */    

    while (1) {
        
        instruction = memory[pc];

        if (instruction == 0x76)  break;  /* HLT */

        pc = (pc + 1) & 0xffff; 

        if ((instruction & 0xc0) == 0x40)    /* Handle MOV r,r (opcodes 0x40-0x7f) */

            reg[(instruction >> 3) & 7] = reg[instruction & 7];

    }

    return 0;
}

What it does? It simply reads each instruction from memory (PC is the Program Counter), and increments PC continuously limiting it to 16-bit.

It does a comparison for each possible instruction, for this example I only handled the most basic one of 8080 (MOV r,r) and HLT, but this is already 64 cases of the 256 possible!

Then I added iteratively chunks of opcodes to emulate and used language C macros to reduce the code size. For example, there is #define d(e) to join two 8-bit registers into a 16-bit value, and #define Q to read the accumulator.

In the end, to stay inside the size limit of the IOCCC, I removed the tree of 'if' statements and replaced it with a tree of trinary operators ?: (a way of doing 'if' inside an expression) and this is what the macros C and S does.

nanochess··on BootLogo: Logo language in 508 bytes of x86 machine code
Thanks! Your project is amazing to test with just a browser. Just I've made a link using the newest version of bootLogo (now supporting procedures!)

TO CURVE REPEAT 4 [LT 10 FD 10] END

TO PETAL [CURVE LT 140 CURVE] END

TO FLOWER REPEAT 4 [PETAL LT 50] END

FLOWER

RT 180

FD 50

RT 140

PETAL

PU

FD 50

Emulator link: https://parkertomatoes.github.io/v86/?type=mbr&content=Dg4fB...

nanochess··on BootLogo: Logo language in 508 bytes of x86 machine code
Thanks for the tips! I've updated bootLogo and mentioned you in the manual. Now bootLogo has PU/PD commands.
nanochess··on LOCS: Language developed at age 9 in Z80 machine code (1988)
Cool! I've added a mention of this to the article.
nanochess··on Colecovision BASIC compiler: CVBasic v0.1.0
It's a problem related to Visual C++ 2008 redistributables triggering false warnings. I'll try to compile the next version with something more recent.
nanochess··on Colecovision BASIC compiler: CVBasic v0.1.0
Automatic generation of code for Z80 is kind of hard because some operations are forced to use a few registers. For example, ADD only works with A or HL (and IX or IY), and the code generator requires register shuffling or using the stack for saving temporary values. My current approach is building a node tree for expressions, generating code by detecting common patterns, and if there isn't a pattern it goes the complicated but simple way. For example, for add: right expr. / push hl / left expr. / pop de / add hl,de
nanochess··on Colecovision BASIC compiler: CVBasic v0.1.0
Thanks. I stand corrected.
Page 1 of 2Next →