Assembly Language

David Schmenk Releases PLASMA Assembler for Apple ][

David Schmenk has released his new Proto Language ASsembler for Apple or PLASMA for short.   This latest language release is the second for the creator of Java for the Apple ][.

According to the introduction on David’s website, “PLASMA is a combination of virtual machine and assembler/compiler matched closely to the 6502 architecture.  It is an attempt to satisfy a few challenges surrounding code size, efficient execution, small runtime and fast just-in-time compilation.  By architecting a unique bytecode that maps nearly one-to-one to the higher level representation, the compiler/assembler can be very simple and execute quickly on the Apple II for a self-hosted environment.  A modular approach provides for incremental development and code reuse.  Different projects have led to the architecture of PLASMA, most notably Apple Pascal, FORTH, and my own Java VM for the 6502, VM02. Each has tried to map a generic VM to the 6502 with varying levels of success.  Apple Pascal, based on the USCD Pascal using the p-code interpreter, was a very powerful system and ran fast enough on the Apple II to be interactive but didn’t win any speed contests. FORTH was the poster child for efficiency and obtuse syntax. Commonly referred to as a write only language, it was difficult to come up to speed as a developer, especially when using other’s code. My own project in creating a Java VM for the Apple II uncovered the folly of shoehorning a large system into something never intended to run 32 bit applications.

You can find a complete breakdown of the assembler and implementations in it at:

http://schmenk.is-a-geek.com/PLASMA.html

Code to Disk Tool for the Apple ][ Now Available

Egan Ford, the curator of the Apple ][ Game Server and the Apple ][ Disk Server, has come up with a new application which writes games directly to a disk allowing them to be played, without DOS or ProDOS on the Apple ][.  According to his posting on Comp.sys.apple2 usenet group, "I just posted c2d (code to disk) to http://asciiexpress.net/files.  I included the source with OS/X and Windows binaries.  c2d will take a single binary (with or without 4-byte DOS header) or a text monitor listing and create a bootable diskette (dsk) image."

This tool makes the Apple ][ game server files even more useful allowing users to create a fast booting disk or disk image for emulators.

usage:  c2d [-vh?] c2d [-m]   input[.mon],[load_address] output.dsk

-h|? this help
-m jump to monitor after booting
-v print version number and exit

input without a .mon extension is assumed to be a binary with a 4 byte header. If the header is missing then you must append ,load_address to the binary input filename, e.g. filename,800.  The load address will be read as hex. input with a .mon extension expected input format:

0800: A2 FF 9A 20 8C 02 20 4F
0808: 03 4C 00 FF 20 9E 02 A9

Examples:

c2d hello hello.dsk
c2d hello.mon hello.dsk
c2d hello,800 hello.dsk
c2d -m test,300 test.dsk

A sample session using the c2d tool:

$ c2d air_cars,6000 air.dsk

Reading air_cars, type BINARY, start: $6000, length: 8192

Number of sectors:    32
Sector page range:    $60 – $7F
After boot, jump to:  $6000

Writing air_cars to T:01/S:00 – T:02/S:15 on air.dsk

$ c2d moon.patrol,801 moon.dsk

Reading moon.patrol, type BINARY, start: $0801, length: 18460

Number of sectors:    73
Sector page range:    $08 – $50
After boot, jump to:  $0801

Writing moon.patrol to T:01/S:00 – T:05/S:08 on moon.dsk

To download the c2d tool and the source code, go to the AsciiExpress website at:

http://asciiexpress.net/files/

or download it directly at:

http://asciiexpress.net/files/c2d-0.1.zip

Apple ][ Game Server Upgraded to V0.2

Egan Ford and Michael Mahon did a good bit of collaboration this week to effect the upgrading of the Apple ][ Game Server. The Apple ][ Game Server allows users to load games straight from the Internet onto their real Apple ][ computers via the cassette port and the audio port of their PC.

The HIFI files have been sped up from 12kHz/6kHz 8000 bps to 12kHz/8kHz 9600 bps. LOFI continues to operate at the cassette interface default of 2kHz/1kHz (and yes, you could write them to cassette tape and load that way).  File checking has also been upgraded on the server with a new and faster checksum and file length check. This eliminated the older CRC type checksum verification.

Egan also mentions that some files (e.g. Raster Blaster) which loaded below address $0800 were suffering an issue with the load process. This has been corrected in the latest version of the server.

With over 200 games on the server, this will keep the Apple ][ fan busy for a good long while, reliving the nostalgia that goes with loading a program via cassette on a real Apple ][ computer.

To access the Apple ][ Game Server website, go to:
http://asciiexpress.net/gameserver

For a video of the Apple ][ Game Server in action, check out this video:

 

8-Bit Merlin IDE version 2.59 Source now documented and available

WIlli Kuche has documented the Merlin Macro Assembler IDE Source code and made it available for download.   Merlin, which was written by Glen Bredon at Southwestern Data Systems, was available for download for the past two years, however, the version that was available was without documentation and  without instructions for building the IDE.

Now after a long effort by Willi, the IDE is documented, and according to Willi’s note left on CSA2, “it contains all the source files needed to generate version 2.59, but no others, plus step by step instructions to assemble the four primary source files, to bind together the four generated object files and to compare the newly generated “MERLIN.SYSTEM” against the original. “

You can download the complete source code for Version 2.59 of the 8-Bit version of Merlin at:

ftp://public.asimov.net/pub/apple_II/images/programming/assembler/merlin/VALIDATE.PO

Mr. Fixit Source Released for Apple ][ Prosel

After a request by Willi Kuche, the Apple ][ community came together and managed to come up with two versions of the source code for Glen Bredon’s Mr. Fixit for Prosel 8.  Being as no original source code was available, two people in particular disassembled the program and have posted their respective versions to the internet.

Antoine Vignau of Brutal Deluxe Software posted his Merlin based version of the source code at:

http://www.brutaldeluxe.fr/public/mrfixit/

Willi Kuche also decided to create a version as well, however, his version is Kyan Assembler based.  The version he has created also goes a bit more in depth in the comments than the Merlin based version, according to notes in the CSA2.  No download link has been provided for the Kyan Assembler based source yet, however we have contacted the author for the information.

For those interested in other Glen Bredon materials, you can check out the complete Glen Bredon archives at

http://www.apple2.org.za/gswv/USA2WUG/Glen.Bredon.In.Memoriam/

The only items not in the archives are the items related to the Big Mac assembler which is distributed by A.P.P.L.E.

Don Lancaster releases Apple II Books for Free

Don Lancaster, Curator of the Guru’s Lair website and  author of several Apple ][ releated books including A.P.P.L.E.'s Call-A.P.P.L.E. In Depth Books 4, All About Applewriter, has made a number of his Apple ][ books available in PDF for free download.  The current books he has released are the Apple Assembly Cookbook, Book 1 and Book 2, as well as a number of others.

You can find all of Don’s currently released books at:

http://www.tinaja.com/ebksamp1.asp

Write-A.P.P.L.E.


Dear Call-A.P.P.L.E.

I am writing to say I am very impressed with the Call-A.P.P.L.E. newsletter.  It is not only informative, it is also very useful, particularly the section dealing with the System Monitor and Mini-Assembler, since I am especially Interested in Assembly Language.  How about making an Assembly Language Tutorial tape.  Also, how would I go about getting a copy of the listing for Integer BASIC?

Linda Egan

6471 E. Nixon Street

Lakewood, CA 90713

 

 

Dear Linda,

if you had made a killing in the stock market, me might be able to get that listing for you.  Seriously, that is one very closely guarded secret.  And we are looking into the possibility of an Assembly Language Tutorial.

–Editor

Apple ][ Mini Assembler

The following section covers use of the Apple II mini-assembler only. It is not a course in assembly language programming. The following section assumes the user has a working knowledge of 6502 programming and mnemonics. The Apple II mini-assembler is a programming aid aimed at reducing the amount of time requir.ed to convert a handwritten program to object code. The mini-assembler is basically a look-up table for opcodes. With it, you can type mnemonics with their absolute addresses, and the assembler will convert it to the correct object code and store it in memory.

Typing “F666G” will put the user in mini-assembler mode. While in this mode, any line typed in will be interpreted as an assembly language instruction, assembled, anctstored in binary form unless the first character on th’e command line is a “$”.

If it is, the remainder of the line will be interpreted as a normal monitor command, executed, and control returned to assembler mode. To get out of the assembler mode, reset ml1st be pushed. If the first character on the line is blank, the assembled instruction will be stored starting at the address immediately following the previously assembled instruction.

If the first character is nonblank (and not “$”). the line is assumed to contain an assembly language instruction preceded by the instruction address (a hex number followed by a “:”1. In either case. the instruction will be retyped over the line just entered in disassembler format to provide a visual check of what has been assembled. The counter that keeps track of where the next instruction will be stored is the pseudo PC (Pro~ram Counter) and it can be changed by many monitor commands (eg .• ·L·. ‘T’ •.. .1. Therefore. it is advisable to use the explicit instruction address mode after every monitor command and. of course, when the mini-assembler is first entered.

Errors (unrecognized mnemonic, illegal format, etc.l are Signalled by a “beep” and a carrot (“-”) will be printed beneath the last character read from the input line by the mini-assembler. The mnemonics and formats accepted by the mini-assembler are the same as those listed by the 6502 Programmers Manual, with the following exceptions and differences:

1. All imbedded blanks are ignored. except inside addresses.

2. All addresses typed in are assumed to be in hex (rather than decimal or symbolic). A preceding “$” (Indicating hex rather than decimal or symbolic) is therefore optional. except that it should not precede the instruction address.

3. Instructions that operate on the accumulator have a blank operand field instead of “A”.

4. When entering a branch instruction, following the branch mnemonic should be the target of the branch. If the destination address is not known at the time the instruction is entered. simply enter an address that is in the neighborhood, and later re-enter the branch instruction with the correct target address. NOTE: If a branch target is specified that is out of range. the mini-assembler will flag the address as being in error.

5. The operand field of an instruction can only be followed by a comment field. which starts with a semi-colon (“;”1. Obviously. the mini-assembler ignores the field and in fact will type over it when the line is typed over in disassemblerformat. This “feature” is included only to be compatible with future upgrades including input sources other than the keyboard.

6. Any page zero references will generate page zero instruction formats if such a mode exists. There is no way to force a page zero address to be.two bytes. even if the address has leading zeros.

In general, to specify an addressing type. simply enter it as it would be listed in the disassembly. For information on the disassembler. see Apple II System Monitor in the previous section. A complete listing of the mini-assembler appears at the end of this section. An example of the mini-assembler appears below. Note that the second “BRK” has no space before it hence Apple refused the input. sounded the bell and typed a “‘” underneath the “R”. In “LDA3B45″, Apple also refused the instruction because “R” is not a legal hex digit. Remember to hit the “RESET” key to get out of the mini-assembler.

*F666G
!0: INX
0000- E8 INX
! TXA
0001- ·8A TXA
! JSR £FDED
0002- 20 ED FD JSR $FDED
! JMP $0
0005- 4C 00 00 JMP $0000
! BRK
0008- 00 BRK
! BRK

! BRK
0009- 00 BRK
! LDA 3B45

 

Key Clicker Routine

If you have a newer Apple with the silent keyboard, Don Williams has written a short and sweet machine language routine to solve your problem.

0300:  48              PHA
0301 : A9 20        LDA #$20
0303: 8D 30 CO   STA $C030
0306: 20 A8 FC    JSR $FCA8
0309: 8D 30 CO   STA $C030
030C: 68              PLA
030D: 4C 1B FD   JMP $FDIB
0038: 00 03

Once you store the address ($0300) in location $38 and hit return, your keys will click merrily away until you hit reset. To restart the routine, reenter the address.

•A minor modification of this routine will give you a slow list (with tones) feature. Change the JMP and 030D to FOFD and store the address in $36. The value stored at $0302 may be increased for a slower list.

Loadable Program Follows:

————START OF LISTING———–

0300: 48 A9 20 8D 30 C0 20 A8

0307: FC 8D 30 C0 68 4C 1B FD

0038: 00 03

—————END OF LISTING

Assembly Language Classes

The Assembly Language classes are now scheduled to start June 1 at Empire Electronics. Cost $35 per persorn including Synertek manual. To sign up, call Tom Geer at (206)244-5200 or Don Williams at (206)242-6807. The course includes Number Systems, Boolean Algebra, 6502 Instruction set and Programming.