changeset 121:744de3427c05

finished Mode 2 of bootstrapping program
author Robert McIntyre <rlm@mit.edu>
date Fri, 16 Mar 2012 20:48:12 -0500
parents d6f2a06cb128
children e85b53994fac
files clojure/com/aurellem/assembly.clj
diffstat 1 files changed, 49 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/assembly.clj	Fri Mar 16 20:31:53 2012 -0500
     1.2 +++ b/clojure/com/aurellem/assembly.clj	Fri Mar 16 20:48:12 2012 -0500
     1.3 @@ -603,7 +603,7 @@
     1.4     0x05   ;D381                    ;  5 variables:
     1.5     0x00   ;D382                    ;    current-mode
     1.6     0x00   ;D383                    ;    bytes-left-to-write
     1.7 -   0x00   ;D384                    ;    unused
     1.8 +   0x00   ;D384                    ;    start-point
     1.9     0x00   ;D385                    ;    unused
    1.10     0x00   ;D386                    ;    unused
    1.11  
    1.12 @@ -623,8 +623,7 @@
    1.13     0xA8   ;D38E
    1.14     0xD3   ;D38F
    1.15  
    1.16 -
    1.17 -   ;; GOTO Mode 1 (set-bytes) if current-mode is 1
    1.18 +   ;; GOTO Mode 1 (set-length) if current-mode is 1
    1.19     0xFE   ;D390
    1.20     0x01   ;D391                    ; compare A with 0x01
    1.21  
    1.22 @@ -632,11 +631,14 @@
    1.23     0xB1   ;D393 
    1.24     0xD3   ;D394                    ; goto Mode 1 if A == 1
    1.25  
    1.26 -   0x00   ;D395
    1.27 -   0x00   ;D396
    1.28 -   0x00   ;D397
    1.29 -   0x00   ;D398
    1.30 -   0x00   ;D399
    1.31 +   ;; GOTO Mode 2 (set-start-point) if current mode is 2
    1.32 +   0xFE   ;D395                    
    1.33 +   0x02   ;D396                    ; compare A with 0x02
    1.34 +
    1.35 +   0xCA   ;D397
    1.36 +   0xBF   ;D398
    1.37 +   0xD3   ;D399                    ; goto Mode 2 if A == 2
    1.38 +
    1.39     0x00   ;D39A
    1.40     0x00   ;D39B
    1.41     0x00   ;D39C
    1.42 @@ -674,13 +676,13 @@
    1.43     ;; End Mode 0
    1.44  
    1.45  
    1.46 -   ;; Mode 1 -- input bytes mode
    1.47 -   ;;      This is the header for writing things to memory
    1.48 -   ;;      specifies the number of bytes to write.
    1.49 +   ;; Mode 1 -- set-length mode
    1.50 +   ;;      This is the header for writing things to memory.
    1.51 +   ;;      User specifies the number of bytes to write.
    1.52     ;;      Mode is auto advanced to Mode 2 after this mode
    1.53     ;;      completes.
    1.54  
    1.55 -   ;;      set bytes left to write to input-number,
    1.56 +   ;;      Set bytes left to write to input-number;
    1.57     ;;      set current-mode to 0x02.
    1.58     0xFA   ;D3B1                   ; load input-number (0xD352)
    1.59     0x52   ;D3B2                   ; into A
    1.60 @@ -690,7 +692,7 @@
    1.61     0x83   ;D3B5                   ; (0xD383)
    1.62     0xD3   ;D3B6
    1.63  
    1.64 -   0x3E   ;D3B7                   ; load 0x02 to A
    1.65 +   0x3E   ;D3B7                   ; load 0x02 into A.
    1.66     0x02   ;D3B8
    1.67     
    1.68     0xEA   ;D3B9                   ; load A to current-mode
    1.69 @@ -701,21 +703,36 @@
    1.70     0x1D   ;D3BD
    1.71     0xD3   ;D3BE
    1.72     ;; End Mode 1
    1.73 +
    1.74 +
    1.75 +   ;; Mode 2 -- set start-point mode
    1.76 +   ;;      Final part of the header for writing things to memory.
    1.77 +   ;;      User specifies the start location in RAM to which 
    1.78 +   ;;      data will be written.
    1.79 +   ;;      Mode is auto advanced to Mode 3 after this mode completes.
    1.80 +
    1.81 +   ;;      Set start-point to input-number;
    1.82 +   ;;      set current mode to 0x03.
    1.83 +   0xFA   ;D3BF                   ; load input-number (0xD352)
    1.84 +   0x52   ;D3C0                   ; into A
    1.85 +   0xD3   ;D3C1
    1.86 +
    1.87 +   0xEA   ;D3C2                   ; load A into start-point
    1.88 +   0x84   ;D3C3                   ; (0xD384)
    1.89 +   0xD3   ;D3C4
    1.90 +
    1.91 +   0x3E   ;D3C5                   ; load 0x03 into A.
    1.92 +   0x03   ;D3C6
    1.93 +
    1.94 +   0xEA   ;D3C7                   ; load A to current-mode,
    1.95 +   0x82   ;D3C8                   ; advancing from Mode 2 to 
    1.96 +   0xD3   ;D3C9                   ; Mode 3.
    1.97     
    1.98 -   0x00   ;D3BF
    1.99 -   0x00   ;D3C0
   1.100 -   0x00   ;D3C1
   1.101 -   0x00   ;D3C2
   1.102 -   0x00   ;D3C3
   1.103 -   0x00   ;D3C4
   1.104 -   0x00   ;D3C5
   1.105 -   0x00   ;D3C6
   1.106 -   0x00   ;D3C7
   1.107 -   0x00   ;D3C8
   1.108 -   0x00   ;D3C9
   1.109 -   0x00   ;D3CA
   1.110 -   0x00   ;D3CB
   1.111 -   0x00   ;D3CC
   1.112 +   0xC3   ;D3CA                   ; go back to beginning
   1.113 +   0x1D   ;D3CB
   1.114 +   0xD3   ;D3CC
   1.115 +   ;;End Mode 2
   1.116 +   
   1.117     0x00   ;D3CD
   1.118     0x00   ;D3CE
   1.119     0x00   ;D3CF
   1.120 @@ -727,6 +744,11 @@
   1.121     0x00   ;D3D5
   1.122     0x00   ;D3D6
   1.123  
   1.124 +   ;; Mode 3 -- write bytes mode
   1.125 +   ;;      This is where RAM manipulation happens.
   1.126 +   ;;      User supplies bytes every frame, which are written
   1.127 +   ;;      sequentially to 
   1.128 +
   1.129  
   1.130  
   1.131