-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheader.lisp
30 lines (27 loc) · 1.16 KB
/
header.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
(in-package #:lzm)
(defvar *version*)
(defvar *high-memory-offset*)
(defvar *initial-pc*)
(defvar *dictionary-offset*)
(defvar *object-table-offset*)
(defvar *global-table-offset*)
(defvar *static-memory-offset*)
(defvar *abbrev-table-offset*)
(defun read-header ()
(setf *version* (read-u8 #x00)
*high-memory-offset* (read-u16 #x04)
*initial-pc* (read-u16 #x06)
*dictionary-offset* (read-u16 #x08)
*object-table-offset* (read-u16 #x0a)
*global-table-offset* (read-u16 #x0c)
*static-memory-offset* (read-u16 #x0e)
*abbrev-table-offset* (read-u16 #x18)))
(defun print-header ()
(format t "Version: ~d~%" *version*)
(format t "High memory offset: ~4,'0x~%" *high-memory-offset*)
(format t "Initial PC: ~4,'0x~%" *initial-pc*)
(format t "Dictionary offset: ~4,'0x~%" *dictionary-offset*)
(format t "Object table offset: ~4,'0x~%" *object-table-offset*)
(format t "Global table offset: ~4,'0x~%" *global-table-offset*)
(format t "Static memory offset: ~4,'0x~%" *static-memory-offset*)
(format t "Abbrev table offset: ~4,'0x~%" *abbrev-table-offset*))