MEET THE 68000Will the ST 16-bit chip kill BASIC and assembler?
by JACK POWELL Antic Technical Editor
There's a new kid on the block. He's bigger,
brighter, more sophisticated, and a whole lot faster. His name is 68000
and he speaks in new tongues. There are those who say he could be death
to assembly language and BASIC.
The new Atari ST computers will contain the Motorola MC68000 microprocessor chip. Introduced in 1979, it was the first 16-bit microprocessor to have 32-bit internal architecture with 16-byte, non-segmented direct memory addressing, which means you can potentially access 16,777,216 bytes. That's over5,500 pages of single-spaced typing. For programmers used to Atari's old 6502 chip, it's a whole new ball game.
Most Atari programmers started with the BASIC that came with their machines. Many grew tired of its limitations, and evolved to the powerful, highly precise world of machine language.
Some argue this pattern will change with the new STs.
Jeffrey Gortatowsky, writing on the Compuserve Atari SIG, says the pattern of this evolution was caused by the design and memory limitations of the 6502. If you want to write effective speedy software for a computer that has only 64K memory available, you must use assembly language. The code produced by high-level language takes up too much memory and, on the 6502, is usually not fast enough.
Gortatowsky then argues that, in the 68000, we will see the beginnings of change. The chip architecture is so flexible and fast, and the addressable memory so vast, that high-level language will become the practical choice of software manufacturers because time-consuming, costly assembly language will no longer be necessary. In addition, private owners may find that any form of BASIC which takes advantage of this chip's power is going to be cumbersome and difficult.
This theory is echoed in the fine reference book, 68000 Assembly language Programming, by Kane, Hawkins & Leventhal (Osborne/McGraw-Hill, Berkeley, CA, 1981). "We expect the future will favor high-level languages."
As chips and hardware become cheaper and more powerful, the theory goes, the cost of programming labor is rising. This helps explain the shift to efficient high-level languages for program development. These languages can also permit standardization of software development between machines.
A case can also be made that successful research in high-level structured languages is lagging behind hardware breakthroughs-which means that dramatic improvements in features such as ease of use are somewhat overdue and might be expected to happen reasonably soon.
Until then, it is not surprising that professional program developers are specifically being told by Atari to use C or Pascal on the STs.
There are two forms of C currently available for the Atari. Deep Blue C, which can be ordered from the Antic catalog, and C/65which you can get from Optimized Systems Software. Because of the Atari computers' current memory limitations, neither of these C versions are full implementations of the language. They should, however, serve as good training for those who wish to learn C.
The new ACTION! language, also from O.S.S. is a cross between C and Pascal. It's fun to program with and would also be an excellent training ground for those interested in learning structured programming.
In the computer world outside Atari, C is rapidly becoming more and more popular among home programmers. Does this mean BASIC is on the ropes? Not really.
A choice of BASIC or Logo-in versions designed by Digital Research who created the GEM operating environment used by the ST-will be bundled with the first ST machines. And there is such an established, wide base of BASIC programmers, it's doubtful the language will disappear.
New BASICs are likely to appear which will take advantage of extra memory and all sorts of easily-used new commands will be added. The original structure of the language, however, probably will remain the same.
And what about assembly language? We think memory-efficient AL will be as necessary and popular on the STs as on the earlier Ataris. Unlimited memory is not really available. The 68000 microprocessor may be capable of addressing 16 mega-bytes of memory, but, of the two announced ST models, the 130ST ($399) will contain only 128K of RAM and the top-line 520ST ($599) will have 512K.
On the IBM PC the highly touted Symphony, written in a high-level language, requires 340K just for starters. Framework, also - written in a high-level language, will operate (barely) in 256K on the IBM PC- but its tutorial disk will not!
Atari says the new STs have non-expandable memory. We suspect it won't be long before some imaginative third-party manufacturer figures out a way to plug more memory into the "non-expandable" STs. But meanwhile if a software developer wants to market a program that will run on both ST models, assembly language may be the only viable solution.
A consideration not taken into account in all this is the pure satisfaction that assembly language programmers get from programming at the nitty gritty level. We're no longer talking about the practical, economic business approach, but the home hacker who wants to roll up his sleeves and get to know every board, chip and register in that machine. He does not want to be limited by someone else's idea of what the processor can do. If he wants a high-level language, he writes a high-level language.
For those 6502 hackers, we offer the following preview to whet your ST appetite. And this is simply an hors d'oeuvre. Further details and definitions must be saved for later articles. If you can't wait, we recommend you pick up the previously mentioned 68000 Assembly language Programming, or The 68000: Principles and Programming, by Leo J. Scanlon, Howard W. Sams & Co., Inc.
There are two operating modes in the 68000: User and Supervisor. Certain instructions in supervisor mode are not available in user mode. The supervisor mode is a protection against operator misuse, in sophisticated, multitasking systems. It should be interesting to see what Atari does with the supervisor mode.
Other niceties include built-in debugging aids, traps against illegal addressing and illegal instructions, a one-step trace mode, and seven levels of vectored interrupts. Most of these are only available from the supervisory mode.
Although the 68000 has a 16-bit data bus, meaning that 2 bytes of information can be accessed in one machine cycle, internally it can operate on five different types of data: bits, 4-bit binary coded decimal (BCD), 8-bit bytes (B), 16-bit words (W), and 32-bit long words (L). Because of this, byte data may be addressed at even or odd addresses, but words and long words must be addressed at even addresses. For example, three bytes in a row could fall at addresses $0004, $0005 and $0006, three words at $0004, $0006, $0008, and three long words at $0004, $0008, $000C.
The 68000 has 56 instructions and 14 addressing modes. This is very similar to the 6502. But there are 17 general-purpose 32-bit registers. Eight are considered data registers, seven are address registers, one is the stack pointer and the last is the program counter.
All of the data registers are general purpose and can be used as index registers or counters. They can handle bytes, words, and long words. The address registers are primarily designed to hold addresses, but can be used as index registers. Unlike the data registers, they cannot handle 8-bit bytes.
The stack pointer can also be used as a general purpose address register. It is actually two registers and will contain different data depending upon whether you are in supervisor or user operating mode.
The last 32-bit register is the program counter and, although it is a 32-bit register, only 23 of the bits are used. Since instructions consist of words instead of bytes, the counter can access a range of 8M words, or 16,777,216 bytes. 6502 programmers will feel like a gnat in the Houston Astrodome.
The last register in the 68000 is the 16-bit status register, which is divided into two 8-bit bytes. The lower 8 bits are for the user mode and the upper 8 for the supervisor. Not all available bits are used. The user flag bits are:
0 C Carry
1 V Overflow
2 Z Zero
3 N Negative
4 X Extend
Supervisor status flag bits 8 through 9 are used in various combinations to signal interrupt priority for the seven levels of interrupt. The 13th bit switches the modes between supervisor and user, and the 15th bit places the 68000 in trace mode. Bits 11,12 and 14 are unused.
As stated above, there are fourteen addressing modes:
1. Data register direct
2. Address register direct
3. Register indirect
4. Register indirect with post-increment
5. Register indirect with pre-decrement
6. Register indirect with displacement
7. Register indirect with index
8. Absolute short
9. Absolute long
10. PC relative with displacement
11. PC relative with index
13. Quick Immediate
14. Implied register
Given the number of registers and data types, the flexibility of register use, and the amount of indirection indicated in the address modes, there is incredible power available in the 68000.
Table 1 is a chart of the 68000 instruction set mnemonics with brief definitions.
Some instructions will be familiar to 6502 programmers, but many will be completely alien. There are no LDAs or STAs for example, because the 68000 is not accumulator bound. There is the remarkable MOVE which will move anything from anywhere to anywhere else.
Programming syntax for the 68000 on currently available assemblers is identical to popular 6502 assemblers, in that each line consists of:
Line number (Label) Mnemonic (Operand) (Comment)
The mnemonic field, however, may contain a three, four or five letter mnemonic, and instructions can occupy from one to five words in memory.
O BRAVE NEW WORLD
We hope this article has generated more questions than answers. Atari owners have been waiting a long time for The New Machine. It's here at last. I, for one, can't wait to get my hands on it.
68000 Assembly Language Programming
by Kane, Hawkins & Leventhal
2600 Tenth Street
Berkeley, CA 94710
The 68000: Principles and Programming
by Leo J. Scanion
Howard W. Sams & Co.
4300 West 62nd Street
Indianapolis, IN 46268
ABCD Add Decimal with
AND Logical AND
ASL Arithmetic Shift Left
ASR Arithmetic Shift Right Branch Conditionally
BCHG Bit Test and Change
BCLR Bit Test and Clear
BRA Branch Always
BSET Bit Test and Set
BSR Branch to Subroutine
BTST Bit Test
CHK Check Register Against Bounds
CLR Clear Operand
DBcc Test Cond, Decrement and Branch
DIVS Signed Divide
DIVU Unsigned Divide
EOR Exclusive OR
EXG Exchange Registers
EXT Sign Extend
JSR Jump to Subroutine
LEA Load Effective Address
LINK Link Stack
LSL Logical Shift Left
LSR Logical Shift Right
MOVEM Move Multiple Registers
MOVEP Move Peripheral Data
MULS Signed Multiply
MULU Unsigned Multiply
NBCD Negate Decimal with Extend
NOP No Operation
NOT One's Complement
OR Logical OR
PEA Push Effective Address
RESET Reset External Devices
ROL Rotate Left without Extend
ROR Rotate Right without Extend
ROXL Rotate Left with Extend
ROXR Rotate Right with Extend
RTE Return from Exception
RTR Return and Restore
RTS Return from Subroutine
SBCD Subtract Decimal with Extend
Scc Set Conditional
SWAP Swap Data Register Halves
TAS Test and Set Operand
TRAPV Trap on Overflow