2022-07-07 01:18:08 +00:00
|
|
|
;;
|
|
|
|
;; Compiler Setup for Jak 1
|
|
|
|
;;
|
|
|
|
|
|
|
|
;; load kernel type definitions.
|
|
|
|
;; these types/functions are provided by Jak 1's runtime.
|
|
|
|
(asm-file "goal_src/jak1/kernel-defs.gc")
|
|
|
|
|
|
|
|
;; load jak 1 project
|
|
|
|
(load-project "goal_src/jak1/game.gp")
|
|
|
|
|
|
|
|
;; jak 1 - specific library stuff.
|
|
|
|
|
2024-06-06 02:17:31 +00:00
|
|
|
(defmacro __get_jak1_full_game ()
|
|
|
|
*jak1-full-game*)
|
|
|
|
|
2022-07-07 01:18:08 +00:00
|
|
|
(defconstant *jak1-full-game* (__get_jak1_full_game))
|
|
|
|
|
2022-07-08 23:23:49 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; TYPE STUFF
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
(defmacro basic? (obj)
|
|
|
|
;; todo, make this more efficient
|
2024-06-06 02:17:31 +00:00
|
|
|
`(= 4 (logand (the integer ,obj) #b111)))
|
2022-07-08 23:23:49 +00:00
|
|
|
|
|
|
|
(defmacro pair? (obj)
|
|
|
|
;; todo, make this more efficient
|
|
|
|
;`(= 2 (logand (the integer ,obj) #b111))
|
2024-06-06 02:17:31 +00:00
|
|
|
`(< (shl (the-as int ,obj) 62) 0))
|
2022-07-08 23:23:49 +00:00
|
|
|
|
|
|
|
(defmacro not-pair? (obj)
|
2024-06-06 02:17:31 +00:00
|
|
|
`(>= (shl (the-as int ,obj) 62) 0))
|
2022-07-08 23:23:49 +00:00
|
|
|
|
|
|
|
(defmacro binteger? (obj)
|
2024-06-06 02:17:31 +00:00
|
|
|
`(zero? (logand (the integer ,obj) #b111)))
|
2022-07-08 23:23:49 +00:00
|
|
|
|
|
|
|
(defmacro rtype-of (obj)
|
2024-06-06 02:17:31 +00:00
|
|
|
`(cond
|
|
|
|
((binteger? ,obj) binteger)
|
|
|
|
((pair? ,obj) pair)
|
|
|
|
(else (-> (the basic ,obj) type))))
|