pico430prog/test/rl78/test_g23_param.S

107 lines
1.2 KiB
ArmAsm

/*#include "romhdr.S"*/
#include "hw.S"
#define REG_ASIM 0xfffaf
#define REG_TXS 0xfffad
#define tool_tx_g23 0xeeac0
/*#define TX_FUNC !!tool_tx_g23*/
#define TX_FUNC $!my_tool_tx
.global _start
_start:
;mov a, #'a'
;call !!0xeffa1
;ret
di
clrb !CRC0CTL
clrb !IAWCTL
;CRC0CTL = 0 ; f02f0
;IAWCTL = 0 ; f0078
; CSC=fffa1
; CKC=fffa4
;CMC = 0 ; 0xfffa0
;MSTOP = 1 ; CSC.7
;MCM0 = 0 ; CKC.4
;XTSTOP = 0 ; CSC.6
;OSMC = 0 ; f00f3
;CSS = 0 ; CKC.6 ;!
;set1 CKC.6
;HIOSTOP = 0 ; CSC.0
; mov !ADPC, #1
;ADPC = 1 ; f0076
mov PM2, #0
clrb !PMC2
clrb !PIOR0
clrb !PIOR1
clrb !PIOR2
clrb !PIOR3
clrb P2
movw sp, #0xfe00
glitch_mainloop:
mov P2, #0xff
mov P2, #0xff
movw ax, #0xc000
movw ax, #0xc000
movw hl, ax
movw hl, ax
mov c, #0
2: mov b, #0xff
mov a, #0
1: inc a
dec b
bnz $1b
dec c
mov [hl+c], a
bnz $2b
clrb P2
clrb P2
; wait a bit
mov c, #0x18
4: mov b, #0xff
5: dec b
bnz $5b
dec c
bnz $4b
mov a, #'H'
call TX_FUNC
mov a, #'i'
call TX_FUNC
mov x, #0xaa
mov c, #0
3: dec c
mov a, [hl+c]
xor a, x
call TX_FUNC
cmp0 c
bnz $3b
br $glitch_mainloop
my_tool_tx:
set1 REG_ASIM.7
nop
mov REG_TXS, a
wait_sent:
bf REG_ASIM.3, $wait_sent
clr1 REG_ASIM.3
clr1 REG_ASIM.7
ret