[yalo commit] r131 - trunk/cc

0 views
Skip to first unread message

codesite...@google.com

unread,
Feb 25, 2009, 10:15:05 AM2/25/09
to yalo-...@googlegroups.com
Author: yujian.zhang
Date: Wed Feb 25 06:16:38 2009
New Revision: 131

Modified:
trunk/cc/bootloader.lisp
trunk/cc/lap.lisp
trunk/cc/test-cc.lisp

Log:
Add floppy disk read code to bootloader.

Modified: trunk/cc/bootloader.lisp
==============================================================================
--- trunk/cc/bootloader.lisp (original)
+++ trunk/cc/bootloader.lisp Wed Feb 25 06:16:38 2009
@@ -13,8 +13,36 @@
`((bits 16)
(org #x7c00)

+ ;; Just in case any segment registers are touched.
+ (xor ax ax)
+ (mov ds ax)
+ (mov es ax)
+ (mov fs ax)
+ (mov gs ax)
+ (mov ss ax)
+
+ ;; Load other sectors from floppy disk.
+ ;; AL: # of sectors
+ (mov ax (+ #x200 (ceiling (- kernel-end real-start) 512)))
+ (mov bx real-start) ; ES:BX is destination
+ (mov cx 2) ; CH: cylinder; CL: sector
+ (xor dx dx) ; DH: head; DL: drive
+ (int #x13)
+
+ (times 480 nop) ; To be removed once near jmp is available
+ (jmp short real-start)
+
+ ;; Fill up to 510 bytes.
+ (times (- 510 (- $ $$)) db 0)
+
+ (dw #xaa55) ; Boot sector signature
+
+ ;; Real start up code.
+ real-start
+
;; Get current cursor position.
(mov ah 3)
+ (xor bh bh)
(int #x10)

;; Write string.
@@ -28,10 +56,7 @@
(jmp short $)

(db msg ("Hello World! " 13 10))
- endmsg
+ endmsg

- ;; Fill up to 510 bytes.
- (times (- 510 (- $ $$)) db 0)
-
- (dw #xaa55) ; Boot sector signature
+ kernel-end
))

Modified: trunk/cc/lap.lisp
==============================================================================
--- trunk/cc/lap.lisp (original)
+++ trunk/cc/lap.lisp Wed Feb 25 06:16:38 2009
@@ -432,7 +432,7 @@
(cond
((atom e) (numberp e))
((null e) t)
- ((atom (car e)) (and (member (car e) '(+ -))
+ ((atom (car e)) (and (member (car e) '(+ - ceiling))
(every #'evaluable? (cdr e))))
(t nil)))


Modified: trunk/cc/test-cc.lisp
==============================================================================
--- trunk/cc/test-cc.lisp (original)
+++ trunk/cc/test-cc.lisp Wed Feb 25 06:16:38 2009
@@ -329,7 +329,6 @@

(deftest test-cc ()
(check
- (equal (asm *bootloader*) *bootloader-code*)
(equal (asm *address-asm*) *address-code*)
(equal (asm *arith-asm*) *arith-code*)
(equal (asm *misc-asm*) *misc-code*)))

Reply all
Reply to author
Forward
0 new messages