home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Developer CD v1.2
/
amidev_cd_12.iso
/
devcon
/
milan_1991
/
devcon91.3
/
debug
/
debugger
/
s
/
wack
/
wack.macros
< prev
Wrap
Text File
|
1992-09-01
|
2KB
|
91 lines
;wack.macros V1.5
;byte peek
(macro @b
(>> (@ (arg 1)) 8)
)
;byte poke
(macro :=b
(local i)
(= i (@ (arg 1)))
(:= (arg 1)
(or (<< (and (arg 2) ff) 8)
(and i ff)))
)
;long peek
(macro @l
(or (<< (@ (arg 1)) #16)
(@ (+ (arg 1) 2)))
)
;long poke
(macro :=l
(:= (arg 1) (>> (arg 2) #16))
(:= (+ (arg 1) 2) (arg 2))
)
;long poke, return previous contents
(macro @=l
(or
(<< (@= (arg 1) (>> (arg 2) #16)) #16)
(@= (+ (arg 1) 2) (arg 2)))
)
;compare two strings
(macro strcmp (local i str1 str2)
(= str1 (arg 1))
(= str2 (arg 2))
(for (= i 0) (and (== (@b str1) (@b str2)) (!= (@b str1) 0))
((= str1 (+ str1 1)) (= str2 (+ str2 1))))
(return (or (@b str1) (@b str2)))
)
;put string at address
(macro puts (local str addr)
(= str (arg 1 "Enter string? "))
(= addr (arg 2 "Enter address? "))
(while (!= (@b str) 0)
(
(:=b addr (@b str))
(= str (+ str 1))
(= addr (+ addr 1))
))
)
;print a signed BYTE
(macro signb
(if (< (arg 1) 80)
(print "%4ld " (arg 1))
((if (> (arg 1) f6) ;if
(print " -%ld " (- 100 (arg 1))) ; then
(if (> (arg 1) 9c) ; else if
(print " -%ld " (- 100 (arg 1))) ; then
(print "-%ld " (- 100 (arg 1))))))) ; else
)
;convert BCPL pointer to C pointer
(macro LTOB
(return (<< (@l (arg 1)) 2))
)
;print BSTR
(macro BSTR (local i cptr)
(= cptr (LTOB (arg 1)))
(for (= i 0) (< i (@b cptr)) (= i (+ i 1))
(print "%lc" (@b (+ (+ 1 cptr) i))))
)
;EXEC Node structure
(macro Node
(if (!= (nargs) 0)
(addsymbol ln_Succ (arg 1))
(addsymbol ln_Succ (current)))
(addsymbol ln_Pred (+ ln_Succ 4))
(addsymbol ln_Type (+ ln_Pred 4))
(addsymbol ln_Pri (+ ln_Type 1))
(addsymbol ln_Name (+ ln_Pri 1))
)