Commits

Pierre Surply  committed 39f9a5e

Term: Now works with Atmega 1280

  • Participants
  • Parent commits e94568e

Comments (0)

Files changed (5)

File stdlib/uart.mr

     self.rate <- rate
     asm{rate} "sts UBRR0L, r24
                sts UBRR0H, r25
+               ldi r24, (1 << U2X0)
+               sts UCSR0A, r24
                ldi r24, (1 << TXEN0) | (1 << RXEN0)
                sts UCSR0B, r24
                ldi r24, (3 << UCSZ00)

File term/Makefile

 ## <pierre.surply@gmail.com>
 ## 
 ## Started on  Sun Jan 20 12:24:46 2013 Pierre Surply
-## Last update Sun Mar 24 09:48:38 2013 Pierre Surply
+## Last update Mon Apr 15 12:39:49 2013 Pierre Surply
 ##
 
-MCU		= 644
+MCU		= 1280
 DEVPROG		= /dev/ttyUSB1
-DEVCOM		= /dev/ttyUSB0
+DEVCOM		= /dev/ttyUSB1
 
 MARAC		= marac
 MFLAGS		= -mmcu atmega$(MCU) -v
 
 AVRDUDE		= avrdude
 PARTNO		= m$(MCU)
-PROG		= stk500
+PROG		= arduino -b 57600
 AFLAGS		= -p $(PARTNO) -c $(PROG) -P $(DEVPROG) -e
 FUSE		= #-U lfuse:w:0xc6:m -U hfuse:w:0xd9:m
 

File term/main.mr

 ## <pierre.surply@gmail.com>
 ## 
 ## Started on  Fri Jan 25 17:56:51 2013 Pierre Surply
-## Last update Fri Mar 22 19:29:53 2013 Pierre Surply
+## Last update Mon Apr 15 12:40:28 2013 Pierre Surply
 ##
 
 begin setup
         PORTB.set_mode(0xFF)
         PORTB.write(0xFF)
-        var term <- new term(23)
+        var term <- new term(207)
         term.wait_start()
 end
 

File term/term.mr

 ## <pierre.surply@gmail.com>
 ## 
 ## Started on  Fri Jan 25 17:57:37 2013 Pierre Surply
-## Last update Sat Mar 23 23:55:27 2013 Pierre Surply
+## Last update Mon Apr 15 13:05:19 2013 Pierre Surply
 ##
 
 using eeprom
   end
 
   func shell()
+    var umara <- none
     self.prompt()
     if self.buffer[0] then
       var arg <- self.buffer.split(' ')
       elif str_cmp(arg[0], "print") = 0 then
         self.print(arg)
       elif str_cmp(arg[0], "run") = 0 then
-        var umara <- new umara(arg, new vect(64), self.com, self.buffer)
+        umara <- new umara(arg, new vect(64), self.com)
         if umara.compile() then
           umara.run()
         endif
         del umara
       elif str_cmp(arg[0], "debug") = 0 then
-        umara <- new umara(arg, new vect(64), self.com, self.buffer)
+        umara <- new umara(arg, new vect(64), self.com)
         if umara.compile() then
           umara.debug()
         endif

File term/umara.mr

   vm            vm
   integer       size
   list          arg
-  string        buffer
 
-  func init(arg, mem, com, buffer)
-    self.buffer <- buffer
+  func init(arg, mem, com)
     self.arg <- arg
     self.mem <- mem
     self.com <- com
   end
 
   func destr()
-    del self.vm
+    if self.vm then
+      del self.vm
+    endif
     return self
   end
 
   end
 
   func debug()
+    var buff <- new string(128)
     self.vm <- new vm(self.mem, self.com)
     self.vm.max_sp <- self.size
     var d <- 0
     var c <- true
     while c do
       for i <- 0 to 3 do
-        self.buffer.itoa_hex(self.vm.reg[i], 4)
-        self.com.write(self.buffer.s)
+        buff.itoa_hex(self.vm.reg[i], 4)
+        self.com.write(buff.s)
         self.com.send(' ')
       done
       self.com.newline()
           else
             self.com.send(' ')
           endif
-          self.buffer.itoa_hex(self.mem[d], 4)
-          self.com.write(self.buffer.s)
+          buff.itoa_hex(self.mem[d], 4)
+          self.com.write(buff.s)
           if self.vm.pc = d or self.vm.sp = d then
             self.com.send(']')
           else
       self.com.recv()
       c <- self.vm.exec()
     done
+    del buff
   end
 end