******************************************************************************** * Index for the code examples * ******************************************************************************** Unless mentioned otherwise, all code is provided as FREEWARE (not Public Domain) and is Copyright (c) Tony G. Papadimitriou <tonyp@acm.org> All code is primarily meant to be examples of programming in Assembly Language using the (possibly unique & non-portable) features found in the specific assemblers mentioned below. When I say 'examples' I do NOT mean useless incomplete code. If all required #INCLUDE files are present, you'll get a clean assembly. Much of this code is used in real-world applications. Each file may contain code within one or more #IFMAIN .. #ENDIF blocks. This is not going to be included in your apps. It's only meant to demonstrate how to use the various library functions, and to give a clean compilation of the file if assembled stand-alone. (This makes it easier to test under a simulator, and for certain modules, even on a real MCU.) Note: You can 'grab' code by doing CTRL-A/CTRL-C while viewing the related page, then doing a paste (CTRL-V) into your favorite code editor. (Formatting should be maintained but colors may be lost, depending on the editor used, and its related configuration.) Disclaimer: All code assembles correctly using the latest version of the related MCU assembler, and has been tested and found to work without problems. Nevertheless, correct operation is NOT guaranteed, and no warranty is assumed under any conditions, or for any purpose. ******************************************************************************** Freescale 68HC08/9S08 CPU (Assembly Language - Latest ASM8 assembler) [Assembler can be downloaded from www.aspisys.com/asm8.htm] -------------------------------------------------------------------------------- (All 9S08-based routines have been written so they can be placed in either normal or MMU paged memory without any changes in the source code.) MCU selector (for GB60,QE8,QE32,QE128,QG8,QT4,QT4A,QY4,QD4,QD2,DZ32,DZ60,FL16,SH8,PA16,PA32) Definitions for 9S08DZ32 MCU Definitions for 9S08DZ60 MCU Definitions for 9S08QD2 MCU Definitions for 9S08QD4 MCU Definitions for 68HC08QT4A MCU Definitions for 9S08QG8 MCU Definitions for 9S08SH8 MCU Definitions for 9S08FL16 MCU Definitions for 9S08PA16 MCU Definitions for 9S08PA32 MCU Definitions for 9S08QE8 MCU Definitions for 9S08QE32 MCU Definitions for 9S08QE128 MCU Definitions for 9S08GB60 MCU Common definitions for all HC[S]08 MCUs Macro examples (part 1) Macro examples (part 2) Macro examples (part 3) Macro for DZx and compatibles COP sequence Macro for PAx and compatibles COP sequence Macro examples for (NESTED) FOR & IF Macro examples for constant date functions Tiny bootloader that reads S19 files directly. No PC app needed. Supports MMU (e.g., QE128) Print variable-size (upto 256-byte long) ints Print 8-bit/16-bit integers 8x8-bit signed multiply Big (variable-size) multiplication Divide stacked 16-bit word by RegX Stack-based re-entrant (RPN-style) 16|24|32|40|48|56|64-bit int math (Listing of previous one w/ all bit versions combined, and macros expanded) Wrapper for 16-bit stack-based int math (e.g, use with #Uses stkmth16.sub) Wrapper for 24-bit stack-based int math (e.g, use with #Uses stkmth24.sub) Wrapper for 32-bit stack-based int math (e.g, use with #Uses stkmth32.sub) Wrapper for 40-bit stack-based int math (e.g, use with #Uses stkmth40.sub) Wrapper for 48-bit stack-based int math (e.g, use with #Uses stkmth48.sub) Wrapper for 56-bit stack-based int math (e.g, use with #Uses stkmth56.sub) Wrapper for 64-bit stack-based int math (e.g, use with #Uses stkmth64.sub) Macros to print a string/expression mix in a single statement like in a HLL Convert (YY)YYMMDD to Julian and back 32-Bit multiply by Greek PI (~355/113) Replace substring(s) to another inside a string (ASCIZ) Some basic string-related functions Insert character into string Get length of string Get length of string to a specific character or end-of-string Pad a string on the left side with spaces for certain length Added decimal point at so many places in a string Load any data to stack Copy block from source to destination CRC calculation BCD to binary conversion Hard delay RegA msec (any bus, dynamic) Hard delay 1 msec (any bus, fixed) Hard delay 10 msec (any bus, fixed) Change character case to upper/lower Save/Load default configuration Flash routines for 9S08 MCUs (GB, QG, QE, etc.) Long jump (leap) to any MMU address Read a text line (with or w/out echo) Get length of ASCIZ string Delete range of chars in ASCIZ string by index and length Trim multiple spaces in ASCIZ string General variable mask-based BSET/BCLR BRSET example [hardcoded parm passing using macro/subroutine combination] Macro example for simple coroutine switching Macros for CCR[V] set (SEV), clear (CLV), branch (BVC & BVS) ******************************************************************************** Freescale 68HC11 CPU (Assembly Language - Latest ASM11 assembler) [Assembler can be downloaded from www.aspisys.com/asm11.htm] -------------------------------------------------------------------------------- MCU selector (for F1 Board, etc.) Definitions for the ASPiSYS F1 Board Common definitions for all 68HC11 MCUs Macro examples Print 8-bit/16-bit integers Big (variable-size) Multiplication Wrapper for 16-bit stack-based int math (e.g, use with #Uses stkmth16.sub) Wrapper for 32-bit stack-based int math (e.g, use with #Uses stkmth32.sub) Stack-based re-entrant (RPN-style) 16|32-bit integer math CRC calculation Hard delay RegD msec (any bus, dynamic) Swap nibbles in RegA EEPROM programming routine(s) Change character case to upper/lower Get length of ASCIZ string General variable mask-based BSET/BCLR (Third party but modified to assemble using ASM11) -------------------------------------------------- Buffalo v3.4 BASIC11 Interpreter ******************************************************************************** Miscellaneous -------------------------------------------------------------------------------- Lua 5.2.3 program to display the ASCII table AWK program to extract assembly language source macros 5x7 font for ASM8/ASM11 (sideways for KS0108-compatible GLCD) JBug11 instructions and overlay for use with the ASPiSYS F1 Board