370 lines
9.5 KiB
NASM
370 lines
9.5 KiB
NASM
;--------------------------------------------------------
|
|
; File Created by SDCC : free open source ANSI-C Compiler
|
|
; Version 3.5.0 #9253 (Jun 20 2015) (MINGW64)
|
|
; This file was generated Wed Dec 07 15:10:12 2022
|
|
;--------------------------------------------------------
|
|
.module main
|
|
.optsdcc -mhc08
|
|
|
|
.area HOME (CODE)
|
|
.area GSINIT0 (CODE)
|
|
.area GSINIT (CODE)
|
|
.area GSFINAL (CODE)
|
|
.area CSEG (CODE)
|
|
.area XINIT (CODE)
|
|
.area CONST (CODE)
|
|
.area DSEG (PAG)
|
|
.area OSEG (PAG, OVR)
|
|
.area XSEG
|
|
.area XISEG
|
|
.area CODEIVT (ABS)
|
|
.org 0xfffe
|
|
.dw __sdcc_gs_init_startup
|
|
|
|
.area GSINIT0
|
|
__sdcc_gs_init_startup:
|
|
ldhx #0x01c0
|
|
txs
|
|
jsr __sdcc_external_startup
|
|
beq __sdcc_init_data
|
|
jmp __sdcc_program_startup
|
|
__sdcc_init_data:
|
|
; _hc08_genXINIT() start
|
|
ldhx #0
|
|
00001$:
|
|
cphx #l_XINIT
|
|
beq 00002$
|
|
lda s_XINIT,x
|
|
sta s_XISEG,x
|
|
aix #1
|
|
bra 00001$
|
|
00002$:
|
|
; _hc08_genXINIT() end
|
|
.area GSFINAL
|
|
jmp __sdcc_program_startup
|
|
|
|
.area CSEG
|
|
__sdcc_program_startup:
|
|
jsr _main
|
|
bra .
|
|
;--------------------------------------------------------
|
|
; Public variables in this module
|
|
;--------------------------------------------------------
|
|
.globl _main
|
|
.globl _display
|
|
.globl _random_seq
|
|
.globl _led_on
|
|
.globl _sound
|
|
.globl _key_scan
|
|
.globl _debounce
|
|
.globl _delay
|
|
.globl _counter
|
|
.globl __COPCTL
|
|
.globl __LVISR
|
|
.globl __BRKSCR
|
|
.globl __BRK
|
|
.globl __FLCR
|
|
.globl __INT3
|
|
.globl __INT2
|
|
.globl __INT1
|
|
.globl __SBFCR
|
|
.globl __SRSR
|
|
.globl __SBSR
|
|
.globl __ADCLK
|
|
.globl __ADR
|
|
.globl __ADSCR
|
|
.globl __PMDS
|
|
.globl __PMRS
|
|
.globl __PMS
|
|
.globl __PBWC
|
|
.globl __PCTL
|
|
.globl __T2CH0
|
|
.globl __T2SC0
|
|
.globl __T2MOD
|
|
.globl __T2CNT
|
|
.globl __T2SC
|
|
.globl __T1CH1
|
|
.globl __T1SC1
|
|
.globl __T1CH0
|
|
.globl __T1SC0
|
|
.globl __T1MOD
|
|
.globl __T1CNT
|
|
.globl __T1SC
|
|
.globl __CONFIG1
|
|
.globl __CONFIG2
|
|
.globl __INTSCR
|
|
.globl __TBCR
|
|
.globl __INTKBIER
|
|
.globl __INTKBSCR
|
|
.globl __SCBR
|
|
.globl __SCDR
|
|
.globl __SCS2
|
|
.globl __SCS1
|
|
.globl __SCC3
|
|
.globl __SCC2
|
|
.globl __SCC1
|
|
.globl __SPDR
|
|
.globl __SPSCR
|
|
.globl __SPCR
|
|
.globl __PTDPUE
|
|
.globl __PTCPUE
|
|
.globl __PTAPUE
|
|
.globl __DDRE
|
|
.globl __PTE
|
|
.globl __DDRD
|
|
.globl __DDRC
|
|
.globl __DDRB
|
|
.globl __DDRA
|
|
.globl __PTD
|
|
.globl __PTC
|
|
.globl __PTB
|
|
.globl __PTA
|
|
;--------------------------------------------------------
|
|
; ram data
|
|
;--------------------------------------------------------
|
|
.area DSEG (PAG)
|
|
__PTA = 0x0000
|
|
__PTB = 0x0001
|
|
__PTC = 0x0002
|
|
__PTD = 0x0003
|
|
__DDRA = 0x0004
|
|
__DDRB = 0x0005
|
|
__DDRC = 0x0006
|
|
__DDRD = 0x0007
|
|
__PTE = 0x0008
|
|
__DDRE = 0x000c
|
|
__PTAPUE = 0x000d
|
|
__PTCPUE = 0x000e
|
|
__PTDPUE = 0x000f
|
|
__SPCR = 0x0010
|
|
__SPSCR = 0x0011
|
|
__SPDR = 0x0012
|
|
__SCC1 = 0x0013
|
|
__SCC2 = 0x0014
|
|
__SCC3 = 0x0015
|
|
__SCS1 = 0x0016
|
|
__SCS2 = 0x0017
|
|
__SCDR = 0x0018
|
|
__SCBR = 0x0019
|
|
__INTKBSCR = 0x001a
|
|
__INTKBIER = 0x001b
|
|
__TBCR = 0x001c
|
|
__INTSCR = 0x001d
|
|
__CONFIG2 = 0x001e
|
|
__CONFIG1 = 0x001f
|
|
__T1SC = 0x0020
|
|
__T1CNT = 0x0021
|
|
__T1MOD = 0x0023
|
|
__T1SC0 = 0x0025
|
|
__T1CH0 = 0x0026
|
|
__T1SC1 = 0x0028
|
|
__T1CH1 = 0x0029
|
|
__T2SC = 0x002b
|
|
__T2CNT = 0x002c
|
|
__T2MOD = 0x002e
|
|
__T2SC0 = 0x0030
|
|
__T2CH0 = 0x0031
|
|
__PCTL = 0x0036
|
|
__PBWC = 0x0037
|
|
__PMS = 0x0038
|
|
__PMRS = 0x003a
|
|
__PMDS = 0x003b
|
|
__ADSCR = 0x003c
|
|
__ADR = 0x003d
|
|
__ADCLK = 0x003e
|
|
__SBSR = 0xfe00
|
|
__SRSR = 0xfe01
|
|
__SBFCR = 0xfe03
|
|
__INT1 = 0xfe04
|
|
__INT2 = 0xfe05
|
|
__INT3 = 0xfe06
|
|
__FLCR = 0xfe08
|
|
__BRK = 0xfe09
|
|
__BRKSCR = 0xfe0b
|
|
__LVISR = 0xfe0c
|
|
__COPCTL = 0xffff
|
|
_counter::
|
|
.ds 4
|
|
;--------------------------------------------------------
|
|
; overlayable items in ram
|
|
;--------------------------------------------------------
|
|
;--------------------------------------------------------
|
|
; absolute ram data
|
|
;--------------------------------------------------------
|
|
.area IABS (ABS)
|
|
.area IABS (ABS)
|
|
;--------------------------------------------------------
|
|
; absolute external ram data
|
|
;--------------------------------------------------------
|
|
.area XABS (ABS)
|
|
;--------------------------------------------------------
|
|
; external initialized ram data
|
|
;--------------------------------------------------------
|
|
.area XISEG
|
|
;--------------------------------------------------------
|
|
; extended address mode data
|
|
;--------------------------------------------------------
|
|
.area XSEG
|
|
;--------------------------------------------------------
|
|
; global & static initialisations
|
|
;--------------------------------------------------------
|
|
.area HOME (CODE)
|
|
.area GSINIT (CODE)
|
|
.area GSFINAL (CODE)
|
|
.area GSINIT (CODE)
|
|
;--------------------------------------------------------
|
|
; Home
|
|
;--------------------------------------------------------
|
|
.area HOME (CODE)
|
|
.area HOME (CODE)
|
|
;--------------------------------------------------------
|
|
; code
|
|
;--------------------------------------------------------
|
|
.area CSEG (CODE)
|
|
;------------------------------------------------------------
|
|
;Allocation info for local variables in function 'delay'
|
|
;------------------------------------------------------------
|
|
;main.c:34: void delay(void) {
|
|
; -----------------------------------------
|
|
; function delay
|
|
; -----------------------------------------
|
|
; Register assignment is optimal.
|
|
; Stack space usage: 0 bytes.
|
|
_delay:
|
|
;main.c:35: for(counter=0;counter<10000;) {
|
|
clrh
|
|
clrx
|
|
sthx *_counter
|
|
sthx *(_counter + 2)
|
|
00102$:
|
|
;main.c:36: counter++;
|
|
inc *(_counter + 3)
|
|
bne 00110$
|
|
inc *(_counter + 2)
|
|
bne 00110$
|
|
inc *(_counter + 1)
|
|
bne 00110$
|
|
inc *_counter
|
|
00110$:
|
|
;main.c:35: for(counter=0;counter<10000;) {
|
|
lda *(_counter + 3)
|
|
sub #0x10
|
|
lda *(_counter + 2)
|
|
sbc #0x27
|
|
lda *(_counter + 1)
|
|
sbc #0x00
|
|
lda *_counter
|
|
sbc #0x00
|
|
blt 00102$
|
|
rts
|
|
;------------------------------------------------------------
|
|
;Allocation info for local variables in function 'debounce'
|
|
;------------------------------------------------------------
|
|
;main.c:39: void debounce(void) {
|
|
; -----------------------------------------
|
|
; function debounce
|
|
; -----------------------------------------
|
|
; Register assignment is optimal.
|
|
; Stack space usage: 0 bytes.
|
|
_debounce:
|
|
;main.c:40: }
|
|
rts
|
|
;------------------------------------------------------------
|
|
;Allocation info for local variables in function 'key_scan'
|
|
;------------------------------------------------------------
|
|
;main.c:42: unsigned char key_scan(void) {
|
|
; -----------------------------------------
|
|
; function key_scan
|
|
; -----------------------------------------
|
|
; Register assignment is optimal.
|
|
; Stack space usage: 0 bytes.
|
|
_key_scan:
|
|
;main.c:43: return(0);
|
|
clra
|
|
rts
|
|
;------------------------------------------------------------
|
|
;Allocation info for local variables in function 'sound'
|
|
;------------------------------------------------------------
|
|
;s Allocated to registers
|
|
;------------------------------------------------------------
|
|
;main.c:46: void sound(unsigned char s) {
|
|
; -----------------------------------------
|
|
; function sound
|
|
; -----------------------------------------
|
|
; Register assignment is optimal.
|
|
; Stack space usage: 0 bytes.
|
|
_sound:
|
|
;main.c:47: }
|
|
rts
|
|
;------------------------------------------------------------
|
|
;Allocation info for local variables in function 'led_on'
|
|
;------------------------------------------------------------
|
|
;i Allocated to registers
|
|
;------------------------------------------------------------
|
|
;main.c:49: void led_on(unsigned char i) {
|
|
; -----------------------------------------
|
|
; function led_on
|
|
; -----------------------------------------
|
|
; Register assignment is optimal.
|
|
; Stack space usage: 0 bytes.
|
|
_led_on:
|
|
;main.c:50: }
|
|
rts
|
|
;------------------------------------------------------------
|
|
;Allocation info for local variables in function 'random_seq'
|
|
;------------------------------------------------------------
|
|
;main.c:52: void random_seq (void) {
|
|
; -----------------------------------------
|
|
; function random_seq
|
|
; -----------------------------------------
|
|
; Register assignment is optimal.
|
|
; Stack space usage: 0 bytes.
|
|
_random_seq:
|
|
;main.c:53: }
|
|
rts
|
|
;------------------------------------------------------------
|
|
;Allocation info for local variables in function 'display'
|
|
;------------------------------------------------------------
|
|
;t Allocated to registers
|
|
;------------------------------------------------------------
|
|
;main.c:55: void display (unsigned char t) {
|
|
; -----------------------------------------
|
|
; function display
|
|
; -----------------------------------------
|
|
; Register assignment is optimal.
|
|
; Stack space usage: 0 bytes.
|
|
_display:
|
|
;main.c:56: }
|
|
rts
|
|
;------------------------------------------------------------
|
|
;Allocation info for local variables in function 'main'
|
|
;------------------------------------------------------------
|
|
;main.c:58: void main (void) {
|
|
; -----------------------------------------
|
|
; function main
|
|
; -----------------------------------------
|
|
; Register assignment is optimal.
|
|
; Stack space usage: 0 bytes.
|
|
_main:
|
|
;main.c:60: CONFIG1_COPD=1; // Disables COP
|
|
bset #0,*__CONFIG1
|
|
;main.c:61: PCTL_PLLON=0; // Disables PLL
|
|
bclr #5,*__PCTL
|
|
;main.c:64: PTD = 0x00; // The Port will be blanked
|
|
mov #0x00,*__PTD
|
|
;main.c:65: DDRD = 0x1F; // make PTD0..4 output
|
|
mov #0x1F,*__DDRD
|
|
00102$:
|
|
;main.c:67: delay();
|
|
jsr _delay
|
|
;main.c:68: PTD^=0x1F; //toggle PTD0..4
|
|
lda *__PTD
|
|
eor #0x1F
|
|
sta *__PTD
|
|
bra 00102$
|
|
rts
|
|
.area CSEG (CODE)
|
|
.area CONST (CODE)
|
|
.area XINIT (CODE)
|
|
.area CABS (ABS,CODE)
|