OpenCores
URL https://opencores.org/ocsvn/diogenes/diogenes/trunk

Subversion Repositories diogenes

[/] [diogenes/] [trunk/] [old/] [bootloader_test.asm] - Blame information for rev 238

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 126 fellnhofer
@ l0 : temp
2
@ l1 : constant 1
3
@ l2 : current address for memwrites
4
@ l3 : temp, holds the value received from uart
5
@ h1 : toggle bit = 0 zero, when a full 16 Bit word was received
6
@ h2 : holds the bitmask of the invalid instruction 0xffff = special with
7
@ l4 : temp, used for branch condition
8
 
9
  ldi   l2, 0x80
10
  lsi   l2, 0x40     @ start of user program
11
 
12
  ldi   h2, 0xff
13
  lsi   h2, 0xff     @ h2 = 0xffff
14
 
15
  ldi   l1, 1        @ constant 1
16
  ldi   h1, 0        @ toggle bit (hi low)
17
 
18
1: @ wait for byte
19
  ldi   l0, 0xc0     @ uart status address
20
  ldio  l3, [l0]
21
  nop
22
  ldi   h0, 2        @ uart data ready bit
23
  and   l4, l3, h0
24
  ldi   h0, 0xc1     @ uart data address
25
  brz   l4, :1
26
  nop
27
 
28
 
29
  ldio  l3, [h0]     @ uart rcv
30
  nop
31
  xor   h1, h1, l1   @ toggle state (16 bit Ready)
32
  stio  l3, [h0]     @ uart echo (uart should be ready at this point)
33
  nop
34
  ldi   h0, 0x00
35
  stio  l3, [h0]     @ leds echo
36
  nop
37
  brz   h1, :2
38
  nop                @ hier könnte leds echo sein (nop wegen evtl.  Simulator bug)
39
 
40
 
41
  @ olny first half (LSB) of instruction was received
42
  mov   h3, l3       @ h3: holds 16-bit instr (here LSB are set)
43
  brnz  h1, :1
44
  nop
45
 
46
2: @ full 16-Bit instruction is ready
47
  lsi   l3, 0x00     @ move received 8 bits
48
  or    h3, h3, l3   @ merge the two instructionbytes
49
  stio  l2, [h0]     @ write instruction to programm-mem
50
  nop
51
  xor   l4, h3, h2   @ check if the instruction writen to pmem is 0xffff
52
  adi   l2, 1        @ increase program-write address
53
  brnz  l4, :1
54
  nop
55
 
56
@@ programm loaded
57
 
58
@ jump to begin of loaded program
59
  ldi   l0, 0x40
60
  nop
61
  jump  
62
  nop

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.