Skip to content

Commit

Permalink
Updated to latest ASM8 code
Browse files Browse the repository at this point in the history
  • Loading branch information
tonypdmtr committed Jan 15, 2021
1 parent 355be1e commit 0796c9f
Show file tree
Hide file tree
Showing 94 changed files with 1,038 additions and 948 deletions.
14 changes: 1 addition & 13 deletions ac96.inc
Original file line number Diff line number Diff line change
Expand Up @@ -465,15 +465,6 @@ NVOPT equ $FFBF,1 ;Non-volatile Flash Options Re

;*** TPMxC0SC - TPMx Timer Channel 0 Status and Control Register

@bitnum ELS0A,2 ;Edge/Level Select Bit A
@bitnum ELS0B,3 ;Edge/Level Select Bit B
@bitnum MS0A,4 ;Mode Select A for TPM Channel 0
@bitnum MS0B,5 ;Mode Select B for TPM Channel 0
@bitnum CH0IE,6 ;Channel 0 Interrupt Enable
@bitnum CH0F,7 ;Channel 0 Flag

;*** TPMC0V - TPMx Timer Channel 0 Value Register

@bitnum ELSxA,2 ;Edge/Level Select Bit A
@bitnum ELSxB,3 ;Edge/Level Select Bit B
@bitnum MSxA,4 ;Mode Select A for TPM Channel x
Expand Down Expand Up @@ -879,11 +870,8 @@ FLASH_END set BOOTROM-1
HZ def 16777216 ;Cyclone 32768*512
#endif
;-------------------------------------------------------------------------------
; Vectors
#temp VECTORS ; Vectors
;-------------------------------------------------------------------------------

#temp VECTORS

Vspi2 next :temp,2 ;SPI2 vector
Vtpm3ovf next :temp,2 ;TPM3 overflow
next :temp,2*16 ;(reserved)
Expand Down
14 changes: 1 addition & 13 deletions code/ac96.inc
Original file line number Diff line number Diff line change
Expand Up @@ -465,15 +465,6 @@ NVOPT equ $FFBF,1 ;Non-volatile Flash Options Re

;*** TPMxC0SC - TPMx Timer Channel 0 Status and Control Register

@bitnum ELS0A,2 ;Edge/Level Select Bit A
@bitnum ELS0B,3 ;Edge/Level Select Bit B
@bitnum MS0A,4 ;Mode Select A for TPM Channel 0
@bitnum MS0B,5 ;Mode Select B for TPM Channel 0
@bitnum CH0IE,6 ;Channel 0 Interrupt Enable
@bitnum CH0F,7 ;Channel 0 Flag

;*** TPMC0V - TPMx Timer Channel 0 Value Register

@bitnum ELSxA,2 ;Edge/Level Select Bit A
@bitnum ELSxB,3 ;Edge/Level Select Bit B
@bitnum MSxA,4 ;Mode Select A for TPM Channel x
Expand Down Expand Up @@ -879,11 +870,8 @@ FLASH_END set BOOTROM-1
HZ def 16777216 ;Cyclone 32768*512
#endif
;-------------------------------------------------------------------------------
; Vectors
#temp VECTORS ; Vectors
;-------------------------------------------------------------------------------

#temp VECTORS

Vspi2 next :temp,2 ;SPI2 vector
Vtpm3ovf next :temp,2 ;TPM3 overflow
next :temp,2*16 ;(reserved)
Expand Down
2 changes: 1 addition & 1 deletion code/blocks.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;* Programmer: Tony Papadimitriou <[email protected]>
;* Purpose : Structured block macros for ASM8 (Win32 & Linux versions, only)
;* Language : Motorola/Freescale/NXP HC08/9S08 Assembly Language (aspisys.com/ASM8)
;* Status : FREEWARE Copyright (c) 2020 by Tony Papadimitriou <[email protected]>
;* Status : FREEWARE Copyright (c) 2021 by Tony Papadimitriou <[email protected]>
;* Original : http://www.aspisys.com/code/hc08/blocks.html
;* Note(s) : Use: #Include blocks.inc
;*******************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion code/bvsbvc.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
;* Purpose : Macros to implement missing oVerflow bit instructions, i.e.,
;* : Set/Clear CCR[V], and non-CCR-destructive BVC and BVS equivalents
;* Language : Motorola/Freescale/NXP HC08/9S08 Assembly Language (aspisys.com/ASM8)
;* Status : FREEWARE Copyright (c) 2020 by Tony Papadimitriou <[email protected]>
;* Status : FREEWARE Copyright (c) 2021 by Tony Papadimitriou <[email protected]>
;* Original : http://www.aspisys.com/code/hc08/bvsbvc.html
;* Note(s) : Use: #Include bvsbvc.inc
;*******************************************************************************
Expand Down
132 changes: 99 additions & 33 deletions code/common.inc
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,10 @@ BUS_MHZ def BUS_KHZ/1000

