changeset 120:d6f2a06cb128

finished Mode 1 of bootstrapping program
author Robert McIntyre <rlm@mit.edu>
date Fri, 16 Mar 2012 20:31:53 -0500
parents 6cbea8ab65b6
children 744de3427c05
files clojure/com/aurellem/assembly.clj
diffstat 1 files changed, 49 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/assembly.clj	Fri Mar 16 20:18:54 2012 -0500
     1.2 +++ b/clojure/com/aurellem/assembly.clj	Fri Mar 16 20:31:53 2012 -0500
     1.3 @@ -609,31 +609,29 @@
     1.4  
     1.5  
     1.6     ;; banch on current mode
     1.7 -   ;;   mode 0 -- input-mode mode
     1.8 -   ;;     means that we are waiting for a mode, so set the mode to
     1.9 -   ;;     whatever is currently in input number.  If nothing is
    1.10 -   ;;     entered, then the program stays in input-mode mode
    1.11 -
    1.12     0xFA   ;D387                    ; load current-mode (0xD382)
    1.13     0x82   ;D388                    ; into A
    1.14     0xD3   ;D389
    1.15 -   
    1.16     0x00   ;D38A
    1.17  
    1.18 +
    1.19 +   ;;  GOTO Mode 0 (input-mode) if current-mode is 0
    1.20     0xFE   ;D38B
    1.21     0x00   ;D38C                    ; compare A with 0x00
    1.22  
    1.23 -   ;; TODO make this jump non-absolute
    1.24 -   
    1.25 -   0xCA   ;D38D                    ; GOTO Mode 0 if current-mode is 0
    1.26 +   0xCA   ;D38D                    ; goto Mode 0 if A == 0
    1.27     0xA8   ;D38E
    1.28     0xD3   ;D38F
    1.29  
    1.30 -   0x00   ;D390
    1.31 -   0x00   ;D391
    1.32 -   0x00   ;D392
    1.33 -   0x00   ;D393
    1.34 -   0x00   ;D394
    1.35 +
    1.36 +   ;; GOTO Mode 1 (set-bytes) if current-mode is 1
    1.37 +   0xFE   ;D390
    1.38 +   0x01   ;D391                    ; compare A with 0x01
    1.39 +
    1.40 +   0xCA   ;D392                  
    1.41 +   0xB1   ;D393 
    1.42 +   0xD3   ;D394                    ; goto Mode 1 if A == 1
    1.43 +
    1.44     0x00   ;D395
    1.45     0x00   ;D396
    1.46     0x00   ;D397
    1.47 @@ -654,7 +652,13 @@
    1.48     0xC3   ;D3A5
    1.49     0x1D   ;D3A6
    1.50     0xD3   ;D3A7
    1.51 -   ;; Mode 0
    1.52 +
    1.53 +
    1.54 +   ;; Mode 0 -- input-mode mode
    1.55 +   ;;     means that we are waiting for a mode, so set the mode to
    1.56 +   ;;     whatever is currently in input-number.  If nothing is
    1.57 +   ;;     entered, then the program stays in input-mode mode
    1.58 +
    1.59     ;;   set current-mode to input-number
    1.60     0xFA   ;D3A8                    ; load input-number (0xD352) 
    1.61     0x52   ;D3A9                    ; into A
    1.62 @@ -667,21 +671,37 @@
    1.63     0xC3   ;D3AE                    ; go back to beginning
    1.64     0x1D   ;D3AF
    1.65     0xD3   ;D3B0
    1.66 +   ;; End Mode 0
    1.67  
    1.68 -   0x00   ;D3B1
    1.69 -   0x00   ;D3B2
    1.70 -   0x00   ;D3B3
    1.71 -   0x00   ;D3B4
    1.72 -   0x00   ;D3B5
    1.73 -   0x00   ;D3B6
    1.74 -   0x00   ;D3B7
    1.75 -   0x00   ;D3B8
    1.76 -   0x00   ;D3B9
    1.77 -   0x00   ;D3BA
    1.78 -   0x00   ;D3BB
    1.79 -   0x00   ;D3BC
    1.80 -   0x00   ;D3BD
    1.81 -   0x00   ;D3BE
    1.82 +
    1.83 +   ;; Mode 1 -- input bytes mode
    1.84 +   ;;      This is the header for writing things to memory
    1.85 +   ;;      specifies the number of bytes to write.
    1.86 +   ;;      Mode is auto advanced to Mode 2 after this mode
    1.87 +   ;;      completes.
    1.88 +
    1.89 +   ;;      set bytes left to write to input-number,
    1.90 +   ;;      set current-mode to 0x02.
    1.91 +   0xFA   ;D3B1                   ; load input-number (0xD352)
    1.92 +   0x52   ;D3B2                   ; into A
    1.93 +   0xD3   ;D3B3
    1.94 +   
    1.95 +   0xEA   ;D3B4                   ; load A into bytes-left-to-write
    1.96 +   0x83   ;D3B5                   ; (0xD383)
    1.97 +   0xD3   ;D3B6
    1.98 +
    1.99 +   0x3E   ;D3B7                   ; load 0x02 to A
   1.100 +   0x02   ;D3B8
   1.101 +   
   1.102 +   0xEA   ;D3B9                   ; load A to current-mode
   1.103 +   0x82   ;D3BA                   ; advancing from Mode 1 to 
   1.104 +   0xD3   ;D3BB                   ; Mode 2
   1.105 +   
   1.106 +   0xC3   ;D3BC                   ; go back to beginning
   1.107 +   0x1D   ;D3BD
   1.108 +   0xD3   ;D3BE
   1.109 +   ;; End Mode 1
   1.110 +   
   1.111     0x00   ;D3BF
   1.112     0x00   ;D3C0
   1.113     0x00   ;D3C1