Changeset 7d5e268 in avrstuff


Ignore:
Timestamp:
Oct 29, 2010, 8:03:56 PM (14 years ago)
Author:
Adrien Destugues <pulkomandy@…>
Branches:
main
Children:
98713b5
Parents:
741c0b9
Message:

Add some init code.

git-svn-id: svn://pulkomandy.tk/avrstuff@29 c6672c3c-f6b6-47f9-9001-1fd6b12fecbe

File:
1 edited

Legend:

Unmodified
Added
Removed
  • CPC stuff/cpc_serial_2313/code/main.asm

    r741c0b9 r7d5e268  
    1414
    1515.EQU CTRLIN = PIND
    16 .EQU A0 = PIND4
     16.EQU CTRLOUT = PORTD
     17.EQU CTRLDIR = DDRD
     18
     19.EQU A0 = PIND5
     20.EQU _READ = PIND3
     21.EQU _WRITE = PIND2
     22.EQU DEL = PIND6
     23.EQU INT = PIND4
    1724
    1825.EQU curregbak = SRAM_START
     
    7481
    7582; release the bus
    76         LDI R16,ALL_IN
     83        SER R16
    7784        OUT DATADIR, R16
    78         LDI R16,ALL_OUT
     85        CLR R16
    7986
    8087; Restore R27 to selected reg. (we erased it to do the OUT)
     
    112119; * Set up the INT0 and INT1 so the CPC can do the rest of the setup itself
    113120init:
    114         ; setup ctrl port : RW and A0 as inputs, INT as output
     121        CLI
     122        ; setup ctrl port : RW and A0 as inputs, INT and DEL as output
     123        LDI R16,0x28
     124        OUT CTRLDIR,R16
     125
     126        ; setup dataport as input
     127        CLR R0
     128        OUT DATADIR,R0
     129
    115130        ; led on (will be turned off by software at init)
     131        SBI CTRLOUT,DEL
     132
    116133        ; init serial port speed and io
     134        LDI R16,10
     135        OUT UBRR,R16
     136
    117137        ; check for bootloader jumper and jump to bootload code if needed
     138        ; TODO
    118139
     140        ; setup interrupts (enable INT0 and INT1 on falling edge)
     141        LDI R16,0x0A
     142        OUT MCUCR,R16
     143
     144        LDI R16,0xC0
     145        OUT GIMSK,R16
     146
     147        ; we can now enable interrupts
    119148        SEI
     149
    120150mainloop:
    121151        ; maybe we will have to handle a buffer for the serial port
Note: See TracChangeset for help on using the changeset viewer.