How To?

How can I use the high byte of a word value?

This function is most often needed with immediate addressing mode and some data generating directives. The SB-Assembler knows 4 special symbols to select the byte you want to use from a 32 bit value. Other assemblers may use the keyword LOW or HIGH to select between lower and upper byte of a word. I've also seen things like H(VALUE). The SB-Assembler doesn't support these, mainly for consistency across the different cross overlays.

I want my program to start at address $8000, but my Eprom Programmer expects the ROM code to start at address $0000

Doing it the old way (version 2 and 3):
Use the .OR $0000 directive to specify the ROM address and then use .PH $8000 to specify the real starting address of your code.

Doing it the new way (Version 3 only):
Use .OR $8000 directive to specify the starting address of your code. Then use .TA $0000 directive to specify the target address in your ROM file.

How do I put the reset and interrupt vectors at the end of memory?

You can safely use the .NO directive to point to the beginning of the vector space.
This will even work with unformatted target files because all skipped bytes will be filled. Please remember that the use of the .OR directive would cause some problems because unformatted files will be closed. It would also terminate the .PH mode you probably started (see above) or reset the .TA to the same value as the program counter.

I only get empty binary or Hex files

Binary and plain Hex files are so called unformatted files, which means that they do not contain any other information than the bytes of your code. This means that there is no address field on each line, nor is there a byte count or checksum available.
For this reason I had to decide that the .OR directive must close these 2 file types. Please specify the start address of your program before opening a BIN or HEX type target file.

As from software version 2.07 this behaviour has been improved. It is now allowed to start an unformatted file first and then specify the .OR address, but only if the target file is still empty!

I'm trying to send the object file directly to the COM port, but I get an error that looks like Write fault error writing device COM1

This is an error message produced by MS-DOS (or the DOS box in Windows), complaining that the communication with the COM port has failed. Please press the a to abort.
This error is caused by the handshaking lines of the COM port. In order to be able to send something down the COM port the CTS input and the DSR input have to be active. Your programming device is not connected, or uses only the RxD and TxD lines to communicate.

You can solve this problem by connecting the signals RTS to CTS and DTR to DSR on the computer's COM port. On a 9-pin D-connector you should connect the pins 7 and 8 together and the pins 4 and 6 together. After this small modification to the cable it should work.

I try to assemble a file intended for a different assembler and get many error messages.

Remember that directives are named differently in the SB-Assembler ( .XX ) and probably require different parameters or parameter syntax.
Multiple parameters on a line may only be separated from each other by commas, not by commas and spaces (applies to version 2 only). In fact spaces are not allowed in the parameter field unless they belong to a literal string.
You forgot to load the appropriate .CRoss overlay.
The SB-Assembler may use different radix notations than other assemblers.

I want to create a software library. How do I do that?

The SB-Assembler doesn't have library features, but can handle libraries with a little trick. Define your library routines as separate Macros stored in one or more include files. Include the include files in your main source file. Call only the required Macros to insert the routines you need in your project. You can use Macro parameters to adapt I/O addresses and memory usage.

How do I locate errors

Every time the SB-Assembler encounters an error it will beep and lists the line containing the error. But if you have a longer program and a fast computer there is hardly any time to see those errors.
There are two things you can do:

  • Switch the listing off. Normally it is not necessary to see the whole listing fly by every time you assemble a program. Simply place the directive .LI OFF at the beginning of the program to switch off the whole listing.
    Now only lines containing the errors will be listed.
  • Send all errors to a special file with the .EF directive.
    This way all errors are collected in one file which can be viewed when the assembler is done. All errors will also be displayed on the screen. This methods is best used if your program contains many errors.

How do I write Apple // binary files?

I explain this at the end of the page for the .TF directive.