Skip to content

Instantly share code, notes, and snippets.

@vintagechips
Created June 20, 2021 06:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vintagechips/f0dc50f6061a0f0cf25f1bb4072246f2 to your computer and use it in GitHub Desktop.
Save vintagechips/f0dc50f6061a0f0cf25f1bb4072246f2 to your computer and use it in GitHub Desktop.
Blink LED program for DIGIT TMP68301 board
* Title: Blink LED
* Target: DIGIT TMP68301 BOARD
* Assembler: https://archive.org/details/68000ASM_ZIP
* Helper: http://takeda-toshiya.my.coocan.jp/msdos/
* Win32 command: msdos asm -l blink68k.asm
*
* Special thanks @comoneko on Twitter
*
IORBASE equ $00FFFC00
*
* Address setting REGs
AMAR0 equ IORBASE+$000
AMAR1 equ IORBASE+$004
AAMR0 equ IORBASE+$001
AAMR1 equ IORBASE+$005
AACR0 equ IORBASE+$003
AACR1 equ IORBASE+$007
AACR2 equ IORBASE+$009
ATOR equ IORBASE+$00B
ARELR equ IORBASE+$00C
*
* Parallel interface REGs
PDIR equ IORBASE+$100
PCR equ IORBASE+$103
PSR equ IORBASE+$105
PCMR equ IORBASE+$107
PMR equ IORBASE+$109
PDR equ IORBASE+$10A
PPR1 equ IORBASE+$10D
PPR2 equ IORBASE+$10F
*
* Reset vectors
org $00000000
RESVCT: dc.l $0040FFFC Stack address
dc.l $00000400 Start address
*
* main
org $00000400
START: move.w #$0000,CCR IRQ disable
move.b #$00,D0 BERR disable
move.b D0,ATOR
*
* RAM CS1
move.b #$40,D0 Address area
move.b D0,AMAR1
move.b #$FF,D0 No mask
move.b D0,AAMR1
move.b #$3D,D0 CS1 enable, Wait 5 clocks
move.b D0,AACR1
*
* Parallel interface
move.b #$00,D0 Mode0 16bit simple IO
move.b D0,PCR
move.w #$FFFF,D0 Set all ports as output
move.w D0,PDIR
move.w #$0000,D0 Initialize as all ports H
move.w D0,PDR
*
LOOP1: subi #$1,D0 Change ports data
move.w D0,PDR
bsr DELAY Wait
bra LOOP1 Repeat
*
DELAY: move.l #$0B000000,D1 Time constant
LOOP2: subi #$01,D1 Decrement
bne LOOP2 If not 0, repeat
rts
*
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment