Kursiva (Italic Character Set)

Type
Utility
Category
Character-set utility
Published in
Flop (Czech disk magazine for 8-bit Atari), issue 7
Language
Atari BASIC (with machine-language DATA)
Requirements
Any 8-bit Atari with 48K or more and Atari BASIC (uses RAM at $7C00–$7FFF)
Atari text screen listing the program, all characters slanted in italics

About the program

Kursiva is Czech for "italics", and that's all this little routine does, very neatly. It copies the 1K ROM character set into RAM at $7C00 (page 124). On the way it shifts the bottom half of every character one pixel to the left, so all text leans to the right. It then points the OS at the new font. Everything you type afterwards, including the READY prompt and your listings, appears in italics. It was published on the Czech disk magazine Flop 7.

Typing it in

Seven short lines of plain ASCII. The 55 values in lines 30002–30006 are the machine code. They are poked into the string KUR$ and run with USR(ADR(KUR$)), so you can tack lines 20–30006 onto any program of your own. Check the numbers carefully: one wrong value can lock up the machine.

How to use it

RUN it. The program stops straight away with the screen already in italics. Press RESET (or type POKE 756,224) to get the normal font back. Line 30 sets CHBAS (756) to 124, and RESET puts back the ROM font.

How it works

The routine sets up two pointers in page zero, $CB/$CC for the source (the ROM font at $E000) and $CD/$CE for the destination ($7C00). Then it copies four pages, 1,024 bytes, one byte at a time. For each byte it looks at which row of the character it is (Y AND 7). Rows 0–3, the top half, are copied unchanged. Rows 4–7 are shifted one bit to the left with the top bit carried round to the bottom (ASL, then add the carry back in). On the screen, bit 7 is the leftmost pixel, so the lower half of each glyph moves one pixel left, and that gives the italic slant.

Gotchas

  • $7C00 is simply assumed to be free. That's true for a small program on a 48K or 64K machine, where the GRAPHICS 0 screen sits higher up, but a big BASIC program or a 16K/32K machine will overwrite or lack that memory. To make it safe, lower RAMTOP first (POKE 106,PEEK(106)-4:GRAPHICS 0), then change the 124 in lines 30002 and 30 to the new PEEK(106).
  • Characters whose pixels touch the left edge (such as [ and some graphics characters) have those pixels wrapped round to the right edge.

Variations to try

Slant more steeply by shifting rows 2–3 one pixel and rows 4–7 two pixels. Or shift right instead (LSR/ROR) to lean the text the other way.

Listing

10 GOSUB 30000
20 AA=USR(ADR(KUR$))
30 POKE 756,124:END
30000 DIM KUR$(55):RESTORE 30002:FOR I=1 TO 55:READ A:KUR$(I,I)=CHR$(A):NEXT I:RETURN
30002 DATA 104,169,0,133,203,133,205,169,124,133,206,169,224,133,204,162,0,160,0,177,203,145,205,133,207,152
30004 DATA 41,7,201,4,144,10,165,207,10,144,3,24,105,1,145,205,200,208,230,230,204,230,206,232,224,4
30006 DATA 208,219,96

Credits