#ifhcs
?calc_fll_factor macro
#ifdef _FL_
#ifdef _QD_
CHOICES$$$ equ 1
mset 0,512
#else ifdef _FL_
CHOICES$$$ equ 2
mset 0,512,608
#else ifdef _PA_¦_PT_¦_PL_
Expand Down Expand Up @@ -574,6 +577,19 @@ Var macro Size[,MaxSizeForRAM]
#pull
endm

;*******************************************************************************

asciz macro Size
#if * < EEPROM
rmb ~1~+1
#else
fcb:{~1~+1} 0
#endif
#ifnb ~label~
#size ~label~
#endif
endm

;*******************************************************************************
; Repeat a number of instructions a constant number of times
; Example: @rep 2,lsla,rolx ;shift left XA twice
Expand Down Expand Up @@ -742,39 +758,47 @@ _needs_spauto_ macro
; (This is meant to be called from other macros -- not to be called directly)

_not_x_ macro
mset #
mset #' '
#ifb ~1~
mexit ;;nothing to do
#endif
#ifparm ~'~,1~'.{:1}~ = x
mstop X-index not allowed (~1~)
#Error X-index not allowed (~1~)
#endif
mdel 1
mtop
endm

;*******************************************************************************
; Checks the passed parameter and issues an error if it is immediate mode
; (This is meant to be called from other macros -- not to be called directly)

_not_#_ macro
mset #' '
#ifb ~1~
mexit ;;nothing to do
#endif
#ifparm ~#~
mstop Immediate mode not allowed (~1~)
#Error Immediate mode not allowed (~1~)
#endif
mdel 1
mtop
endm

;*******************************************************************************
; Checks the passed parameter and issues an error if it is NOT immediate mode
; (This is meant to be called from other macros -- not to be called directly)

_#_ macro
mset #' '
#ifb ~1~
mexit ;;nothing to do
#endif
#ifb ~#~
mstop Immediate mode expected (~1~)
#Error Immediate mode expected (~1~)
#endif
mdel 1
mtop
endm

;*******************************************************************************
Expand Down Expand Up @@ -854,17 +878,28 @@ _size_ macro Label[,ExpectedSize]*
; Finally, load HX from the referenced location, regardless of addressing mode.
; (This is meant to be called from other macros -- not to be called directly)

_ldhx_ macro Parm[,RegHX]
_ldhx_ macro Parm[ RegHX]
mset #' '
mreq 1:Parm[,RegHX]
mdef 2,~text~
mset 0,~2~ ;;use this as new default
#ifb ~2~
merror RegHX location is needed 1st time
#endif
#ifnoparm ~,1~ = ,spx ;except for SPX mode ...
#ifparm ~'~,1~'.{:1}~ = x ;for any X-indexed mode
#ifparm ~,1~ = ,spx ;for SPX mode ...
tsx ;reload stack frame pointer
#else ;for all others
#ifhcs
ldhx ~2~ ;reload original HX
#endif
#else
psha
lda ~2~ ;reload original HX
ldx ~2,~+1~,2~
tah
pula
#endif
#endif
#endif
@lea ~1~ ;load actual parameter
endm
Expand Down Expand Up @@ -970,32 +1005,58 @@ PUE macro PortLabel
endm

;*******************************************************************************
; Get A from the location pointed to by the parm, while bumping up that pointer
; Check if a parameter is pointer

GetNextA macro Pointer
mreq 1:Pointer
_need_pointer_ macro pointer_variable
mreq 1:pointer_variable
mset 0,Pointer (~1~) must be a word variable
#ifparm ~#~
mstop Pointer (~1~) must be a word variable
mstop ~text~
#else if ::~1,~ <> 2
mstop ~text~
#endif
#ifb ~1.1.1~ = .
#ifb ~1.1.2~ = ?.
#ifb ~1,~ == _PC_
#ifb ~1.1.2~ == pc
#Hint By convention, start pointers with dot (~1~ => .~1~)
#endif
#endif
#endif
#endif
endm

;*******************************************************************************
; Get A from the location pointed to by the parm, while bumping up that pointer

