Search Results for ‘Processing’

PETSCII editors: an overview

I’ve been rather actively involved with PETSCII art for the last couple of years, coding, drawing and even conducting a bit of research. As PETSCII is kinda fashionable now, and many people would like to experiment with it, here’s a little overview of the available editors and their pros and cons. The list aims to be complete, so if there’s anything missing, let me know. Let’s start with native tools and then move on to cross-development.

It’s a fine line, but I’ve decidedly excluded various text editors that could be used for character graphics as well.

Digital Paint 4.0 (C-64, link)

Probably ok for its time – can’t quite pinpoint when exactly it was released. In addition to the original version coded by Aaron Hightower there are various hacks by sceners who added missing features. In addition to typing, you can paint filled boxes and edit colors.

digitalpaint

TBoard-Painter 1.1 Pro (C-64, link)

Another oldie, this time by Tao/Triad. The most notable extra feature is the 1/4 char pseudographics drawing mode. The image can be larger than the screen size, which together with the name suggests it was meant for BBS graphics. As a nice little touch the x/y location display uses hex numbers 🙂

tboard-painter

Tyronpaint 2.1 (C-64, link)

Not much new to say about this: you can type text, change the color or draw blocky 1/4 dots. The images can be higher than 25 lines. Created by Lynchbit/Alpha Flight in 1996, this improved version is from 2006.

tyronpaint

Kaleidoscope 4.0 (C-64, link)

Very simple, but at the same time easily comprehensible editor by BroBryce64 all the way from 1989. Not many features there, but you can type chars and change colors. A curious extra is the “rainbow mode” which cycles the colors after each character.

kaleidoscope

PETSCII Paint 0.5 (C-64, link)

A rudimentary tool by 0xDB from 2011. The basics do work: you can select characters, change colors and save the outcome, but even simple things tend to be on the tedious side.

petsciipaint

Petscii Editor 4.6 (C-64, link)

FieserWolf’s editor is undoubtedly the most popular one when it comes to programs running on real hardware. As the version number suggests, there have been plenty of iterations and the workflow has been improved a lot since the initial releases. Once you get used to the UI, there’s useful functionality such as copy/paste, recoloring and multiple pages available. Several notable works have been produced with this editor.

petsciieditor1

Online PETSCII Editor (online, link)

A web-based solution by Krissz from 2013. I like the idea that you can draw on a normal browser without installing any software or digging the old warhorse from the closet, but this particular project seems to have been abandoned. You can both draw and type, and the character selector is well though out. On the other hand, there is little functionality to support advanced editing.

petsciieditor2

PET Shop Pro (online, link)

As of now there’s very little documentation on this editor by Jambonbill, as it is still work in progress and not officially released. Nevertheless, quite a promising online tool which lets you even do animations. Originally based on Krissz’s editor (see above), but was mostly rewritten after that. The character selector is well designed, you can edit images of various sizes plus export them to different formats, and even script the editor. There are still some bugs around, which will hopefully be ironed out at some point.

jambonbill

CBM .prg Studio (Windows, link)

Arthur Jordison’s CBM .prg Studio is a complete development environment that lets you create software for the Commodore 8-bits. One of its parts is the screen editor, which is actually quite usable for artistic endeavours too. Largely served as the source of inspiration for the editor below.

cbmprgstudio

APE (Windows, link)

APE (Another Petscii Editor) by MrXaliasH from 2013 is Windows-only, but does run fine under Wine as well. The basic functionality (drawing, color selection, copy/paste and even undo) is there, but it seems the project was quickly dropped after its initial release.

ape

C64 AAE (Windows, link)

C64 ASCII Art Editor by RADSoft hails from Poland. Windows-only, but runs somewhat ok under Wine except the color editor. Apparently the development ceased in 2012, but in spite of that there are some unique features – most notably layers, which were a firstie in the scene. The animation features are also among the most advanced. Drawing happens by writing, but unfortunately the key mapping doesn’t suit all keyboards. Furthermore, keyboard shortcuts require quite heavy juggling with various ctrl/shift/alt combinations.

aae

EDSCII and Playscii (multiplatform, link)

EDSCII by JP “Vectorpoem” LeBreton was one of the first editors I tried in 2013. Later on its development halted and Vectorpoem created a new tool called Playscii. Both versions focus on PETSCII-like retro graphics instead of sticking to the exact capabilities of the C-64. Still under development, Playscii already features plenty of functionality such as different character sets, layers, animation frames and smooth zoom, plus of course the standard editing tools. There is also something called “game mode”, which I didn’t quite understand at first sight, though.

playscii

PETSCII (multiplatform, link)

Do not expect me to be very objective with this 🙂 The project, initially coined by me and Dr. TerrorZ, started in 2013 and has received occasional updates ever since. In addition to the standard stuff there’s rudimentary support for animation and other machines than just the C-64 (VIC-20, PET and Plus/4). One recognized problem is that because of Processing, the program runs on Java, which spells trouble these days. The GUI is undeniably “no-nonsense” with most functions hidden behind single-key shortcuts.

petscii1

In conclusion, there’s already quite a variety of tools available these days, and some are surely still missing from the list – not everyone has made their software public in the first place. At one end of the spectrum there are hardcore editors running on genuine hardware, and at the other retro art oriented tools aimed at recreating the old look with less regard for authenticity (at times called fakescii). Pick your poison!

edit: More additions, thanks to Goto80 for the tips!

edit2: More details on Pet Shop Pro received from Jambonbill himself.

4 comments March 22nd, 2016

Raspberry Pi 2: hyvät ja huonot uutiset

Lägään tällä hetkellä näiden Raspien kanssa hieman perässä, sillä rupesin vasta testailemaan synttärilahjaksi saamaani 2B-mallia. Jälleen kerran hieman nopeampi kolmonenhan tuli juuri uunista ulos.

Juhlapuheista huolimatta etenkään alkupään Raspeista ei todellakaan ollut työpöytäkäyttöön: muistia oli liian vähän, X:n ja SDL:n kiihdytykset riittämättömiä, ja jo muutenkin hitaan koneen hyydytti viimeistään käyttiksen ajaminen SD-kortilta. Muutaman vuoden aikana ytimiä on tullut kolme lisää, ja kenties vielä tärkeämpänä parannuksena muistin määrä on noussut gigatavuun. Mutta ollaanko vieläkään työpöytäkäyttöön riittävällä tasolla?

Kyllä, ei ja ehkä. Raspi 1:een verrattuna työpöytä pyörii mainiosti, mutta toisaalta hitainkin nykypäivän Intel-pohjainen miniläppäri on edelleen nopeampi. Hitaus ja nopeus ovat pitkälti ohjelmista kiinni: mukana seuraava Web-selain ja LibreOffice ovat aivan käyttökelpoisia, kun taas Java-pohjainen Processing hyytyi varsin ikävästi. Pikaisesti kokeilemani kevyet emulaattorit toimivat sinänsä ok X:n päällä, mutta kiinteän resoluution ja puuttuvan video-overlayn vuoksi niitä ei saanut koko näytölle (resoa voisi toki pudottaa, mutta se on ongelman kiertämistä eikä ratkaisua).

Pahin pullonkaula tuntuu edelleen olevan massamuisti. Siinä missä SSD:istä on tullut päivittäistavaraa isojen koneiden puolella, pikkulaudoissa ollaan edelleen jumissa USB2:n ja muistikorttien maailmassa. Odroideissa nähty eMMC on jonkin verran parempi, mutta jää sittenkin SSD:lle mennen tullen.

Parhaimmillaan Raspit ovat niille erityisesti räätälöityjen softien kanssa: mediatoistimista, emulaattoreista ynnä muista on optimoituja versioita, jotka käyttävät videoskaalaajaa tai OpenGL ES:ää tavanomaisten kirjastojen sijaan. Yllätyin itsekin, kuinka paljon 3D-rauta jaksoi puskea, kun sitä ohjelmoi järkevästi. Ylimääräiset kerrokset, kuten Java ja JavaScript, ovat puolestaan myrkkyä suorituskyvylle.

Monia päivittäisiä asioita voi tehdä jo nykyiselläänkin riittävän sujuvasti, kunhan hyväksyy tietyn ajoittaisen tahmailun. Ainoaksi peeseen korvaajaksi en Raspia edelleenkään laittaisi, enkä usko kolmosenkaan tilannetta merkittävästi muuttavan, varsinkin kun massamuistiväylät eivät ole sen nopeammat. Toisaalta tarkkaan rajatussa yksittäisessä käytössä etenkin tämä uusi Rapsutin voi olla aivan riittävän tehokas ja hinnaltaan kymmenesosa “oikeasta” tietokoneesta. Palataan asiaan taas parin sukupolven päästä.

raspi2

1 comment February 29th, 2016

Dell–Mint–Mate-kombo

Kiitos nimettömän lahjoittajan, sain käsiini kolme käytöstä poistettua, muutaman vuoden ikäistä Dellin bisnesläppäriä, joista kaksi siirtyi jo eteenpäinkin. Kaksi niistä oli mallia E4310 ja viimeisenä trokattu E6410. Kaikissa oli edelleen ihan ajanmukainen i5-prosessori – oikeastaan vain pienet kiintarit, kuolleet akut ja nykymittapuulla vaatimattomat näytöt kertoivat koneiden iästä. Yhteen meni lopulta Windows 7 ja kahteen tietysti tuttu Mint/Mate.

Takavuosina Linux+kannettava oli huono yhdistelmä monestakin syystä: eksoottisille näytönohjaimille ja wlan-piireille ei ollut tukea, virransäästöominaisuudet olivat puutteellisia ja sleeppi toimi, jos toimi. Noista ajoista on kuitenkin tultu ilmeisen kauas, sillä Mint meni heittämällä ineen kaikkiin koneisiin niin 32- kuin 64-bittisenäkin versiona. E6410 kaatuili uhkaavasti asennuksessa, mutta syypääksi paljastuivat hankkimani uudet 1,5 V muistit (blääh!). Olisi pitänyt olla 1,35 V kampoja, mutta onneksi väärät kelpasivat edes Chromebookiin, joka puolestaan luovutti kaksi gigaa takaisinpäin.

En uskaltanut odottaa ihan liikoja, mutta hyvinhän se meni. Kaikki toimii suorilta: näyttis, wlan, hiiripädi, optinen asema, äänet, sleep, erikoisnäppäimet, usb, kamera, mikrofoni ja kortinlukija. Akun varaustaso ja lataustilanne näkyvät automaattisesti alapalkissa, tuuletin pyörii sopivasti ja kernel skaalaa prosessorin kellotaajuutta tarpeen mukaan. VGA:n tai DisplayPortin (vain E6410:ssä) kautta kytketty näyttö tunnistui automaattisesti jne. Yhteen masiinaan laitettu SSD, Kingston HyperX, ei temppuillut sen enempää, vaikkakin pelkän SATA2-ohjaimen takia nopeus saattoi jäädä maksimista. Toimivuutta kohentavat epäilemättä koneiden ikä ja yleisyys. Kokeilematta jäivät toistaiseksi Bluetooth sekä telakkakäyttö – jälkimmäinen ei mene välttämättä aivan näin kivuttomasti.

Vertailun vuoksi toiseen E4310:een asentamani Windows 7 Pro vaati melkoisen määrän taistelua. Geneerinen asennuslevy ei tukenut suoraan juuri mitään laitetta, vaan Dellin sivulta piti latailla parisenkymmentä pakettia hieman summamutikassa. Samanlaisia riemunkiljahduksia aiheuttivat n. 300 käyttöjärjestelmäpäivitystä, joiden äärellä vierähti tuntikausia: etenkin iän kaiken asentuvat .NET-päivitykset jäivät hyvin mieleen. Tässä kohtaa teki mieli kysyä, että kumman näistä käyttiksistä pitikään oleman se “helppo” asennettava. Savotan jäljiltä W7 toimii lopulta ilmeisen ok, vaikka kiintolevyn jatkuva hinkaaminen hieman ihmetyttääkin (onneksi ei ole enää minun ongelmani).

Softapuolesta ei ole juuri erityistä sanottavaa; Mint on Mint. Muutaman vuoden ikäinen i5 jaksaa hyvin toistaa full hd:tä VLC:llä, myös ulkoisella näytöllä. Selaimet, Gimp, LibreOffice, HandBrake, Processing, Audacity, X-Chat, VICE, DOSBox ym. perusohjelmat pyörivät asianmukaisesti, eikä neljän gigan muistikaan tunnu liian vähältä tällaisessa käytössä. Näyttöjen melko vaatimaton tarkkuus (1366×768 ja 1280×800) ja pieni kontrasti asettavat käytölle toki omat puitteensa.

Lopputulema tästä säätöprojektista oli siis varsin positiivinen. Amazonilta löytyi vielä uusia akkujakin, vaikka sadan euron hinta nostaakin projektin kokonaishintaa jo tuntuvasti, samoin kuin SSD. Itselleni jäi lopulta E6410, vaikka E4310:t ovat monessa suhteessa näppärämpiä – etenkin, jos konetta on tarkoitus oikeasti kanniskella mukana. Myös näppäimistön asettelu on hieman parempi E4310:ssä, mutta isompi malli voittaa ainakin liitäntöjen määrässä.

E6410 ja 64-bittinen Mint/Mate

E6410 ja 64-bittinen Mint/Mate

Edit: No eihän ainakaan tässä E6410:ssä edes ole Bluetoothia, joten toimivuutta on sikäli vaikea arvioida.

Edit2: Telakkaa pikaisesti testattu. Voi lykästä koneeseen ihan lennossa ilman mitään komplikaatioita. USB-portit toimivat hyvin ja näyttökin tunnistui display portista oitis. Näytöt ja alapalkit eivät aina sijoitu ihan loogisesti, mutta kyllä ne toimimaan saa pienellä näpläämisellä. Maten alapalkkia voi raahata näytöltä toiselle alt pohjassa.

Add comment August 29th, 2015

Skrolli 1/2015

Skrollin tämän vuoden ensimmäinen numero ilmestyi juuri, ja mukana on taas omaakin tekstiäni: Maisemia Perlin-kohinalla. Kuten nimikin vihjaa, artikkelissa tehdään Processingilla pieni reaaliaikainen 3D-maasto käyttäen Perlin-kohinaa muodon laskentaan. Teron piirtämä takakannen PETSCII-kuva on sekin tutulla edikalla tehty.

grabbi spock

Add comment March 18th, 2015

Arduino, Atari ja joikkari

Virittelin jo aiemmin kasaan Joyduino-projektin, jolla sai emuloitua Atari-joystickiä PC:n näppäimistöltä. Projektissa oli kuitenkin kaksi ongelmaa: kolvaamista vaativa tarpeettoman mutkikas piirikortti ja hieman epämääräinen sarjaportin käsittely omalla ohjelmalla. Kuulin vasta myöhemmin, että Arduinon pinnit saa suljettua laittamalla ne input-moodiin, mikä teki kytkinpiirit tarpeettomiksi. Eli kun virtuaalisen joikkarin kytkintä ei paineta, pinni on sisääntulona ja kun painetaan, niin pinni vaihdetaan ulostuloksi ja laitetaan nollaan. Tältä pohjalta riitti tehdä triviaali johto D9-naarasliittimestä piikkirimaan, joka menee Arduinon headerin pinneihin 8..GND (ylös, nappi, alas, vasen, nappi 2, oikea, maa). Tulitusnappi 2 tässä MSX:n mukainen – muissa laitteissa saattaa olla eri piikissä. Oman C-ohjelman sijasta tein isäntäohjelman tällä kertaa Processingilla, niin se toimii saman tien useilla alustoilla. Arduinoon pitää ensin ladata Firmata, jotta Processing toimii sen kanssa. Firmata ei ole järin nopea, sillä aikaa haaskaantuu yksittäisten pinnien erikseen kääntelyyn ja protokollaan, mutta tässä tapauksessa nopeus oli ihan hyväksyttävä. Omaa, luultavasti pahempaa lägiään tulee Processingin päivitystaajuudesta, mutta sekään ei ollut vielä liikaa. Esimerkki täällä:

