136 lines
1.4 KiB
ArmAsm
136 lines
1.4 KiB
ArmAsm
|
|
/*#include "romhdr.S"*/
|
|
#include "hw.S"
|
|
|
|
.global _start
|
|
_start:
|
|
;mov a, #'a'
|
|
;call !!0xeffa1
|
|
;ret
|
|
|
|
; call !hw_init
|
|
|
|
;1: call !glitch_mainloop
|
|
; br $1b
|
|
|
|
;1: br $1b
|
|
|
|
hw_init:
|
|
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
|
|
|
|
mov P2, #0
|
|
; ret
|
|
|
|
/* DUMPS EVERYTHING */
|
|
|
|
|
|
/* LONG WAITCODE THAT DOESNT DO ANYTHING */
|
|
|
|
/* mov c, #0xff
|
|
mov b, #0xff
|
|
|
|
1: dec c
|
|
bnz $1b
|
|
mov c, #0xff
|
|
dec b
|
|
bnz $1b
|
|
xor P2, #0xff
|
|
|
|
br $1b*/
|
|
|
|
/* GLITCH TESTING CODE */
|
|
|
|
|
|
/* TODO: how many segments do we need? */
|
|
mov es, #0
|
|
call !dump_segment
|
|
|
|
1: br $1b
|
|
|
|
dump_segment:
|
|
movw hl, #0
|
|
1: mov a, es:[hl]
|
|
push hl
|
|
call !!tool_tx
|
|
pop hl
|
|
incw hl
|
|
movw ax, hl
|
|
cmpw ax, #0
|
|
bnz $1b
|
|
mov es, #0xf
|
|
ret
|
|
|
|
/*
|
|
glitch_mainloop:
|
|
mov P2, #0xff
|
|
|
|
movw ax, #0xfa00
|
|
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
|
|
|
|
mov P2, #0
|
|
|
|
; wait a bit
|
|
mov c, #0x18
|
|
4: mov b, #0xff
|
|
5: dec b
|
|
bnz $5b
|
|
dec c
|
|
bnz $4b
|
|
|
|
mov a, #'H'
|
|
call !!tool_tx
|
|
mov a, #'i'
|
|
call !!tool_tx
|
|
|
|
mov x, #0xaa
|
|
mov c, #0
|
|
3: dec c
|
|
mov a, [hl+c]
|
|
xor a, x
|
|
call !!tool_tx
|
|
cmp0 c
|
|
bnz $3b
|
|
|
|
br $glitch_mainloop
|
|
|
|
;ret
|
|
|
|
;data:
|
|
*/
|