惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
News | PayPal Newsroom
IT之家
IT之家
Jina AI
Jina AI
博客园 - 司徒正美
GbyAI
GbyAI
WordPress大学
WordPress大学
B
Blog
大猫的无限游戏
大猫的无限游戏
Y
Y Combinator Blog
阮一峰的网络日志
阮一峰的网络日志
Blog — PlanetScale
Blog — PlanetScale
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Recorded Future
Recorded Future
T
Threat Research - Cisco Blogs
AWS News Blog
AWS News Blog
Latest news
Latest news
宝玉的分享
宝玉的分享
小众软件
小众软件
NISL@THU
NISL@THU
C
CERT Recently Published Vulnerability Notes
The GitHub Blog
The GitHub Blog
P
Privacy & Cybersecurity Law Blog
P
Palo Alto Networks Blog
Spread Privacy
Spread Privacy
Last Week in AI
Last Week in AI
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
P
Proofpoint News Feed
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
量子位
博客园_首页
T
The Exploit Database - CXSecurity.com
The Cloudflare Blog
M
MIT News - Artificial intelligence
H
Help Net Security
Security Archives - TechRepublic
Security Archives - TechRepublic
V2EX - 技术
V2EX - 技术
I
InfoQ
D
Darknet – Hacking Tools, Hacker News & Cyber Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
O
OpenAI News
MongoDB | Blog
MongoDB | Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
P
Privacy International News Feed
Microsoft Security Blog
Microsoft Security Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Google DeepMind News
Google DeepMind News
H
Hacker News: Front Page
W
WeLiveSecurity
N
News and Events Feed by Topic

Secret Weblog

Becoming More Xee: A Modern XPath and XSLT Engine in Rust Looking for new challenges! Repeat Yourself, A Bit The Curious Case of Quentell The Humble For Loop in Rust The Humble For Loop in JavaScript Don Question Best Practices I Was a 1980s Teenage Programmer Part 4: The Call of Assembly The Tooling Shift I Was a 1980s Teenage Programmer Part 3: MSX-2 JavaScript: when you need two ways to do it! Empowering Programming Languages Bloat and Retrofuturism Refreshing my Blog Again Random Rust Impressions Apilar: An Alife System I Was a 1980s Teenage Programmer Part 2: Olivetti M24 I Was a 1980s Teenage Programmer: the Alphatronic SolidJS fits my brain Is premature optimization the root of all evil? Framework Patterns: JavaScript edition Roll Your Own Frameworks Framework Patterns Secret Weblog Highlights Refactoring to Multiple Exit Points mstform: a form library for mobx-state-tree Seven Years: A Very Personal History of the Web Morepath 0.16 released! Is Morepath Fast Yet? Introducing Bob Strongpinion Punctuated Equilibrium in Software Morepath 0.15 released! Impressions of React Europe 2016 Morepath 0.14 released! Morepath 0.13 now with Dectate Dectate: advanced configuration for Python code JavaScript Dependencies Revisited: An Example Project The Incredible Drifting Cyber A Brief History of Reselect The Emerging GraphQL Python stack Thoughts about React Europe Build a better batching UI with Morepath and Jinja2 GraphQL and REST Server Templating in Morepath 0.10 10 reasons to check out the Morepath web framework in 2015 A Review of the Web and how Morepath fits in Morepath 0.9 released! Better REST with Morepath 0.8 Morepath 0.7: new inter-app linking They say something I don Life at the Boundaries: Conversion and Validation BowerStatic 0.4 released! Morepath 0.6 released! Morepath 0.5(.1) and friends released! New HTTP 1.1 RFCs versus WSGI Against On Naming In Open Source My visit to EuroPython 2014 Morepath 0.4.1 released (with Python 3 fixes) Morepath 0.4 and breaking changes Announcing BowerStatic Morepath 0.3 released! Morepath 0.2 Morepath Python 3 support The Call of Python 2.8 Morepath 0.1 released! WebOb and Werkzeug compared Morepath: from Werkzeug to WebOb Racing the Morepath: SQLAlchemy Integration The Centre Cannot Hold Breaking Morepath Changes Morepath Update How to do REST with Morepath Morepath Security the Gravity of Python 2 #python2.8 discussion channel on freenode Alex Gaynor on Python 3 Morepath Documentation Starting to Take Shape Back to the Center Morepath App Reuse Implementing Grok Grok: the Idea Why Linux Works for Me On the Morepath Reg, Now With More Generic! The New Zope as a Web Framework Jim Fulton, Zope Architect Renewing Zope Object Publishing The Weirdness of Zope The Rise of Zope My Exit from Zope Reg: Component Architecture Reimagined JSConf EU 2013 impressions Obviel 1.0! JS Dependency Tools Redux Obviel 1.0rc1 released! Succinct data structures
I Was a 1980s Teenage Programmer Part 5: Achieving Assembly
Martijn Faassen · 2024-06-26 · via Secret Weblog

This is the last part; Part 5 of a series.

The Book