http://www.kameli.net/~marq/kode/joikkari.pde

Firmatan lisäksi tarvii asentaa Arduino-tuki Processingille, joten mikään avaimet käteen -ratkaisu tästäkään ei tullut. MSX:n kakkosnapin vahingossa sohimisesta voi seurata ongelmia joillakin koneilla – pinniä saatetaan käyttää muihin tarkoituksiin, joten joikkaportin pinniin 7 ei yleensä kannata kytkeä mitään. Toinen detsku on, että pelikone kannattaa käynnistää tai johto kytkeä vasta ohjelman herättyä, sillä muuten porttiin tulee ei-toivottuja painalluksia. Näppikseltä pelaaminen on jo kohtuullisen hyödyllistä, jos ehjää Atari-joystickiä ei satu olemaan, mutta vielä hyödyllisempi tämä viritelmä olisi vaikkapa joypadin kanssa. Katsotaan, iskeekö inspiraatio sellaisenkin tukemiseen jossain vaiheessa.

edit: Nappi 2 ja vasen menevät tosiaan ristiin piuhassa, koska huomasin vasta jälkikäteen, että MSX:ssä kakkosnappi onkin eri pinnissä. Helppo muuttaa koodista (ja muutenkin järjestys on aika satunnainen).

edit2: Äh, menköön. Tässä se joypad-tuki. Nappien ja kontrollerin nimeä joutunee vaihtamaan, mutta muuten toiminee suorilta: http://www.kameli.net/~marq/kode/joikkari2.pde

Add comment December 9th, 2013

PETSCII (Marq’s PETSCII Editor)

Welcome to the PETSCII page, where you can find out everything you ever wanted to know about the crossplatform PETSCII editor ingeniously called PETSCII. The tool lets you create character-based screens and animations for the Commodore 64, VIC-20, PET and Plus/4 computers. Enjoy!

News

  • 11.2.2024: Fjälldata PETSCIIs right here
  • 10.10.2023: DART 1.2 released with support for creating dirart from .c and .pet files
  • 28.9.2023: The editor turned 10 years old. There’s even cake!
  • 29.7.2023: Vammala Party PETSCIIs here
  • 3.6.2023: X PETSCII entries are starting to appear here
  • 12.2.2023: Quality PETSCII art at Fjälldata.
  • 31.10.2022: The page got a little update with clearer, up to date instructions.
  • 31.10.2022: As you have probably noticed, the latest main release is almost two years old. Some new additions will start appearing in the source version little by little, and to celebrate the 10th anniversary I even dare to promise a new major release for next year.
  • 30.10.2022: Plenty of PETSCII goodness at Zoo’22 in the PETSCII, Zoo kids and the demo compo too. Glad to see the editor put into use!

Usage

It should be straightforward to download and unzip the package (see downloads below), after which you can run the version that corresponds to your operating system of choice: Linux, Mac or Windows. 32-bit binaries are still included, but you may encounter problems with old Windows or Mac OS versions – I can’t support and test each and every one of them.

Use the GUI buttons for saving your work. The native file format is a C array, which is why the file extension should be “.c”. In addition, the automatic backup will create a file called _backup_.c in the program directory every two minutes or so. The Ref. button will load a reference image (png/jpg/gif) that can either be overlaid with the characters or converted to PETSCII.

For showing the piece on a real machine you need to export the picture to a .prg file. At the moment animations can’t be exported as standalone executables. See the keyboard shortcuts below, and in the case of source code exports check the generated file for further instructions. Not all the export options are available for all the target platforms. Optionally, create a d64 image (c1541 is part of VICE):

c1541 -format mypic,0 d64 mypic.d64 -attach mypic.d64 -write image.prg image

There’s also a video tutorial on the basic functions of the editor. See here: https://www.scenesat.com/videoarchive/250b4ced-b90e-11ea-b68e-00505685775e?t=55337

Mouse Buttons

  • left mouse button – draw, select pen color, select char from the selector
  • middle mouse button – char picker, select border color from the selector
  • right mouse button – eraser, select bg color from the selector, lock/unlock frame on timeline, toggle lowercase on char selector
  • mouse wheel – darken or lighten the shade on the Plus/4

Editing Commands

  • C – convert colors to Plus/4 after loading a C64 image (Plus/4 only, not necessary with recent files any more)
  • enter – switch to typing mode, shift-enter for inverted chars
    • Alt (+shift) will let you type graphic characters like on a real machine
    • Color selection and reverse, likewise
    • Ins/Del/Backspace/PageUp/Dn/Home/End work
    • Window managers etc. might reserve some key combinations for their own purposes, so beware
  • esc – exit from typing mode, remove selection
  • f – floodfill (keep it pressed and click), shift-f fills color only
  • h – smart horizontal flip, shift-h at cursor
  • r – smart rotate clockwise, shift-r at cursor
  • space – toggle selection on/off
  • T – convert the reference image to PETSCII – set a suitable background color yourself first. If the reference image has changed, it’ll be reloaded.
  • tab – walk through predefined sets of related characters
  • u – undo
  • U – redo
  • up/down arrow – grow and shrink stick characters
  • v – smart vertical flip, shift-v at cursor
  • x – invert, shift-x inverts at cursor
  • +/- – shift horizontal and vertical stick character one step up/down or right/left
  • ,/. – cycle through bg and border colors
  • § – pick character+color (same as mmb), shift-§ (° or ½) to pick color only

GUI Toggles

  • c – toggle crosshair
  • g – toggle grid
  • i – toggle info display
  • t – cycle through different levels of reference image transparency

Animation Related

  • 1..0 – jump to frame 1..10
  • d – duplicate frame to the left
  • end – jump to last frame
  • home – jump to first frame
  • l – lock/unlock frame from editing
  • left/right – jump one frame

Modifier Keys

  • alt – 1/4 char pixel drawing mode (keep alt pressed)
  • ctrl (command on Macs) – selection mode: drag with lmb pressed to select a region, rmb to select free-form areas, ctrl-a selects the whole image
  • shift (left) – coloring mode, only the color is replaced (keep shift pressed)
  • shift (right) – character-only mode

File Operations

  • a – export file as asm data
  • A – export file as self-contained asm viewer (ACME format)
  • b – export as self-contained BASIC viewer
  • e – export a self-contained PRG that can be run directly
  • E – export a .pet file
  • p – export all frames as PNG images, shift-p includes borders. Note that the clickable button only exports the current frame with borders.
  • q – export as SEQ (C-64 only)
  • s – save (plain C data, the default image format)
  • S – export as self-contained C viewer (cc65 format)

Cheat Sheet

Forgot some keys? Of course you did – even I don’t remember them all. Print out this handy cheat sheet to support your failing memory:

On Macs use the Command key instead of Ctrl.

Settings

