|
General Information Specific Instructions Terminal Use |
#comment #include .echo .org |
Examples in this readme are going to be written in z80-assembly, as this is the intended target. Though, with other table files, other architectures are certainly possible.
Label: ld a,30 ret ;With labels, you can use this syntax: Label2: ld a,25 \ retAlso permitted is the non-colon terminated line label.
label xor a ld (ram_loc),a ret ;Like above, the following is acceptable: label2 inc a ld (ram_loc+1),a ret
The operators available are as follows: * / - + % ^ & | << >>
ld a,10*15 ;= 150 multiply ld b,254/12 ;= 12 integer divide (it truncates) ld c,10-30 ;= -20 subtract ld d,-(10-23) ;= 13 negate ld e,10+10 ;= 20 addition ld h,10^3 ;= 9 bitwise exclusive or ld l,17 & 1 ;= 1 bitwise and .db 10 | 5 ;= 15 bitwise or .dw 1<<4 ;= 16 arithmetic left shift ld hl,16>>4 ;= 1 arithmetic right shift ;Example of order of operations: ld hl,25*256+10 ;h = 25, l = 10 ld hl,10+25*256 ;h = 250,l = 0 ld hl,10+(25*256) ;h = 25, l = 10
#define on_emulator #ifdef on_emulator push de pop ix #else ld ixl,e ld ixh,d #endif
#define value 56 #define other_value value+10 ;Defines like these can be used in the #IF preprocess: #if other_value > value .dw other_value #else .dw value #endif
#define my_modulo(base, mod) (base - (base*(base/mod))) #define llo(val) (val & $FF) .db llo( my_modulo(10,3)) .db my_modulo(10,3)
label: ld hl,20 ld a,20 ;20's for everyone!
#comment This is a block comment. Woohoo. #endcomment
Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\assembly>dir 03/20/2006 03:19 AM 52,000 assembler.exe 03/23/2006 03:04 PM 4,000 assemblyfile.asm 03/20/2006 03:19 AM 23,080 tasm80.tab C:\assembly>assembler assemblyfile.asm -T
Spencer's Assembler, March 2006 Beginning assembly ... Pass 1 ... Done. Pass 2 ... Done.
C:\assembly>dir 03/20/2006 03:19 AM 52,000 assembler.exe 03/23/2006 03:04 PM 4,000 assemblyfile.asm 03/23/2006 03:09 PM 900 assemblyfile.bin 03/23/2006 03:09 PM 4,800 assemblyfile.lst 03/20/2006 03:19 AM 23,080 tasm80.tab