pcs/sasm.mac

564 lines
9.3 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

; =====> SASM.MAC
;***************************************
;* TIPC Scheme '84 Assembler Macros *
;* (C) Copyright 1984,1984 by Texas *
;* Instruments Incorporated. *
;* All rights reserved. *
;* *
;* Date Written: 14 May 1984 *
;* Last Modification: 1 April 1985 *
;***************************************
; Register equates
R0 equ 0
R1 equ 4
R2 equ 8
R3 equ 12
R4 equ 16
R5 equ 20
R6 equ 24
R7 equ 28
R8 equ 32
R9 equ 36
R10 equ 40
R11 equ 44
R12 equ 48
R13 equ 52
R14 equ 56
R15 equ 60
R16 equ 64
R17 equ 68
R18 equ 72
R19 equ 76
R20 equ 80
R21 equ 84
R22 equ 88
R23 equ 92
R24 equ 96
R25 equ 100
R26 equ 104
R27 equ 108
R28 equ 112
R29 equ 116
R30 equ 120
R31 equ 124
R32 equ 128
R33 equ 132
R34 equ 136
R35 equ 140
R36 equ 144
R37 equ 148
R38 equ 152
R39 equ 156
R40 equ 160
R41 equ 164
R42 equ 168
R43 equ 172
R44 equ 176
R45 equ 180
R46 equ 184
R47 equ 188
R48 equ 192
R49 equ 196
R50 equ 200
R51 equ 204
R52 equ 208
R53 equ 212
R54 equ 216
R55 equ 220
R56 equ 224
R57 equ 228
R58 equ 232
R59 equ 236
R60 equ 240
R61 equ 244
R62 equ 248
R63 equ 252
; Instruction macros
COPY_ macro dest,src
db 0,dest,src
endm
LD_CON_ macro dest,numb
db 1,dest,numb
endm
LD_IMM_ macro dest,val
db 2,dest,val
endm
LD_NIL_ macro dest
db 3,dest
endm
LD_LCL_ macro dest,entry
db 4,dest,entry
endm
LD_GLOBAL_ macro dest,src
db 7,dest,src
endm
LD_FLUID_ macro dest,src ; load fluid
db 8,dest,src
endm
LD_S_ macro dest,src,off
temp_ld = offset off
temp_ld = temp_ld/3
db 9,dest,src,temp_ld
endm
LD_L_ macro dest,src,off
temp_ld = offset off
temp_ld = temp_ld/3
db 10,dest,src
dw temp_ld
endm
LD_R_ macro dest,src,off
db 11,dest,src,off
endm
LD_GL_R_ macro dest,src
db 27,dest,src
endm
BIND_FL_ macro const,src ; bind fluid variable
db 29,const,src
endm
DEFINE_ macro dest,const
db 31,dest,const
endm
DEF_ENV_ macro sym,val,env
db 220,sym,val,env
endm
CLOSE_ macro dest,lbl,nargs
local x
db 60,dest
dw lbl-x
db nargs
x equ $
endm
LD_FL_R_ macro dest,src ; load fluid from symbol in register
db 63,dest,src ; temporary instruction?
endm
LD_CAR_ macro dest,src
db 64,dest,src
endm
LD_CDR_ macro dest,src
db 65,dest,src
endm
LD_CAAR_ macro dest,src
db 66,dest,src
endm
LD_CADR_ macro dest,src
db 67,dest,src
endm
LD_CDAR_ macro dest,src
db 68,dest,src
endm
LD_CDDR_ macro dest,src
db 69,dest,src
endm
LD_CAAAR_ macro dest,src
db 70,dest,src
endm
LD_CAADR_ macro dest,src
db 71,dest,src
endm
LD_CADAR_ macro dest,src
db 72,dest,src
endm
LD_CADDR_ macro dest,src
db 73,dest,src
endm
LD_CDAAR_ macro dest,src
db 74,dest,src
endm
LD_CDADR_ macro dest,src
db 75,dest,src
endm
LD_CDDAR_ macro dest,src
db 76,dest,src
endm
LD_CDDDR_ macro dest,src
db 77,dest,src
endm
LD_CADDDR_ macro dest,src
db 78,dest,src
endm
CONS_ macro dest,car,cdr
db 79,dest,car,cdr
endm
SETCAR_ macro dest,src
db 20,dest,src
endm
SETCDR_ macro dest,src
db 21,dest,src
endm
ST_S_ macro dest,src,off
db 17,dest,src,offset off
endm
ST_L_ macro dest,src,off
db 18,dest,src
dw offset off
endm
ST_R_ macro dest,src,off
db 19,dest,src,off
endm
SETREF_ macro val,ref
db 22,val,ref
endm
JMP_S_ macro label
db 32,label-$-1
endm
JMP_L_ macro label
db 33
dw label-$-2
endm
JNIL_S_ macro reg,label
db 34,reg,label-$-1
endm
JNIL_L_ macro reg,label
db 35,reg
dw label-$-2
endm
JNNIL_S_ macro reg,label
db 36,reg,label-$-1
endm
JNNIL_L_ macro reg,label
db 37,reg
dw label-$-2
endm
JATOM_S_ macro reg,label
db 38,reg,label-$-1
endm
JATOM_L_ macro reg,label
db 39,reg
dw label-$-2
endm
JNATOM_S_ macro reg,label
db 40,reg,label-$-1
endm
JNATOM_L_ macro reg,label
db 41,reg
dw label-$-2
endm
DEREF_ macro dest ; (deref x)
db 46,dest
endm
REF_ macro dest ; (ref x)
db 47,dest
endm
CALL_ macro label,dl_lvl,dl_heap
db 48
dw label-$-4
db dl_lvl,dl_heap
endm
CALL_TR_ macro label,dl_lvl,dl_heap
db 49
dw label-$-4
db dl_lvl,dl_heap
endm
CALL_CC_ macro label,dl_lvl,dl_heap
db 50
dw label-$-4
db dl_lvl,dl_heap
endm
CALL_CT_ macro label,dl_lvl,dl_heap
db 51
dw label-$-4
db dl_lvl,dl_heap
endm
CALL_CL_ macro reg,nargs
db 52,reg,nargs
endm
CLOSURP_ macro dest ; (closure? obj)
db 129,dest
endm
FLUID_P_ macro dest ; (fluid-bound? obj)
db 134,dest
endm
STRINGP_ macro dest ; (string? obj)
db 143,dest
endm
SYMBOLP_ macro dest ; (symbol? obj)
db 144,dest
endm
MINUS_ macro dest ; (minus n)
db 151,dest
endm
A_S_ macro dest ; (ascii->symbol n)
db 160,dest
endm
S_A_ macro dest ; (symbol->ascii sym)
db 161,dest
endm
ADD_ macro dest,src
db 80,dest,src
endm
ADDI_ macro dest,imm
db 81,dest,imm
endm
SUB_ macro dest,src
db 82,dest,src
endm
MUL_ macro dest,src
db 83,dest,src
endm
MULI_ macro dest,imm
db 84,dest,imm
endm
DIV_ macro dest,src
db 85,dest,src
endm
DIVI_ macro dest,imm
db 86,dest,imm
endm
MOD_ macro dest,src
db 88,dest,src
endm
JEQ_S_ macro reg1,reg2,label
db 42,reg1,reg2,label-$-1
endm
JEQ_L_ macro reg1,reg2,label
db 43,reg1,reg2
dw label-$-2
endm
JNEQ_S_ macro reg1,reg2,label
db 44,reg1,reg2,label-$-1
endm
JNEQ_L_ macro reg1,reg2,label
db 45,reg1,reg2
dw label-$-2
endm
EQ_ macro n1,n2
db 94,n1,n2
endm
NE_ macro n1,n2
db 97,n1,n2
endm
LT_ macro n1,n2
db 92,n1,n2
endm
GT_ macro n1,n2
db 95,n1,n2
endm
LE_ macro n1,n2
db 93,n1,n2
endm
GE_ macro n1,n2
db 96,n1,n2
endm
EQ_Z_ macro dest ; (=0 n)
db 146,dest
endm
LT_Z_ macro dest ; (<0 n)
db 147,dest
endm
GT_Z_ macro dest ; (>0 n)
db 148,dest
endm
ABS_ macro dest ; (abs n)
db 149,dest
endm
FLOOR_ macro dest ; (floor n)
db 152,dest
endm
FLOAT_ macro dest ; (float n)
db 150,dest
endm
GENSYM_ macro dest ; (gensym sym)
db 162,dest
endm
EXPLODE_ macro dest ; (explode sym)
db 163,dest
endm
IMPLODE_ macro dest ; (implode list)
db 164,dest
endm
LENGTH_ macro dest ; (length list)
db 165,dest
endm
LAST_PR_ macro dest ; (last-pair list)
db 166,dest
endm
POP_ macro dest
db 24,dest
endm
PUSH_ macro dest
db 25,dest
endm
DROP_ macro count
db 26,count
endm
EXECUTE_ macro code
db 58,code
endm
EXIT_ macro ; restore (return from call)
db 59
endm
APPLY_ macro ftn,arg ; apply funtion to args
db 56,ftn,arg
endm
APPLYTR_ macro ftn,arg ; apply funtion to args-tail recursive
db 57,ftn,arg
endm
CB_ALLOC_ macro dest ; allocate code block
db 172,dest
endm
ST_CONST_ macro src,cb,offset ; store constant
db 173,src,cb,offset
endm
ST_BYTE_ macro src,cb,offset ; store code byte
db 174,src,cb,offset
endm
OPEN_ macro file,mode ; open I/O port
db 176,file,mode
endm
CLOSEP_ macro file ; close I/O port
db 177,file
endm
PRIN1_ macro dest,port ; print s-expression
db 178,dest,port
endm
PRINC_ macro dest,port ; print s-expression
db 179,dest,port
endm
PRINT_ macro dest,port ; print s-expression
db 180,dest,port
endm
NEWLINE_ macro port ; print newline
db 181,port
endm
READ_ macro dest ; read s-expression
db 182,dest
endm
FASL_ macro dest ; fast load
db 191,dest
endm
HALT_ macro ; return to MS-DOS
db 248
endm
GC_ macro ; garbage collect
db 249
endm
PTIME_ macro ; display current time
db 250
endm
S_RESET_ macro ; scheme-reset
db 252
endm
CLR_REG_ macro ; clear registers
db 253
endm
DEBUG_ macro ; begin debug mode
db 255
endm