You can control some general settings with a file called prefs.txt which should be in the same directory as the actual program. So far the following settings are recognized:

  • ZOOM – editor pixel size. 2 by default. 1 is the minimum and anything beyond 3 might be rather unusable.
  • FRAMERATE – update rate. 60 fps by default. Decrement for less CPU use, increment for better responsiveness. Going above the screen refresh rate might be impossible depending on the platform and system settings.
  • MACHINE – one of C64, VIC20, PET, PETHI, PLUS4, DIRART. Leave empty to get the normal selector at start.
  • ASPECT – aspect ratio on the machines where it counts. One of PAL/NTSC/SQUARE. If not set, default to PAL.
  • PATH – default path for your images. Give a full path like /home/marq/Pictures. No quotation marks.
  • BACKUPFILE – the name and optionally the full path of the backup file. If empty, defaults to the application folder and _backup_.c
  • OFFSET – 0 or 1 to show canvas memory offsets.
  • XSIZE and YSIZE – set a nonstandard canvas size.
  • UNDODEPTH – Increase or decrease the amount of undo steps, 32 by default.
  • TABLET – 1 to use the experimental tablet mode which makes it easier to click UI buttons when using a touchscreen. 0 for normal operation (default).
  • FORCEMETAL – 1 to revert to the Metal UI style regardless of the platform default
  • AWTSELECTOR – 1 to use AWT’s fileselector, 0 to use Swing. Leave empty to use the platform-specific default.
  • DISABLEWHEEL – 1 to disable mouse wheel functionality in case it bugs you
  • CONVERTER – command to run when exporting multiple frames (mostly meant for animated gifs). With ImageMagick use something like this: convert -delay 20 -loop 0 -scale 200%

Assign a new value like this: ZOOM=2. Note that on recent versions of macOS the prefs file might need to be in your home folder, e.g. /Users/marq.

There are some simple command line parameters as well. The parameters override prefs.txt.

  • -c64, -vic20, -pet and so on will let you skip the initial dialog
  • -zoom x sets, eh, the zoom
  • -size x y for non-standard canvas sizes

Protips

  • The selection can be used in several ways: it can be rotated, flipped, or even used for coloring regions (try pressing shift).
  • Rotation, flipping, inverting etc. affect the character under the cursor when shift is pressed.
  • The image -> PETSCII conversion depends on the selected background color, so experiment with multiple options. Three grayscale levels in the source image with bg color set as middle gray seems to work pretty well for photos.
  • As of the latest versions, you can make converting much faster and iterative, as the reference image is reloaded if its timestamp has changed.
  • You can reconvert existing images back to PETSCII as long as the palette is close enough and the dimensions match (320×200 and no borders for C64).
  • PETSCII uses these C64 color values by Pepto, so do the same when working with external programs to ensure a faithful conversion. See m_c64.pde, m_vic20.pde and m_plus4.pde for the RGB values.
  • Shift-mmb will pick just the color instead of character+color
  • Select a pen color and ctrl-click another color on the selector to remap all the chars of the same color. If there’s a selection, only it will be affected.
  • You can delete chars from a selection by clicking the char selector. It’ll leave you holes that don’t affect drawing – useful for example for cutting out “sprites”.
  • Want to make animated gifs? Install ImageMagick command line tools, export as png (press p or P) and then simply:
    convert -resize 200% -loop 0 -delay 10 frames*.png animation.gif
  • There are only a few flicker colors that are steady in large quantities. Don’t use a flicker color for the border or even the bg, small details work better.
  • For making some actual use of the dirart mode, try DART.

Troubleshooting

Trying to create a reliable crossplatform application in Java is tricky business these days. If all else fails I recommend downloading the source-only version and running it straight from Processing version 3.x. Bug reports can be sent to marq [at] iki [dot] fi or alternatively on CSDb.

  • Apple’s so-called security won’t let you run unsigned apps. To make a long story short: go to System PreferencesSecurity & Privacy and allow apps downloaded from anywhere to run.
  • Middle mouse button might not work on all Macs. Use the § key instead to pick a character from the canvas, if your keyboard has one. Border color can be selected by pressing the dot key.
  • With all these Mac woes (and there’s probably more to come) you migth even consider running the editor inside a Linux/Windows virtual machine.
  • Can’t draw and there’s an asterisk (*) next to the frame number? You’ve locked the frame. Press l or right click on the thumbnail (if any).
  • File selector bugs – try setting AWTSELECTOR to 0 or 1. 0 will possibly fix a crashing bug on Linux.
  • Some recent Ubuntu-based distros might complain that they Failed to load module “canberra-gtk-module”. The warning appears to be harmless, but if it bugs you, install the missing package libcanberra-gtk-module using apt or whatever package manager you prefer.
  • Missed mouse clicks with Lenovo TrackPoint or mouse pad? Try fiddling with the typing delay/sensitivity setting.

Download

The compiled binaries + stable source are available right here: http://www.kameli.net/~marq/kode/petscii.zip. Note that you need to have the Java Runtime Environment installed on your system. I’m using JRE 1.8 (Java 8) myself, so that’s probably your safest bet. The tried and tested 2019 (Processing 2) version, not yet much worse featurewise, is still available here for a while in case you have trouble with the latest one or only have an old version of the JRE available.

WIP source-only release for the adventurous: http://www.kameli.net/~marq/kode/petscii-beta.zip or svn://kameli.net/marq/petscii. Revision 872 in the SVN repository is the last one that works on Processing 2. The code can be used according to the terms of the liberal WTFPL license.

Gallery

Some artistic endeavours to give you a glimpse of what’s possible.

In addition to still images there are demos and games where the editor has been put into good use.

Additions and corrections most welcome, as usual.

Acknowledgements

Thanks to Dr. TerrorZ for his artworks, numerous comments and remap tables, Viznut for help with the VIC-20, Six for the SEQ conversion example, BassCadet for bug reports, Groepaz and Deekay for help with dirart, and Rexbeng, Manu, Shine, Electric, Archmage, Hammerfist, Awsm, Redcrab and iLKke for gallery images.

Add comment October 2nd, 2013

PETSCII-edikka

Perjantai-illan hätäinen pikku Processing-projekti rupesi paisumaan ja alkaa olla jo hiljalleen ihan käyttökelpoinen. Tarkoituksena oli tehdä Zoo 2013:n PETSCII-kilpailua varten minimalistinen editori, jolla saisi lätkittyä ruudulle merkkejä väreineen ja sitten näytettyä niitä oikealla kuusnelosella. Mitään kunnollista ei tuntunut löytyvän valmiina Linuxille tai Mäkille, joten tehdään sitten itse. “Feature creep” iski pahasti päälle ja tein yhtä sun toista lisäystä. Tällä hetkellä ohjelma osaa jo seuraavaa:

  • Piirto, kumitus ja väritys
  • Reunuksen ja taustavärin vaihto
  • Merkin poiminta
  • Kuvien lataus ja tallennus
  • Kuvien eksporttaus C-, assembler- ja BASIC-muotoon
  • Simppeli pikselipiirtomoodi 1/4-merkeillä
  • Alueen valinta ja kopiointi/tyhjennys
  • PETSCII:n uudelleenjärjestely helpompaan muotoon
  • Esikatselu venähtäneillä merkeillä ilman gridiä

Katsotaan, kuinka pitkälle into vielä riittää. Kaikenlaista muutakin mahdollista voisi lisäillä loputtomasti, mutta ainakin undo olisi varsin tarpeellinen toiminto. Animaatiota on pyydetty myös, mutta katsotaan nyt. Siinä vaiheessa, kun into loppuu, niin kintaat putoavat välittömästi 🙂

iso-petscii

edit: Niin, jäi linkit laittamatta:

edit2: Tukee nyt myös VIC-20:tä.

edit3: Dokumentaatiota nyt täällä: http://www.kameli.net/marq/?page_id=2717

2 comments September 29th, 2013

10 PRINT”KIRJA-ARVIO”:GOTO 10

Ohjelmistotutkimus (software studies) on verrattain uusi tulokas kulttuurintutkimuksen kentällä. MIT Pressin kirjasarjassa on aiheesta julkaistu jo muutama teos, joista viimeisin on 10 PRINT, tai koko komeudessaan:

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

