mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 21:27:52 -04:00
5e23057ed1
[goalc] start can compile and run code for jak2 ckernel, set up dummy KERNEL.CGO
37 lines
805 B
Common Lisp
37 lines
805 B
Common Lisp
;;
|
|
;; Compiler Setup for Jak 2
|
|
;;
|
|
|
|
;; load kernel type definitions.
|
|
;; these types/functions are provided by Jak 2's runtime.
|
|
(asm-file "goal_src/jak2/kernel-defs.gc")
|
|
|
|
;; load jak 2 project
|
|
(load-project "goal_src/jak2/game.gp")
|
|
|
|
(defmacro basic? (obj)
|
|
;; todo, make this more efficient
|
|
`(= 4 (logand (the integer ,obj) #b111))
|
|
)
|
|
|
|
(defmacro pair? (obj)
|
|
;; todo, make this more efficient
|
|
;`(= 2 (logand (the integer ,obj) #b111))
|
|
`(< (shl (the-as int ,obj) 62) 0)
|
|
)
|
|
|
|
(defmacro not-pair? (obj)
|
|
`(>= (shl (the-as int ,obj) 62) 0)
|
|
)
|
|
|
|
(defmacro binteger? (obj)
|
|
`(zero? (logand (the integer ,obj) #b111))
|
|
)
|
|
|
|
(defmacro rtype-of (obj)
|
|
`(cond ((binteger? ,obj) binteger)
|
|
((pair? ,obj) pair)
|
|
((basic? ,obj) (-> (the basic ,obj) type))
|
|
(else symbol)
|
|
)
|
|
) |