How to print, preview in VB Studio Express

There is classic basic program for Commodore 64 computer to print maze on the screen. This program random prints “/” and “\” character on screen. I wanted to implement same program on modern computer and print the result. Not only to print, but also, use print preview.

Original C64 program:
10 PRINT CHR$(205.5+RND(1)); : GOTO 10

After some investigation I found in the internet the best option for MS Visual Studio Express VB (.net). This software “set” allows to print the same stuff to windows form image, printer preview control or to real printer output. This is not very straight, with some hack, but source code is self explanative. Thanks to MS for making it so strange.

Printing, preview in VB Studio Express
Program is very simple- demo button to invoke various types of functions: print, printer setup, page setup, print preview… With small change it is posible to use same graphics commands to picturebox object.

Visual Studio Express VB Source code.

Program read “page setup” settings and adjust parameters for print. Still there is bug when changing paper orientation, but I think it is solvable.

Posted in Anything | Leave a comment

Quick hack – optical mouse for Amiga (or Atari) computer

I was testing old Amiga computer and noticed, that somewhere I lost the mouse. It is proprietary mouse for Amiga computer, it even does not work with Atari ones. The mouse itself is very simple- only raw quadrature information is sent (mouse buttons are on separate wires). This make mouse very simple, but it uses 8 wire cable! (9 with middle button).
I was thinking, that I might find some ball mouse for PC computer, remove controller and will build exact replica of the Amiga mouse. But ball mouses are rare. Instead I found several optical mouses, the old ones, with two chips inside.

The first mouse was USB one, with Avago chip:
mouse
The chip is ADNS-5020, from Avago.
This chip has SPI interface, too modern for our goals.

Next mouse was PS2 one:
mouse
This chip is older, OM02, from unknow company in China.
This chip is perfect- it has quadrature (delta X and delta Y) output pin. Datasheet even describes how to build your own mouse.
For Amiga mouse there is no need to build anything. Solder out controller, connect quadrature pins to cable. Rewire mouse buttons (if you need. Mines was connecting to Vcc, Amiga needs connection to GND).

mouse
The only problem is thick wire. But mouse works very well.

Posted in Anything, Vandalising | Leave a comment

8-bit font tool: editor, rotator, mirror

This is small tool writtent in Visual Studio Express VB. Main purpose of this tool is to find 8 bit wide fonts and graphics in various ROM, firmware files and export to binary or C source file.
Tool can edit single bits (pixels) change bit order (mirror), rotate bits and work with blocks of memory (in case of 8×8 matrix- rotate CW and CCW), flip up-down.
All these manipulations help to prepare custom fonts for cheap LCD/OLED screens for use with ST32 or AVR MCU.
Support different font height so it is possible to extract EGA/CGA/VGA fonts from video card BIOS.

Font rotator

Software requirements: modern 32 or 64 bit Windows computer with .NET framework. I do not have key to sign software, so during installation, your windows OS will warn you several times during install.

There is MS Visual studio “install page” to get the file.

Original Lithuanian page about font rotator.

Posted in MCU | Leave a comment

Permanent link to Atari 1088XEL SMD

Permanent page for Atari 1088XEL SMD project.

Posted in Anything | Leave a comment

TI-99/4A printing new key

Modern 3D printers allow us to print at tremendous quality and resolution. And some Chinese ones are quite cheap. My one of Texas Instruments TI-99/4A computers has a problem- due to a bad package and careless shipping it lost three keys. I still had keycaps, but it itself is damaged- the shaft is broken.

3D printed replacement key shaft for TI-99/4A computer keyboard
White ones are original, clear ones are new, 3D printed. It was quite hard to create a 3D model for this part as it is very small and has tons of details. But after four attempts I made it. On the left side of the image there are bad ones (the horse is also bad). Meanwhile on the right side there are some keys removed from the keyboard and disassembled.

Also, here is the STL file for this part. Take a note, that size of the key is ten times bigger (x10):
3D model in STL format for TI-99/4A keyboard key.

just scale the part to 10% and everything will be fine. Why? Because my 3D software is very buggy and only basic features are available. It is much easier to do bigger models in that software.

Posted in Personal | Leave a comment

TI-99/4A

Whenever I talk about designers of the ZX Spectrum computer I use to say that they were smoking weed. Now I acquired one computer from another family of computers, TI99, I can tell that Texas Instruments designers not only smoked weed, but also used some heavy stuff. This is a crazy computer from an internal design view. Or maybe it was done on purpose- there was a big company behind pressing to use some obsolete chips to increase sales.

And there is the result:
TI-99/4A computer
It is a Texas Instrument TI-99/4A computer, or maybe “console”- in all technical specifications it is called console.
Continue reading

Posted in Anything | Leave a comment

ZX interface 1 and Microdrive

I collected several ZX Spectrum series computers, but I don’t have any fancy peripherals. After several attempts I managed to buy ZX Spectrum Microdrive and interface 1 for it.
ZX microdrive
As always with ancient hardware it is working a bit, but in general not working: tape inside is moving, but nothing from the computer. The only problem, that to open this device I need to tear off the metal cover. According to original documentation, this metal cover is single use only.  Now it is impossible to get new cover, so I gently took it off, but some deformation happened.
Continue reading

Posted in Anything | Leave a comment

PS2 keyboard for ZX Spectrum (or clone)