Koodinpätkän voi kukin kirjoitella Commodore 64:äänsä tai VIC-20:een, ja lopputuloksena pitäisi tulla labyrinttiä muistuttava mutkikas kuvio (ks. lopussa oleva kuva). Lyhykäisesti selitettynä ohjelma tulostaa satunnaisesti joko merkin 205 (kenoviiva) tai 206 (kauttaviiva), joiden interaktiosta syntyy loputtomasti enemmän ja vähemmän aitoja sokkeloita.

Kirja käsitteleekin aihetta sitten kaikkea muuta kuin lyhykäisesti – kansien väliin on saatu 309 sivua erilaisia variantteja ja sivupolkuja. Kirjoittajia on peräti kymmenen ja joukossa joitakin tuttujakin nimiä, kuten monessa tekniikan historian liemessä marinoidut Nick Montfort ja Ian Bogost, sekä Processingin toinen isä Casey Reas. Teosta on työstetty yhteisvoimin Wikissä, joten yksittäisen kirjoittajan panosta on mahdoton arvioida erikseen. Moderniin tyyliin koko kirja on myös ladattavissa pdf-muodossa verkosta sen kotisivuilta.

Lyhyeltä vaikuttavasta ohjelmanpätkästä singotaan moneen suuntaan, kuten labyrintteihin, ruudukon käyttöön kuvataiteessa, satunnaislukuihin, Commodoreen ja BASIC-ohjelmoinnin historiaan, mikä osoittaa ainakin sen, kuinka monimutkaisia kulttuuriset kytkökset ovat. Paljon sivuja on uhrattu onelinerin erilaisille varianteille ja muille alustoille tehdyille porttauksille. Milloin muunnellaan merkkien satunnaisuutta, milloin käytetään eri merkkejä tai toteutetaan samanlainen ohjelma jollakin aivan toisella alustalla, kuten Atari 2600:lla. Jokaisen sivupolun kautta päästään kertomaan jotain uutta laitteista, ohjelmointikielistä ja algoritmeista. Loppupuolella on hieman puuduttavan puolelle venähtänyt luku, jossa pitkien BASIC-esimerkkien kautta ratkotaan sokkelon ohjelmallista läpikäyntiä.

Välillä tuntui siltä, että onpas tässä keksitty nokkela punainen lanka, joka sitoo yhteen monia erilaisia teemoja – välillä taas siltä, että on ollut pakko tehdä tikusta asiaa, kun yhden rivin BASIC-pätkä ei ole kuitenkaan kantanut ihan kolmensadan sivun verran. Ehkä parasta antia itselleni olivat viittaukset taidehistoriaan ja satunnaislukujen merkityksen käsittely. Teknistä ymmärrystä tarvitaan melko paljon, jos kirjan teemoja aikoo oikeasti ymmärtää, vaikka toisaalta tuntuikin siltä, että joissakin yksityiskohdissa on popularisoinnin hengessä oikaistu hieman liikaakin. Summa summarum: mielenkiintoinen avaus, jonka kautta voi hahmottaa ainakin 1980-lukulaista ajattelua; aikaa, jolloin ohjelmointi tuli koteihin ja oli vielä luonteva käyttökohde tietokoneelle.

10print

Add comment April 15th, 2013

Amurisus Amurakis (1917–1983)

Pääsiäisen viihteestä vastasi Revision 2013 Saksan Saarbrückenissä. Revision on käytännössä viimeinen iso kansainvälinen demoparty The Partyn lerpahdettua ja Assemblyn sekä The Gatheringin muututtua pikemminkin pelitapahtumiksi. Aiemmin party tunnettiin nimellä Breakpoint. Noin kauas ei viitsinyt lähteä ilman mitään omaa tuotosta, joten edellisenä iltana, lentokoneessa, bussissa, hotellilla sekä partypaikan aulassa koodattiin ankarasti deadlineen saakka ja hiukan sen ylikin. Lopputuloksena syntyi pitkästä aikaa MSX:lle demo, VJ-henkinen Amurisus. Youtube, Pouet ja msx.orgin hieman apologeettinen uutinen aiheesta.

Tein ensimmäiset MSX-produni vuonna 1997, jolloin työkalut olivat vielä primitiivisiä. Koskaan en ole koodannut itse MSX:llä, vaan heti alusta asti oli käytössä TASM-niminen assembler MS-DOS:n alla. Aivan alussa rämppäsin korppua PC:stä MSX:lle testausta varten, mutta aika nopeasti koko kehitys siirtyi PC-pohjaiseksi, kun fMSX-emulaattori alkoi olla varteenotettava vaihtoehto oikealle koneelle. Edelleenkään ei olla siinä tilanteessa, etteikö lopulta olisi pakko testata myös aidolla koneella, koska etenkin MSX1:n videopiiri on jonkin verran arvaamaton, kun liikutaan sen suorituskyvyn rajoilla. Vuoteen 2008 asti käytössä oli Yzin assemblerilla kirjoittama musiikkirutiini, jossa säveltäminen tapahtui nuotteja käsin datalauseisiin kirjoittamalla.

Tätä nykyä puhtaalla asmilla kirjoittelu olisi jo hieman tuskallisen puolella, vaikka Z80 onkin ykkösnimi perinteisten kasibittisten prosujen joukossa. Onneksi työkalut ovat kehittyneet oleellisesti, joten pääosa koodauksesta tuli tällä erää tehtyä ihan C-kielellä SDCC:n avustamana. Sekaan saa aikakriittisiä osia varten helposti inline-assembleria, joten paljon parempaa yhdistelmää ei voisi juuri toivoa. Ammoisten bat-viritysten sijasta käytössä on kunnollinen Makefile, joka kääntää tarvittavat osat, rakentaa emulaattorille levytiedoston ja käynnistää demon joko OpenMSX:ssä tai Nowindin yli oikealla koneella. Amurisusia tehdessä käytimme ensimmäistä kertaa versionhallintaa: lähdekoodi oli Tampereella sijaitsevassa Subversion-palvelimessa (itse istuimme Saksassa pöydän eri puolilla), mikä säästi reilusti aikaa ja vaivaa jopa näin pienessä projektissa, kun kahden koodarin rinnakkaiset muokkaukset sai yhdistettyä ilman eri sählinkiä. Sivutuotteena syntyi vielä varmuuskopio lähdekoodista. Musiikin sävellykseen on nykyään tekstieditoria helpompia tapoja, etunenässä alun perin Amstrad CPC:tä varten tehty Arkos Tracker. Kasibittikoodauksessa tarpeelliset kuvakonvertterit ja esilaskennat tein Processingilla, mikä säästää sekin vaivaa aiempaan C-kielellä näpyttelyyn verrattuna.

Lopputuloksesta tuli sunnuntain pikku viilailujen jälkeen varsin tyydyttävä. Mitään teknisesti mullistavaa tuossa ajassa ei olisi ehtinyt tehdäkään, mutta onneksi konsepti kantoi ja musasynkka toi ryhtiä muuten sekalaiseen sisältöön. Sijoitus jäi kilpailussa vaatimattomaksi, sillä taso oli varsin kova ja muut produt ilmeisen työllä ja tuskalla väännettyjä. Nykyään demoja tulee tehtyä joka tapauksessa omaksi huviksi, eikä palkinnoilla tai sijoituksella ole enää sanottavaa merkitystä – saatiinpahan kikkare harrastuneen yleisön nähtäväksi. MSX-yhteisöön tällainen happoinen kokeilu ei luultavasti vetoa, sillä demoja tuntevienkin tyyppien viitekehys on yleensä tukevasti 1990-luvun alkupuolen nostalgisissa MSX2-tekeleissä.

Add comment April 1st, 2013

Discovering the Panasonic JR-200U

I had never even seen a Panasonic JR-200U before 2012, but when I did, I became curious. What kind of secrets does this oddball 8-bit contain? This page is a collection of several useful bits and pieces I’ve come across so far. Corrections and additions are most welcome. Some of the findings are correct only for the PAL JR-200UP model, since that’s the only one I have at my disposal. Big thanks to Tero Heikkinen for his contributions!

