微處理器 - NXP MC68HC908JB8 - Assembly - LED



參考資訊:
https://www.sparetimelabs.com/funwith08/funwith08.php
https://www.nxp.com/docs/en/data-sheet/MC68HC908JB8.pdf
https://github.com/ixaxaar/sdcc/blob/master/sdas/doc/asmlnk.txt
https://hackaday.io/project/167952-semyon/log/169905-blink-with-sdas
https://www.nxp.com/files-static/microcontrollers/doc/ref_manual/HCS08RMV1.pdf

DDRA


PTA


main.asm

    PTA  .equ 0x00
    DDRA .equ 0x04

    .module main
    .optsdcc -mhc08

    .area codeivt (abs)
    .org 0xfffe
    .dw main

    .area cseg (abs, code)
    .org 0xdc00

main:
    lda #0x02
    sta DDRA

loop:
    eor #0x02
    sta PTA

    ldhx #0xffff
d0:
    aix #-1
    cphx #0x0000
    bne d0

    jmp loop

Makefile

all:
	sdas6808 -los main.asm
	sdld -s main

flash:
	bl08 -c /dev/ttyUSB0 -b 9600 -t jb8 -x 12 -f -g reset main.s19

clean:
	rm -rf main.lst  main.rel  main.s19  main.sym

連接好UART並且按下Reset


編譯、燒錄

$ make
    sdas6808 -los main.asm
    sdld -s main
    ASlink >> -s
    ASlink >> main

$ make flash
    bl08 -c /dev/ttyUSB0 -b 9600 -t jb8 -x 12 -f -g reset main.s19
    bl08 - MC68HC908 Bootloader - version 1.0.0.0
    Reading S-records
    Line ignored: S9030000FC

    S-record data address 00FFFE size 000002
    S-record data address 00DC00 size 000017

    Mass erase
    Program FFFE - FFFF .
    Program DC00 - DC16 .
    Execute code from DC00

完成