EASy68K
http://www.easy68k.com/EASy68Kforum/

switches and leds
http://www.easy68k.com/EASy68Kforum/viewtopic.php?f=5&t=630
Page 1 of 1

Author:  georgek [ Sun Apr 05, 2009 3:54 pm ]
Post subject:  switches and leds

hello everyone
i just need some help with the program
i have this simple switch read and led out programm and i need to see this work on the easy68k
is there the 8 switches that can give '1' or '0' and to take the result on leds?
im using the 68230 pi/t and i dont know if this program is only for the 68000.
this is the programm:
Code:
        ORG $400400
LEDS_1  MOVEA.L #$800001,A0
        MOVE.B #$80,$C(A0)
        MOVE.B #$0,$4(A0)
        MOVE.B #$80,$E(A0)
        MOVE.B #$FF,$6(A0)
        MOVE.B #0,$12(A0)
READ    MOVE.B $10(A0),D0 //reads the switches
        MOVE.B D0,$12(A0) //opens the leds
        BRA READ
        END 400400

is there any other command i need to enter to the program to make it work on the 68k and to give me the led output?
thanks

Author:  lee [ Sun Apr 05, 2009 7:47 pm ]
Post subject: 

The LEDs and switches in EASy68K are far easier to use then the 68230. You don't need all the register setup that the PI/T requires but there is still some setup.

Code:
      ORG   $1000

start
      MOVEQ       #0,d1             * open the hardware window
      MOVEQ       #32,d0            * simulator hardware command
      TRAP        #15

      MOVEQ       #2,d1             * get the LEDs address
      MOVEQ       #32,d0            * simulator hardware command
      TRAP        #15

      MOVEA.l     d1,a0             * copy the LEDs address to a0

      MOVEQ       #3,d1             * get the switches address
      MOVEQ       #32,d0            * simulator hardware command
      TRAP        #15

      MOVEA.l     d1,a1             * copy the switches address to a1
read
      MOVE.b      (a1),(a0)         * copy the switch byte to the LEDs
      BRA.s       read              * loop forever

      END   start

If you open the hardware window and set the addresses of the LEDs and switches by hand before you run the code the whole program can be reduced to ..

Code:
      ORG   $1000

start
      LEA         #00E00010,a0      * save the LEDs address to a0
      LEA         #00E00012,a1      * save the switches address to a1
read
      MOVE.b      (a1),(a0)         * copy the switch byte to the LEDs
      BRA.s       read              * loop forever

      END   start

Lee.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/