Pretty much all the information you see on this page is based on disassembling the ROM, individual chips’ data sheets, and simply trying things out. Jeff from Vintage Volts was so helpful as to scan the US version of the Service Manual, which helped to clarify some issues. Grab it here. As there’s better info available now, I’ve removed some inaccurate paragraphs from this page altogether. Do note that there are some differences between the NTSC and the PAL versions, esp. in clock pulse generation and rates, so even the Service Manual isn’t always authoritative.

CPU

The main processor is an MN1800A, a clone of the Motorola MC6802 (which itself is a revision of the MC6800). The most notable difference is that the MN1800A does not have an internal oscillator. The A version of the chip can cope with speeds up to 1.5 MHz, whereas the normal one is limited to 1 MHz. Not much to see here:

  • Two 8-bit accumulators, A and B
  • 16-bit index register, X (IX)
  • 16-bit stack pointer, S (SP)
  • 16-bit program counter, PC
  • Condition code register, CCR

The MC6800 features quite many addressing modes. Among the most interesting ones is the direct mode, which lets you access the first 256 bytes (the zero page) of the RAM quickly. Most of that area is occupied by system and BASIC variables by default.

I’m still trying to solve the actual clock speed of the CPU, as that 0.89 MHz has just been mindlessly repeated here and there. As the display controller divides the NTSC-derived xtal 14.31818 MHz frequency with some probably 2n counter, it’d be natural that the CPU gets something related to that. Indeed, dividing the standard NTSC carrier frequency by four yields 0.894886 MHz.

However, that is not the processor speed. My current guess, based on code run in VRAM, is 1.366 MHz. On the other hand, the frequency doesn’t quite reveal all there is to it, as the speed is normally constrained by the 1-bit DRAM access. As fetching is exceptionally slow, instructions suffer from various penalties, for example:

  • Nop is 2 cycles on paper, but in practice 4 – you can’t do anything in less than four
  • Some one-byte instructions like tsx jump from 4 to 6 cycles
  • But an ldaa offset,x takes full 8 cycles instead of 5
  • Even worse, an ldaa address (extended) crawls at 8 cycles, not its nominal 4
  • A 7-cycle inc offset,x takes 11
  • An ldx address is one of the worst performers, 5->10

Go figure. I’m trying to gain a better understanding of the timings, but as of now it seems kind of random. One of the most exceptional things is that VRAM is 2x as fast as normal memory – kinda logical, though, as it’s 8-bit SRAM unlike the other chips (see below). In practice this means that the most timing critical parts should definitely be stored in VRAM, where instruction timings also match the nominal cycles.

System chips

The following chips can be found on the circuit board:

  • 6914 — dual comparator, used for tape communication
  • HD7416P — hex inverter/driver, amplifies the video signal
  • HD61L204F, surface mounted. HD61K201F on the NTSC model.
    • The display controller (CRTC)
    • Divides clock signals (phi1 and 2) for the CPU and phi2S for the MN1271
    • Address decoder
    • Probably some other yet unknown functions
  • HM4864P-3 — 8k dynamic 1-bit RAM, four chips make 32k altogether
  • HM6116P-3 — 2k static RAM, two of these constitute the 4k VRAM
  • MN1271 — I/O interface, includes the clock and beepers
  • MN1544CJR — 4-bit microprocessor
    • Used for keyboard and joystick I/O
    • Contains 4k of ROM including the system charset, and 128 bytes of RAM.
  • MN1800A — the CPU
  • MN4864CA2 and CB2 — 8k rom chips
  • Several 74LS series logic chips:
    • 74ALS112AN — flip-flop
    • 74LS00 — AND gate
    • 74LS04 — inverter
    • 74LS05 — inverter
    • 74LS08 — AND gate
    • 74LS145 — BCD decoder, between the keyboard and MN1544CJR
    • 74LS245 — octal bus transceiver, on the data bus
    • 74LS367A — 3-state buffer
    • 74S163N — 4-bit counter
    • M74LS00P — NAND gate

Another important part is the 44.336 MHz xtal (X1) under the modulator. On an NTSC machine the same oscillator is 14.31818, so the timings are generated differently. Tero took some high resolution photos of the guts an put them online. Check out the images here.

Graphics

The JR-200 has only one screen resolution, 256×192 pixels with eight colors, but bit 7 of the character color lets you select an additional blocky low-resolution mode for each character position. There’s two kilos of VRAM plus two more for the character bitmaps. Unfortunately, there’s not enough space for two full pages. The text resolution is 32×24 (768 positions) and the bitmap for each 8×8-pixel character can be redefined. The border color can be set separately. Eight colors are available in a typical three-bit GRB format:

  • 0 — black
  • 1 — blue
  • 2 — red
  • 3 — magenta
  • 4 — green
  • 5 — cyan
  • 6 — yellow
  • 7 — white (guess what)

Bits 0–2 of the color table define the fg color of the respective character position, and bits 3–5 the bg color. Bit 6 selects the charset base address, and bit 7 switches the character position in question to lowres mode, where a 8×8 pixel region is split into four 4×4 blocks, effectively yielding a 64×48 resolution where each pixel can be set individually. The upper half gets its colors from the character position table, and the other half from the color table. When bit 6 is zero, the character bitmaps are read from $D000. Value 1 sets the base address to $C000, which is rather inconvenient, since it overlaps with the character positions and colormap, except at two locations: $C000–$C0FF and $C400–$C4FF. Thus, characters 0–31 and 128–159 can be relocated without overlaps, yielding 320 different possible characters (256+32+32).

So far it’s unknown whether there’s any exact way to sync to the screen refresh. There’s no VBI, and judging by the existing games, there’s no way to read the refresh phase easily. Luckily, the timer can be reprogrammed to serve as a VBI. For an exact 50 Hz PAL sync the values are 3414 for three frames and then 3413 for one. Screen refresh can be — to a certain extent — followed by reading the memory addresses starting from $CA00, which return the last attribute shown on the screen or just some bus traffic in the borders. The timing is a bit tricky, but by drawing a suitable pattern and setting the clock according to that it’s possible to create a usable VBI.

This shiny new routine takes a while to calibrate but is about two row exact: vbinew2.s. The calibration might fail under some rare conditions, when other unrelated bus values happen to match the needed colors. Couldn’t break it with 30 consecutive test runs, but I’ve seen it happen. For the sake of completeness, here’s the old coarse and less reliable version that starts quicker: vbi.s.

Another, more robust solution would require a minimal hardware mod involving a piece of wire that connects the VSYNC signal to for example the user interrupt or just some pin of the printer/expansion port. So far I haven’t tried that, as the software method works well enough on a PAL machine at least.

The graphical capabilities of the Spectrum computers aren’t that far from the Panasonic and there are truckloads of great pictures available, so I wrote a little converter in Processing to turn 256×192 images into something you can display on the JR-200. This directory contains some converted images — apologies if your hard work was ruined in the process 🙂 320 blocks aren’t usually enough to reproduce the original exactly. Run them like this:

mload:a=usr($1000)

Sound and timers

According to Wikipedia and Old-Computers.com there should be three separate square wave channels capable of five octaves. JR-100, on the other hand, only had a simple one-channel beeper. MESS source code implies that JR-200 might contain a good old PSG, AY-3-8910, but on the circuit board there’s no such thing to be found. Some experimenting and ROM disassembly finally revealed the sad state of affairs: there is no sound chip. Instead, it’s the clock and I/O chip, MN1271, that produces the beeps.

MN1271 contains two 16-bit timers (E and F) plus four 8-bit counters (A–D):

  • A controls serial communications speed
  • B is the obscure “bpm timer” (can’t really figure out much use for this)
  • E is used as the system clock and generates an IRQ every 0.1 seconds by default
  • C, D and F are connected to the speaker and used for square wave generation

That’s three sound channels, but C and D can only produce a narrow range of different frequencies, being 8-bit. No noise, volume settings, envelopes or filters, just three square waves out of which two are very limited. With low frequencies the output starts to look more like saw wave, since the level fades towards zero.

Each timer has a control byte and an 8-bit or 16-bit counter. The three lowest control bits must contain 6 in order to keep the timer running. Any other value will stop the timer (just speculating here that there are probably some unknown pulse counter and edge triggered modes). The higher bits define other important parameters (see below). Under normal conditions the control byte of E contains $4E. The beeper timers’ control byte depends on the octave that is being played back or zero if the channel is off. All the timers can generate an IRQ, so in that sense E is not special at all. Known control bits so far:

  • 7 — not used (?)
  • 6 — interrupt on counter zero if 1
  • 5 — not used (?)
  • 4..3 — divisor selection. 00 = 1, 01 = 8, 10 = 64, 11 = 256. They correspond to OR values 0,$8,$10 and $18 .
  • 2..0 — Timer runs if 110 (6), stops otherwise

To reprogram the timer speed all that is needed is a new counter value. My best guess on the base frequency at the moment is 1.366 MHz, which you divide by the desired divisor and frequency to get the counter value. According to the Service Manual the frequency is 1.34 MHz for an NTSC machine, but as the timings seem to be quite cursory in it anyway, I wouldn’t trust that number much. Note that 1 is the smallest possible value, since 0 is considered to be 256. For 16-bit counters poke the hi byte and then the lo byte to their respective addresses. See the memory map below for the memory locations of each timer. For square waves you need to divide by 2*frequency, since a full wave requires two changes. Here’s a list of the closest 16-bit counter values for notes using divisor 8: jr200notes.txt (might be revised later).

Since there were apparently no existing tools for creating music I spent one weekend writing a little music converter and a player routine that let you convert XM tunes to Panasonic beeps. The composer needs to be aware of the harsh limitations imposed both by the simple routine and the less-than-stellar sound chip, but at least this is a bit easier than typing hex into assembler data statements. Without further ado, go ahead and download Musagi.

Keyboard and joysticks

The keyboard and joysticks are connected to the MN1544, which checks their status and interrupts the main CPU when there’s activity. Normally the system doesn’t read the joysticks at all, just the keyboard (see memory map below for the locations of the related buffers). The last keypress can be read from $C801, but it’s not enough for games, since you can’t tell whether the key is still pressed or not. Even the BASIC interpreter features a function called STICK, which lets you read the keyboard and joysticks as directly as possible. From assembly the same subroutine can be called at $E8CB (slowjoy.s). It’s still impossible to read whether a particular key is pressed or not, but at least the joysticks work perfectly.

The biggest problem with the approach is that it takes about 1/4th of a frame to complete the call, since the subroutine needs to wait for three interrupts coming from the 1544. Communication with the 1544 is kind of hairy business, but luckily the joysticks can be read fast by first setting the correct mode, doing something useful while the three interrupts take place, and reading the result only then (fastjoy.s).

It’s still unknown whether the current status of an individual key can be read at all. Probably not, and even if yes, it would be unusably slow with all the interrupts involved. The keyboard matrix and operation are explained in some detail in the Service Manual, pages 52–55.

It turns out that the joystick ports are identical to those of the MSX: there’s +5V and strobe on the same pins. What that could mean is that an MSX mouse could theoretically work on the Pana, depending on the implementation of the MN1544 keyboard reading code. I’m a bit skeptical, though, as the standard joyport functions are so slow, plus they might not let you control the strobe pin correctly.

Expansion bus

The mapping of the expansion port pins can be found on page 62 of the Service Manual. Some random notes:

  1. Signals such as vma, r/w and phi2 are inverted along the way, so they follow a different logic than the CPU
  2. Phi2s is meant for dividing memory access between the CPU and the video controller. If you output at the wrong moment the screen will flicker.
  3. The !kill signal disables the BASIC ROM at $A000..$BFFF
  4. Data pins are buffered through IC3
  5. Pins A19 and B19 are +5V, but don’t seem to be able to supply a lot of current. Better consider an external PSU for your extensions.

The printer port or the CNIO header found near the TV modulator would be other easy options for moving data about, as they are directly connected to parallel ports of the MN1271. See the memory map below. However, they won’t allow for an autobooting ROM, unlike the expansion port.

Memory map

First a general view (click to see full size). A similar chart is available on the Operation Instructions, page 51 and the Service Manual page 20.

pana-mem

Know addresses in more detail:

  • $0000–$7FFF: 32k RAM
    • $0000: key click (0 off, $40 on)
    • $0001, $0002, $0003: direct keyboard and joystick call data area
    • $0004: 8-bit 0.1 second down counter
    • $0005: 8-bit 0.1 second down counter running from 10 to 1
    • $0006: 16-bit one second down counter
    • $000D: unhandled keypress counter, used for other communication with 1544 too
    • $002B: tape load speed (0 = 2400 bps, 1 = 600 bps)
    • $002C: tempo, 109 by default
    • $002D, $002E, $002F: PLAY note duration counters
    • $0030, $0032, $0034: PLAY note buffer pointers
    • $0036, $0039: tempo counters
    • User-provided interrupt handler addresses. $0000 if not used.
      • $0100: NMI
      • $0102: sw interrupt
      • $0104: IRQ
    • User hook addresses
      • $0106: unknown hook
      • $0108: unknown hook
      • $010A: unknown hook
      • $010C: timer hook, runs every 0.1 seconds
      • $010E: one second timer hook
    • $0114: transfer buffer from 1544 (?)
    • $0116: 16-bit keyboard buffer pointer
    • $0150: keyboard circular buffer of 32 bytes, alternatively keyboard data for STICK(0)
    • $0151: joystick data for STICK(1)
    • $0152: joystick data for STICK(2)
    • $07FF: default stack
    • $0800: start address of BASIC programs
  • $8000–$9FFF: not used
  • $A000–$BFFF: 8k BASIC ROM
  • Video RAM
    • $C000–$C7FF: alternative character bitmap (overlaps with other tables)
    • $C100–$C3FF: character positions
    • $C500–$C7FF: character colors
    • $D000–$D7FF: character bitmaps
  • $C800–$CFFF: Memory-mapped I/O
    • MN1271 I/O interface
      • $C800: parallel port A control, normally 0
      • $C801: parallel port A data, used for keyboard reading. The code is already ASCII.
      • $C802: parallel port B control. Bit 0 enables the keyboard interrupt.
      • $C803: parallel port B data, used for issuing commands to the MN1544 and for misc purposes. Bit 6 controls the keyboard beep.
      • $C804: parallel port C control
      • $C805: parallel port C data, the printer port
      • $C806: parallel port D control, used for tape communication
      • $C807: parallel port D data. Bit 6 controls tape relay (write). Loud enough negative sound signal turns bit 7 on (read). The rest go to the CNIO header.
      • $C808/9: parallel port I control/data — unconfirmed
      • $C80A: used for keyboard ACK, read after the keyboard port
      • $C80B/C/D: unknown, most likely serial stull
    • Timers (part of the MN1271)
      • $C80E: timer A control (serial timing) — unconfirmed
      • $C80F: timer A counter, 8-bit — unconfirmed
      • $C810: tempo timer (B) control, contains $59. Doesn’t work quite like the other timers.
      • $C811: tempo timer (B) counter, in bpm
      • $C812: timer C (beeper) control
      • $C813: timer C counter, 8-bit
      • $C814: timer D (beeper) control
      • $C815: timer D counter, 8-bit
      • $C816: timer E (system clock) control
      • $C817: timer E counter hi, default $41
      • $C818: timer E counter lo, default $8A
      • $C819: timer F (beeper) control
      • $C81A: timer F counter hi
      • $C81B: timer F counter lo
    • Interrupt control (part of the MN1271)
      • $C81C: interrupt status register 1 (read). Bit 0 = keyboard.
      • $C81D: interrupt status register 2 (read). Bit 4 = timer, bit 1 = tempo timer.
      • $C81E: interrupt mask register 1. Bits as above, default value 1.
      • $C81F: interrupt mask register 2. Bits as above, default value $12.
    • I/O area wraps to the beginning every 32 bytes until $C9FF
    • $CA00: border color — in fact any address up to $CBFF works the same
    • When read, the addresses starting from $CA00 return the last attribute displayed on the screen and some unknown values while in the border area (just the bus traffic?).
  • $D800–$DFFF: cartridge region
    • If there’s a long jump (opcode $7E) at $D800, then the OS ROM jumps there after initializing the system. If not, it jumps to BASIC at $A000.
  • $E000–$FFFF: 8k OS ROM
    • Interrupt handlers
      • $E6E4: reset handler
      • $E790: NMI handler
      • $E7DC: software interrupt handler
      • $E7E2: IRQ handler
    • $E892: idle loop
    • $E8CB: direct keyboard and joystick call. Return values stored at $0001, $0002 and $0003.
    • $FED8: error messages
    • $FFA4: startup text
    • 16-bit interrupt vectors
      • $FFF8: IRQ
      • $FFFA: software interrupt
      • $FFFC: NMI, triggered when break is pressed
      • $FFFE: reset vector
      • Note that the vectors are in ROM and, therefore, can’t be directly changed. Use the optional handlers and hooks starting from $0100.