GetNextA macro Pointer [DoneOnZero]
mset #' '
@@_need_pointer_ ~1~
@@_not_x_ ~@~
#ifhcs
ldhx ~@~
ldhx ~1~
lda ,x
#ifnb ~2~
beq ~2~
#endif
aix #1
sthx ~@~
sthx ~1~
#else
#push
#spauto :sp
ldx ~@~
ldx ~1~
pshx
ldx ~1,~+1~,1~,~2~
ldx ~1,~+1~,1~
pulh
lda ,x
#ifnb ~2~
beq ~2~
#endif
aix #1
stx ~1,~+1~,1~,~2~
stx ~1,~+1~,1~
pshx
thx
stx ~@~
stx ~1~
pulx
#pull
#endif
Expand All @@ -1004,30 +1065,34 @@ GetNextA macro Pointer
;*******************************************************************************
; Put A into the location pointed to by the parm, while bumping up that pointer

PutNextA macro Pointer
mreq 1:Pointer
#ifparm ~#~
mstop Pointer (~1~) must be a word variable
#endif
@@_not_x_ ~@~
PutNextA macro Pointer [DoneOnZero]
mset #' '
@@_need_pointer_ ~1~
@@_not_x_ ~1~
#ifhcs
ldhx ~@~
ldhx ~1~
sta ,x
#ifnb ~2~
beq ~2~
#endif
aix #1
sthx ~@~
sthx ~1~
#else
#push
#spauto :sp
ldx ~@~
ldx ~1~
pshx
ldx ~1,~+1~,1~,~2~
ldx ~1,~+1~,1~
pulh
sta ,x
#ifnb ~2~
beq ~2~
#endif
aix #1
stx ~1,~+1~,1~,~2~
stx ~1,~+1~,1~
pshx
thx
stx ~@~
stx ~1~
pulx
#pull
#endif
Expand Down Expand Up @@ -1513,14 +1578,15 @@ clr.s macro Variable [Size]
;*******************************************************************************
; INC for any sized variable

inc.s macro Variable
mset #
inc.s macro Variable [Branch]
mset #' '
mreq 1
mdef 2,Done$$$
@@_nosize_ ~1~
mdo
inc ~1,~+{::~1,~-:mloop}~,1~
#if :mloop <> ::~1,~
bne Done$$$
bne ~2~
#endif
mloop ::~1,~
Done$$$
Expand Down
30 changes: 6 additions & 24 deletions code/fl16.inc
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,12 @@ TPM2C0SC equ $15,1 ;TPM2 Timer Channel 0 Status a

; bit numbers for use in BCLR, BSET, BRCLR, and BRSET

@bitnum CHnF,7 ;channel 0 flag
@bitnum CHnIE,6 ;ch 0 interrupt enable
@bitnum MSnB,5 ;mode select B
@bitnum MSnA,4 ;mode select A
@bitnum ELSnB,3 ;edge/level select B
@bitnum ELSnA,2 ;edge/level select A
@bitnum CHxF,7 ;channel 0 flag
@bitnum CHxIE,6 ;ch 0 interrupt enable
@bitnum MSxB,5 ;mode select B
@bitnum MSxA,4 ;mode select A
@bitnum ELSxB,3 ;edge/level select B
@bitnum ELSxA,2 ;edge/level select A

TPM2C0V equ $16,2 ;TPM2 Timer Channel 0 Value Register
TPM2C0VH equ $16,1 ;TPM2 Timer Channel 0 Value Register High
Expand Down Expand Up @@ -301,24 +301,6 @@ TPM1C3V equ $2F,2 ;TPM1 Timer Channel 3 Value Re
TPM1C3VH equ $2F,1 ;TPM1 Timer Channel 3 Value Register High
TPM1C3VL equ $30,1 ;TPM1 Timer Channel 3 Value Register Low

; bit numbers for usage in BCLR, BSET, BRCLR and BRSET

@bitnum ELS2A,2 ;Edge/Level Select Bit A
@bitnum ELS2B,3 ;Edge/Level Select Bit B
@bitnum MS2A,4 ;Mode Select A for TPM Channel 2
@bitnum MS2B,5 ;Mode Select B for TPM Channel 2
@bitnum CH2IE,6 ;Channel 2 Interrupt Enable
@bitnum CH2F,7 ;Channel 2 Flag

; bit numbers for usage in BCLR, BSET, BRCLR and BRSET

@bitnum ELS3A,2 ;Edge/Level Select Bit A
@bitnum ELS3B,3 ;Edge/Level Select Bit B
@bitnum MS3A,4 ;Mode Select A for TPM Channel 3
@bitnum MS3B,5 ;Mode Select B for TPM Channel 3
@bitnum CH3IE,6 ;Channel 3 Interrupt Enable
@bitnum CH3F,7 ;Channel 3 Flag

; **** System Integration Module (SIM) *****************************************

SRS equ $1800,1 ;SIM reset status register
Expand Down
Loading

0 comments on commit 0796c9f

Please sign in to comment.