ZX Spectrum and other computers of that period use proprietary keyboards with direct connection to some specific chip or connected directly to computer bus. Old keyboards are damaged from elementals or time, and sometimes are not very user friendly compared to standard ones. Goal of this project is to connect old and obsolete (!) PS/2 style keyboard to ANY old computer. This project is tested on ZX Spectrum CPLD clone, but mimics the original ZX 40 keys keyboard. Why not a USB keyboard? Because it limits to the narrower selection of MCU’s and USB HID is way more complex to implement.

This project consists of one easy part and one very rare part- CPLD. I think that maybe it is possible to directly connect without CPLD (or glue logic) with modern MCU, but my CPLD ZX spectrum uses “turbo mode” with 5MHz CPU clock and speed of keyboard scan is too fast for MCU pins.

How does it work? It is crazy multi conversion:

  1. Key press is connecting the matrix on the keyboard. Keyboard detects this and converts keypress to scan data. This data is transmitted serially to the PS/2 interface.
  2. MCU collects PS/2 data, decodes from scan code to ASCII.
  3. ASCII key codes with modificators are combined for extra key combinations and stored in the key buffer.
  4. The key buffer can hold up to 10 keystrokes (+modifiers). So multistroke is possible (especially for games). Multistroke is limited by keyboard hardware, not this project.
  5. All data is converted to a 40 bit key code matrix (8 columns, 5 rows) for the ZX computer.
  6. All 40 bits are shifted serially to CPLD at fast speed (2+ Mbit/s, depends on CPLD and connections) DMA SPI.
  7. CPLD decodes the bit stream and emulates keyboard hardware.

CPLD Hardware:
CPLD block diagram
Shiftreg is simple 40 bits shifting register to store SPI data, following with 40 bits latch register. This looks like five 74HC595 connected in serial. Last module is combinatory logic. It is written in Verilog:

module keyboard( keys, col, row);

input [39:0]keys;
input [7:0]col;
output [4:0]row;

assign row[4]=(col & keys[7:0]) !=0;
assign row[3]=(col & keys[15:8]) !=0;
assign row[2]=(col & keys[23:16]) !=0;
assign row[1]=(col & keys[31:24]) !=0;
assign row[0]=(col & keys[39:32]) !=0;

endmodule

 


(my design uses inverted row/col. Depending on real hardware these buses may be inverted)

I am using a cheap STM32F103 MCU from China, Bluepill format (it can be a fake one, with smaller RAM/ROM size). All software is written using GCC and STM32CubeMX. All source code and compiled binaries are on the bottom of the page. PS/2 write is not implemented, now it just resets the keyboard on Esc key press. I have tested 3 keyboards and one has some strange bug- sometimes it starts translating some strange data if keys are pressed very fast or very long. Pressing Esc stops this chaos and inits keyboard interface.

Standard PS/2 keyboard has more keys than the ZX Spectrum, so some keys are redefined for more convenient usage: Like “;” and “:” pair- pressing dedicated key for semicolon and shift generates specific ZX spectrum keystroke. Same for “/?”, “=+”, “Backspace” and some other keys. Also, the numeric keypad is working too. “Caps lock” is working too, but LEDs are not used (because I do not implement PS/2 write properly and also, that it may not indicate real status of the computer). “Shitf”, “Alt” and “Control” are in use, but the logic is strange. And it is not my fault- it is Sinclair.

All source code and compiled binaries:
PS2 for ZX Spectrum source code, plain GCC for STM32F103.

Example Quartus project: Quartus archive. Will fit to EPM7128 or bigger chip.

Do not forget 5V/3V logic conversion. STM is not tolerating 5V logic very well.

Posted in FPGA, MCU | Leave a comment

Sinclair QL – modifications for EPROM

I have Sinclair QL, “issue 5″ with 3 EPROM chips. One of the chips is riding on the other chip. And yes, it is the original solution from Sinclair engineers- they were pressed by Apple computers new product and they had to make it fast. This computer had some problems- the screen was filled with garbage and nothing was working. Looks like a RAM issue, but original firmware is not very good at diagnostics. It is very nice that there is a third party ROM for this computer and it is possible to download ROM image. This ROM image will not fit to single ROM in current configuration and it is quite crazy to piggyback ROM chips. This topic is also commercialized in retrocomputer world, but there is very simple fix.

First, I just placed a small PCB to test the computer and check RAM. The RAM was good, problems were in piggyback ROM.
big EPROM on Sinclair QL
(Some images are clickable)

Computer requests ROM’s chip select rising HIGH ROM_OEH. Typical EPROM chips use inverted CS/OE pin. So, I placed a 74HC00 chip to invert the signal. And one wire for the missing address pin.
Continue reading

Posted in Anything | Tagged , , | Leave a comment

Real easy Video fix for ZX Spectrum +2 (gray, “Toast Rack”)

I bought a ZX Spectrum +2 gray (toast rack) for my retrocomputer collection and it was the fail. The video output was bad and also there is a serious problem with RAM or ULA. But this article is about making perfect video output without fancy tuning. This article is a bit rude- I was searching the internets for more information and almost all data I found is copy paste of people without any deep analysis. Also, I found that about everything for this computer is deeply commercialized compared to Atari ones. Also, schematics and documentation are shitty.

So here is the starting PCB of ZX Spectrum +2, marked Amstrad 0500 ISS3 (Z70500):
ZX Spectrum +2 PCB 0500 ISS3 Z70500
(press on image for bigger)

Continue reading

Posted in Anything | Tagged , , , | Leave a comment