Still missing quite a lot of relevant stuff and details.

File transfer and creation

I don’t know if the floppy drive was ever sold outside of Japan. “Disk BASIC” is mentioned on the Service Manual, but even so practically nobody owns it, so we’re stuck with cassettes. A very typical approach these days is to emulate a tape drive by playing back sound files from a modern host computer to the cassette port. For an in-depth description of the tape format and the associated CJR emulator files check the Old Machinery blog (see below). Credits go to Tero Heikkinen for documenting the format. My tools for dealing with CJR files:

  • bin2cjr.c — converts binary files to CJR
  • cjr2wav.c — converts CJRs to audio files that can be played back to the cassette port. Seems to work with 2400 bps files only.
  • cjrinfo.c — displays all relevant info such as the file type, block numbers, lengths and addresses

When loading your own programs do something like this on the Pana:

mload:a=usr($1000)

Raw wav files tend to be a bit on the big side — a tiny 7k CJR turns into a 2 MB wav with the above converter. Gzipping the wav makes it way smaller, just 55k. Lossy formats, such as mp3, might distort the waveform too much, but at least 128kbit files seemed to work just fine. The file size decreased to 763k, but the resulting mp3 can’t be effectively compressed any longer. YMMV.

Here’s my LZSS compressor and a 6800 machine language decompressor routine for your enjoyment. Together they constitute PanaZ, a simple exe packer that can be used with your plain binary files before turning them into CJRs. See the zip file for further instructions.

Panana 1.0

As there are no realistic emulators available as of now, it’d be mandatory to easily test own programs on a real machine. Beeping the program in through the cassette port gets you started but, honestly, it’s too slow: it takes around a minute and a half to transfer a binary file of a mere 20 kilobytes. Moreover, you need to type the loading commands all the time. To overcome those irritating limitations, I developed an Arduino-based “coder’s cable” with and autobooting ROM that contains the transfer slave. First, here’s some work-in-progress shots for your enjoyment:

viritys pannaani1 lodju

The circuit board in the middle isn’t the final version, so don’t use it as a reference. With the latest improvements I’ve reached transfer speeds up to 8k/s – a whopping 30x speed increase compared to the cassette port. In other words, you can fill the memory up in four seconds. After some final improvements Panana seems to be stable even with a trashy Chinese Arduino Nano clone. There are still several shortcomings, such as the lack of support for multipart or BASIC CJR files (needed for games), but as those are not needed for software development, I’ve had little interest in implementing them at least as of now. Another detail I’m not awfully happy about is the huge 128k EPROM chip that takes a lot of space and is almost empty. Got them really cheap, you see.

And then the schematics. Note that !reset is only needed with a Leonardo or a Micro, as they don’t reset automatically when receiving serial input. On the other hand, it very much improved reliability with the trashy Chinese Nano clone that I used.

panana-fixed

Download the required software here: panana-1.0.zip. Inside the zip you will encounter:

  • host – File transfer software C sources. Meant for Unix-like systems with termios, such as Linux or Mac OS X. For other platforms you need to modify the parts that access the serial port.
  • jr200 – The ROM for the JR-200. The source can be compiled with CRASM.
  • arduino – The sketch that needs to be uploaded to the Arduino. Tested with an Uno and a Nano clone, but should work fine on other similar boards. Leonardo and Micro will need a reset wire (see above) as they don’t reset themselves when receiving serial traffic. Duemilanove should be fine as is.
  • gal – The equation for the GAL in .eqn format. Can be recompiled to .jed with eqn2jed.

As you can see, this is no turn-key solution, so you may experience hiccups and, all in all, need to have a positive and proactive attitude to get anywhere with it 🙂 It’d be awesome to turn Panana into a real PCB one day, but let’s see if I ever get that far.

When you boot the JR-200 with the Panana and a USB cable connected, you should see letter P in the top right corner. The file transfer host controls whether the CJR will be started automatically or not. If not, after the transfer the machine will jump automatically to BASIC. Other characters you might see are E for error or a heart denoting a succesfully completed operation.

8k SRAM memory  expansion

Something evident on the memory map is that it should be rather straightforward to extend the memory to 40k through the expansion port. Even 48k could be possible, since you can disable the BASIC ROM through the port. I gave it a go one beautiful Saturday and indeed, it is easy to add that 8k by wiring the address and data lines plus some more from the expansion port to a SRAM chip. Three highest bits of the address need to be decoded, too, which is a good job for a GAL.

panamem panamem

A bit lousy schematic it is, but at least it works. Here’s the function needed for the GAL16V8. Compile to .jed with the usual eqn2jed.

CHIP GALLI 16V8

i0=1 i1=2 i2=3 phi2s=4 rw=5 vma=6 a15=7 a14=8 a13=9 gnd=10
i3=11 we=12 oe=13 o0=14 o1=15 o2=16 o3=17 o4=18 o5=19 vcc=20

EQUATIONS

/we = a15 * !a14 * !a13 * !vma * rw * !phi2s
/oe = a15 * !a14 * !a13 * !vma * !rw * !phi2s

The BASIC doesn’t recognize the extra 8k, but you can mload and run code there without problems. Even a timing critical IRQ handler worked just fine. The prototype could be extended to 16k with an optional BASIC on/off switch, or even to several megabytes by introducing a banking scheme of some sort. As my target is the standard machine, such an extension isn’t a priority.

Reset button

A memory-preserving reset button can be useful for a developer, cracker or a cheating gamer, too. Based on p. 29 of the Service Manual it was easy to make a – hopefully – safe reset button. You could ground the processor /HALT pin directly, but this one is safer, as the signal goes through two inverters and there’s a capacitor to filter the noise caused by lousy buttons (like mine). See here:

resetti

First find the capacitor and diode (D1) at the top right corner of the mobo. Solder a wire to the back leg of the diode, add a button and connect the other leg of the button to the ground. For example the screws holding the mobo in place are grounded, so you can wrap the wire under one of them.

Software

There’s not much to talk about, I’m afraid 🙂 I’ll update this section when I’ve taken a closer look at the games that came with the Virtual Panasonic emulator. Here’s some PAL/200UP stuff by my group Fit:

Run with mload:a=usr($1000). Any contributions would be most welcome; just sample the cassette contents and send the files to me. Those rare Disney games would be an interesting find.

Sources

Add comment January 25th, 2012

Next Posts Previous Posts


Kommenttien virta

Aiheet