At some point I obtained the book "MSX - Programmeren in Machinetaal" (That's Dutch. In English that would be "MSX - Programming in Machine Language").

I still have it:

The book.

The cover said "Complete course on programming in machine language. Everything about the Z80 processor and the internal life of the MSX computer".

One problem with this book was that it only covered the MSX-1. But the bigger problem is that it was difficult to read. I hate to say this about a book that was the only book I had about a topic that intrigued me: it wasn't a good book for beginners at all.

The book consisted of a long section about the Z80 which was completely generic, and a shorter section about the MSX computer specifically. So no cool graphics stuff in the first section of the book at all.

As an example of how the book didn't really help, it quickly dived into topics on how to use Binary Coded Decimals (BCD). I didn't care about BCD. Nobody cares about BCD. I wanted to make games.

I'm sure I must have tried to read it. I was a voracious reader. But I must have gotten stuck pretty quickly. The book explained the various features of Z80 assembly extensively without actually placing them into context: why would you want it? So even though the book tried to explain the fundamentals, in reality it assumed far too much previous understanding that I didn't have. I think I would understand it a lot better today, but I still have little desire to read it.

The bug in the book

I showed my friend my previous blog posts about the MSX, and he related an anecdote to me that I had forgotten. Somewhere in this book there was an assembly routine for copying data. But when we tried it, it didn't work. We then identified a bug in it, and fixed it. Some form of off by one error.

My friend pored over the book step by step, but there it was: a bug in black and white, in a printed book!

PC

I still used a PC at times as well. At some point a PC, I think equipped with VGA graphics, became a fixture in the same home office where we had the MSX.

I'd read some book from the local library which had a description of Conway's Game of Life. I used the PC and QuickBasic to create a simple, slow implementation.

I also used the PC to play with Fractint, a fractal generation tool. I was amazed that this tool was available for free. I remember reading the creators' "Stone Soup" description of how they had created Fractint, which described the process of contributions by a range of people that we'd now call open source.

In the 1990s the PC was to regain prominence in my computing life. It had games like SimCity, and later Civilization and Railroad Tycoon, that really captured my interest.

The MSX upgrade

The MSX had a 3.5 inch 360 kilobyte built-in disk drive. But a friend in my village knew how to upgrade the MSX's disk drive. One evening he came over and replaced the disk drive with a double-sided 720 kilobyte model. It also required the replacement of a ROM chip. It was a scary surgery, but it worked. Now we had double the storage capacity!

Some 3.5 inch floppies. Interesting they say 0.5 MB, which is an exaggeration

There was a protection system so you couldn't accidentally format a disk meant for 360 kilobytes as a 720 kilobytes: there was an extra hole in the disk to indicate this increased capacity. And 720 kilobyte disks were more expensive.

My younger brother, a big user of the MSX computer as well, at some point obtained a special hole punching tool. He now had the power to turn a 360 kilobyte disk into a 720 kilobyte disk! Storage capacity for free! Unfortunately it was a game of Russian roulette; some disks just broke down entirely when the tool was applied. Many disks were destroyed in the process.

Things ended up well for my disk-destroying little brother. He's still a big tech guy. He was the first in our family to have a computer with more than a terabyte worth of storage capacity. He now has a tech YouTube channel and designs LED controller hardware.

The Power of Assembly

My friend and I did eventually somehow learn how to control MSX-2 graphics from assembly. After several attempts that went nowhere, but were undoubtedly very educational, we created a game we called Matrix. It was based on this idea I had inspired by the Game of Life.

The rules of Matrix are simple. It takes place on a grid of squares that fills the screen. Each square could be empty or contain a block.

There are two players, blue and red, so blue and red blocks. Each player controlled a cursor and could use it to move blocks to an adjacent square. The goal was to destroy the other player's blocks, though I don't think we ever programmed the detection of the victory condition.

You could create a new block by orienting four existing blocks around an empty square:

Create a new block

You could destroy an enemy block by surrounding it with at 3 squares. This was actually quite difficult to accomplish and not a very effective way to attack the other player:

Destroy a block

Sometimes creating a new block would create a special block: a bomb block, a laser block and a trigger block. Each had a special symbol. A bomb block, when touching an enemy block, would explode and destroy a certain amount of squares around it. A laser block would destroy either a horizontal or vertical line depending on where the trigger block touched it.

I've wanted to come back to this game concept for many years, but I haven't yet. It's a good excuse to dive into Bevy again.

Beep!

We had done it. We'd written a game in assembler. It worked! It was copying the blocks graphics. It was implementing rules. It was fast! Even on a Z80, machine language is very fast!

It was too fast. The cursors moved far too fast. It wasn't a usable game.

So as a temporary hack we introduced a system call issue a system beep sound to slow things down. It worked, though we would have to turn the volume off while playing this game, otherwise it was a horrible racket. We didn't have any sound effects or music for the game anyway, so that was okay.

We never fixed the temporary hack.

Leaving the MSX behind

It was the early 90s. The Berlin Wall had fallen. The Soviet Union was falling apart. I went to university. I had discovered the Internet. It was a different world.

At university I learned about computer language expressions, which you could visualize as a tree.

In the summer holiday after the first year, I had an idea. Writing assembly language was really hard. What if I had some kind of expression subsystem to make life easier? I could model the expressions in memory, using addresses to compose a tree. I wrote a simple evaluator, on the MSX, in Z80 assembly. I used a memory monitor tool to help debug it. It was a really primitive implementation. I realized that besides simple arithmetic, I could model conditionals as expressions too. And for loops.

University started again. I had a course on the Lisp programming language. Some other students struggled to get it, but not me. I realized I had reinvented (badly) bits of Lisp.

I think it was the last thing I ever programmed on the MSX, and with Z80 assembly.

Conclusion

We're crossing into the early 1990s, in which I eventually left my teenage years. Therefore this concludes my series. on my early experiences with computers. The early Internet became important to me in my late teens, but that's another story.