
 
 n a k e n _ u t i l   -   b y   M i c h a e l   K o h n 
 
                                 J o e   D a v i s s o n 
 
         W e b :   h t t p : / / w w w . m i k e k o h n . n e t / 
 
     E m a i l :   m i k e @ m i k e k o h n . n e t 
 
 
 
 V e r s i o n :   
 
 
 
 L o a d e d   t i _ t x t   R e t r i e v e d H E X _ S t r i p p e d . t x t   f r o m   0 x 3 1 0 0   t o   0 x 3 1 d 3 
 
 T y p e   h e l p   f o r   a   l i s t   o f   c o m m a n d s . 
 
 
 
 A d d r         O p c o d e   I n s t r u c t i o n                                                             
 
 - - - - - - -   - - - - - -   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -               
 
 0 x 3 1 0 0 :   0 x 4 0 b 2   m o v . w   # 0 x 5 a 8 0 ,   & 0 x 0 1 2 0                                           ;   S t o p   W a t c h D o g   T i m e r 
 
 0 x 3 1 0 2 :   0 x 5 a 8 0 
 
 0 x 3 1 0 4 :   0 x 0 1 2 0 
 
 0 x 3 1 0 6 :   0 x d 2 e 2   b i s . b   # 4 ,   & 0 x 0 0 2 a                                                     ;   p o r t   2   b i t 3   d i r e c t i o n   f o r   o u t p u t 
 
 0 x 3 1 0 8 :   0 x 0 0 2 a 
 
 0 x 3 1 0 a :   0 x c 3 e 2   b i s . b   # 2 ,   & 0 x 0 0 2 a                                                     ;   p o r t   2   b i t 1   d i r e c t i o n   f o r   o u t p u t 
 
 0 x 3 1 0 c :   0 x 0 0 2 a 
 
 0 x 3 1 0 e :   0 x c 2 e 2   b i c . b   # 4 ,   & 0 x 0 0 2 9                                                     ;   P 2 O U T   b i t 3   i s   c l e a r e d 
 
 0 x 3 1 1 0 :   0 x 0 0 2 9 
 
 0 x 3 1 1 2 :   0 x d 3 e 2   b i c . b   # 2 ,   & 0 x 0 0 2 9                                                     ;   P 2 O U T   B I T 1   i s   c l e a r e d 
 
 0 x 3 1 1 4 :   0 x 0 0 2 9 
 
 0 x 3 1 1 6 :   0 x c 3 d 2   b i c . b   # 1 ,   & 0 x 0 0 2 2                                                     ;   P 1 D I R   b i t 0   i s   c l e a r e d   ( s e t   t o   i n p u t ) 
 
 0 x 3 1 1 8 :   0 x 0 0 2 2 
 
 0 x 3 1 1 a :   0 x c 3 e 2   b i c . b   # 2 ,   & 0 x 0 0 2 2                                                     ;   P 1 D I R   B I T 1   i s   c l e a r e d   ( s e t   t o   i n p u t ) 
 
 0 x 3 1 1 c :   0 x 0 0 2 2 
 
 0 x 3 1 1 e :   0 x b 3 e 2   b i t . b   # 2 ,   & 0 x 0 0 2 0                                                     ;   P 1 I N   B I T 1   t e s t   t o   b e   h i g h 
 
 0 x 3 1 2 0 :   0 x 0 0 2 0 
 
 0 x 3 1 2 2 :   0 x 2 3 f d   j n e   0 x 3 1 1 e     ( o f f s e t :   - 6 )                                       ;   B i t   t e s t   w i t h   b i t 1   -   i f   z e r o   i s   r e s e t ,   t e s t   a g a i n ; 
 
                                                                                                                     ;   l o o p s   u n t i l   s w i t c h   i s   p r e s s e d 
 
 0 x 3 1 2 4 :   0 x 1 2 0 d   p u s h . w   r 1 3                                                                   ;   p u s h i n g   r e g i s t e r 1 3   o n t o   s t a c k 
 
 0 x 3 1 2 6 :   0 x 4 0 3 d   m o v . w   # 0 x 0 3 1 d ,   r 1 3                                                   ;   m o v e   w h a t e v e r   i s   a t   0 x 0 3 1 d   t o   r 1 3 
 
 0 x 3 1 2 8 :   0 x 0 3 1 d 
 
 0 x 3 1 2 a :   0 x 8 3 1 d   s u b . w   # 1 ,   r 1 3                                                             ;   s u b t r a c t   1   f r o m   r 1 3 
 
 0 x 3 1 2 c :   0 x 2 3 f e   j n e   0 x 3 1 2 a     ( o f f s e t :   - 4 )                                       ;   i f   r 1 3   i s   n o t   1   ( e q u a l   t o   z e r o ) ,   l o o p   b a c k   t o   s u b t r a c t i n g   1 
 
 0 x 3 1 2 e :   0 x 4 1 3 d   p o p . w   r 1 3       - -     m o v . w   @ S P + ,   r 1 3                     
 
 0 x 3 1 3 0 :   0 x 3 c 0 0   j m p   0 x 3 1 3 2     ( o f f s e t :   0 )                                         ;   j u m p   t o   a d d r e s s   0 x 3 1 3 2 
 
 0 x 3 1 3 2 :   0 x b 3 e 2   b i t . b   # 2 ,   & 0 x 0 0 2 0                                                     ;   t e s t i n g   B I T 1 
 
 0 x 3 1 3 4 :   0 x 0 0 2 0 
 
 0 x 3 1 3 6 :   0 x 2 3 f 3   j n e   0 x 3 1 1 e     ( o f f s e t :   - 2 6 )                                     ;   i f   s w i t c h   i s   p r e s s e d ,   z e r o   i s   s e t 
 
                                                                                                                     ;   i f   s w i t c h   i s   n o t   p r e s s e d ,   z e r o   i s   r e s e t   
 
 0 x 3 1 3 8 :   0 x b 3 e 2   b i t . b   # 2 ,   & 0 x 0 0 2 0                                                     ;   P 1 I N   B I T 1   t e s t   t o   b e   h i g h 
 
 0 x 3 1 3 a :   0 x 0 0 2 0 
 
 0 x 3 1 3 c :   0 x 2 3 f d   j n e   0 x 3 1 3 8     ( o f f s e t :   - 6 )                                       ;   i f   z e r o   i s   r e s e t ,   t e s t   a g a i n ; 
 
                                                                                                                     ;   i f   z e r o ,   m o v e   o n 
 
 0 x 3 1 3 e :   0 x 1 2 0 d   p u s h . w   r 1 3                                                                   ;   p u s h i n g   r 1 3   o n t o   s t a c k 
 
 0 x 3 1 4 0 :   0 x 4 0 3 d   m o v . w   # 0 x 0 3 1 d ,   r 1 3                                                   ;   s a m e   a s   0 x 3 1 2 6 
 
 0 x 3 1 4 2 :   0 x 0 3 1 d 
 
 0 x 3 1 4 4 :   0 x 8 3 1 d   s u b . w   # 1 ,   r 1 3                                                             ;   s u b t r a c t   1   f r o m   r 1 3 
 
 0 x 3 1 4 6 :   0 x 2 3 f e   j n e   0 x 3 1 4 4     ( o f f s e t :   - 4 )                                       ;   i f   r 1 3   i s   n o t   1   ( e q u a l   t o   z e r o ) ,   l o o p   b a c k   t o   s u b t r a c t i n g   1 
 
 0 x 3 1 4 8 :   0 x 4 1 3 d   p o p . w   r 1 3       - -     m o v . w   @ S P + ,   r 1 3                         ;   p o p   r 1 3   o f f   s t a c k 
 
 0 x 3 1 4 a :   0 x 3 c 0 0   j m p   0 x 3 1 4 c     ( o f f s e t :   0 )                                         ;   j u m p   t o   a d d r e s s   0 x 3 1 4 c 
 
 0 x 3 1 4 c :   0 x b 3 e 2   b i t . b   # 2 ,   & 0 x 0 0 2 0                                                     ;   t e s t i n g   B I T 1   h i g h 
 
 0 x 3 1 4 e :   0 x 0 0 2 0 
 
 0 x 3 1 5 0 :   0 x 2 3 f 3   j n e   0 x 3 1 3 8     ( o f f s e t :   - 2 6 )                                     ;   l o o p   b a c k   t o   0 x 3 1 3 8 
 
 0 x 3 1 5 2 :   0 x b 3 d 2   b i t . b   # 1 ,   & 0 x 0 0 2 0                                                     ;   t e s t i n g   B I T 0   h i g h 
 
 0 x 3 1 5 4 :   0 x 0 0 2 0 
 
 0 x 3 1 5 6 :   0 x 2 3 f d   j n e   0 x 3 1 5 2     ( o f f s e t :   - 6 )                                       ;   i f   z e r o   i s   r e s e t ,   t e s t   a g a i n ; 
 
                                                                                                                     ;   i f   z e r o ,   m o v e   o n 
 
 0 x 3 1 5 8 :   0 x 1 2 0 d   p u s h . w   r 1 3                                                                   ;   p u s h   r 1 3   o n t o   s t a c k 
 
 0 x 3 1 5 a :   0 x 4 0 3 d   m o v . w   # 0 x 0 3 1 d ,   r 1 3                                                   ;   m o v e   w h a t e v e r   i s   a t   0 x 0 3 1 d   t o   r 1 3 
 
 0 x 3 1 5 c :   0 x 0 3 1 d 
 
 0 x 3 1 5 e :   0 x 8 3 1 d   s u b . w   # 1 ,   r 1 3                                                             ;   s u b t r a c t   1   f r o m   r 1 3 
 
 0 x 3 1 6 0 :   0 x 2 3 f e   j n e   0 x 3 1 5 e     ( o f f s e t :   - 4 )                                       ;   i f   r 1 3   i s   n o t   1   ( e q u a l   t o   z e r o ) ,   l o o p   b a c k   t o   s u b t r a c t i n g   1 
 
 0 x 3 1 6 2 :   0 x 4 1 3 d   p o p . w   r 1 3       - -     m o v . w   @ S P + ,   r 1 3                         ;   p o p   r 1 3   o f f   s t a c k 
 
 0 x 3 1 6 4 :   0 x 3 c 0 0   j m p   0 x 3 1 6 6     ( o f f s e t :   0 )                                         ;   j u m p   t o   0 x 3 1 6 6 
 
 0 x 3 1 6 6 :   0 x b 3 d 2   b i t . b   # 1 ,   & 0 x 0 0 2 0                                                     ;   t e s t i n g   B I T 0   h i g h 
 
 0 x 3 1 6 8 :   0 x 0 0 2 0 
 
 0 x 3 1 6 a :   0 x 2 3 f 3   j n e   0 x 3 1 5 2     ( o f f s e t :   - 2 6 )                                     ;   i f   z e r o   b i t   r e s e t ,   t e s t   a g a i n ; 
 
                                                                                                                     ;   l o o p s   u n t i l   s w i t c h   i s   p r e s s e d 
 
 0 x 3 1 6 c :   0 x e 2 e 2   x o r . b   # 4 ,   & 0 x 0 0 2 9                                                     ;   t o g g l e   P 2 . 3 
 
 0 x 3 1 6 e :   0 x 0 0 2 9 
 
 0 x 3 1 7 0 :   0 x 1 2 0 d   p u s h . w   r 1 3                                                                   ;   p u s h   r 1 3   o n t o   s t a c k 
 
 0 x 3 1 7 2 :   0 x 1 2 0 e   p u s h . w   r 1 4                                                                   ;   p u s h   r 1 4   o n t o   s t a c k 
 
 0 x 3 1 7 4 :   0 x 4 0 3 d   m o v . w   # 0 x 8 b 8 0 ,   r 1 3                                                   ;   m o v e   0 x 8 b 8 0   i n t o   r 1 3 
 
 0 x 3 1 7 6 :   0 x 8 b 8 0 
 
 0 x 3 1 7 8 :   0 x 4 3 0 e   m o v . w   # 0 ,   r 1 4                                                             ;   m o v e   0   i n t o   r 1 4   
 
 0 x 3 1 7 a :   0 x 8 3 1 d   s u b . w   # 1 ,   r 1 3                                                             ;   s u b t r a c t   1   f r o m   r 1 3 
 
 0 x 3 1 7 c :   0 x 7 3 0 e   s u b c . w   # 0 ,   r 1 4                                                           ;   s u b t r a c t   w i t h   c a r r y   0   f r o m   r 1 4 
 
 0 x 3 1 7 e :   0 x 2 3 f d   j n e   0 x 3 1 7 a     ( o f f s e t :   - 6 )                                       ;   j u m p   t o   0 x 3 1 7 a   i f   n o t   z e r o ,   i f   z e r o   m o v e   o n   -   d e b o u n c i n g   f o r   L E D s 
 
 0 x 3 1 8 0 :   0 x 9 3 0 d   c m p . w   # 0 ,   r 1 3                                                             ;   C o m p a r e   z e r o   t o   r 1 3 
 
 0 x 3 1 8 2 :   0 x 2 3 f b   j n e   0 x 3 1 7 a     ( o f f s e t :   - 1 0 )                                     ;   j u m p   t o   0 x 3 1 7 a   i f   z e r o   b i t   i s   s e t 
 
 0 x 3 1 8 4 :   0 x 4 1 3 e   p o p . w   r 1 4       - -     m o v . w   @ S P + ,   r 1 4                         ;   p o p   r 1 4   f r o m   s t a c k 
 
 0 x 3 1 8 6 :   0 x 4 1 3 d   p o p . w   r 1 3       - -     m o v . w   @ S P + ,   r 1 3                         ;   p o p   r 1 3   f r o m   s t a c k 
 
 0 x 3 1 8 8 :   0 x 3 c 0 0   j m p   0 x 3 1 8 a     ( o f f s e t :   0 )                                         ;   j u m p   t o   0 x 3 1 8 a 
 
 0 x 3 1 8 a :   0 x 4 3 0 3   n o p       - -     m o v . w   # 0 ,   C G                                           ;   n o p 
 
 0 x 3 1 8 c :   0 x e 3 e 2   x o r . b   # 2 ,   & 0 x 0 0 2 9                                                     ;   t o g g l e   P 2 . 1 
 
 0 x 3 1 8 e :   0 x 0 0 2 9 
 
 0 x 3 1 9 0 :   0 x 1 2 0 d   p u s h . w   r 1 3                                                                   ;   p u s h   r 1 3   o n t o   s t a c k 
 
 0 x 3 1 9 2 :   0 x 1 2 0 e   p u s h . w   r 1 4                                                                   ;   p u s h   r 1 4   o n t o   s t a c k 
 
 0 x 3 1 9 4 :   0 x 4 0 3 d   m o v . w   # 0 x 2 8 4 4 ,   r 1 3                                                   ;   m o v e   # 0 x 2 8 4 4   i n t o   r 1 3 
 
 0 x 3 1 9 6 :   0 x 2 8 4 4 
 
 0 x 3 1 9 8 :   0 x 4 3 1 e   m o v . w   # 1 ,   r 1 4                                                             ;   m o v e   1   i n t o   r 1 4 
 
 0 x 3 1 9 a :   0 x 8 3 1 d   s u b . w   # 1 ,   r 1 3                                                             ;   s u b t r a c t i n g   1   f r o m   r 1 3 
 
 0 x 3 1 9 c :   0 x 7 3 0 e   s u b c . w   # 0 ,   r 1 4                                                           ;   s u b t r a c t   w i t h   c a r r y   0   f r o m   r 1 4 
 
 0 x 3 1 9 e :   0 x 2 3 f d   j n e   0 x 3 1 9 a     ( o f f s e t :   - 6 )                                       ;   j u m p   t o   0 x 3 1 9 a   i f   n o t   z e r o ,   i f   z e r o   m o v e   o n 
 
 0 x 3 1 a 0 :   0 x 9 3 0 d   c m p . w   # 0 ,   r 1 3                                                             ;   C o m p a r e   z e r o   t o   r 1 3 
 
 0 x 3 1 a 2 :   0 x 2 3 f b   j n e   0 x 3 1 9 a     ( o f f s e t :   - 1 0 )                                     ;   j u m p   t o   0 x 3 1 9 a   i f   n o t   z e r o ,   i f   z e r o   m o v e   o n 
 
 0 x 3 1 a 4 :   0 x 4 1 3 e   p o p . w   r 1 4       - -     m o v . w   @ S P + ,   r 1 4                         ;   p o p   r 1 4   o f f   s t a c k 
 
 0 x 3 1 a 6 :   0 x 4 1 3 d   p o p . w   r 1 3       - -     m o v . w   @ S P + ,   r 1 3                         ;   p o p   r 1 3   o f f   s t a c k 
 
 0 x 3 1 a 8 :   0 x 3 c 0 0   j m p   0 x 3 1 a a     ( o f f s e t :   0 )                                         ;   j u m p   t o   0 x 3 1 a a 
 
 0 x 3 1 a a :   0 x 4 3 0 3   n o p       - -     m o v . w   # 0 ,   C G                                           ;   n o p   f o r   d e b o u n c i n g 
 
 0 x 3 1 a c :   0 x 3 f d f   j m p   0 x 3 1 6 c     ( o f f s e t :   - 6 6 )                                     ;   j u m p   t o   b i c   a t   0 x 3 1 6 c 
 
 0 x 3 1 a e :   0 x 4 0 3 1   m o v . w   # 0 x 3 1 0 0 ,   S P                                                     ;   s e t   S P   t o   0 x 3 1 0 0 
 
 0 x 3 1 b 0 :   0 x 3 1 0 0 
 
 0 x 3 1 b 2 :   0 x 1 2 b 0   c a l l   # 0 x 3 1 c 8                                                               ;   c a l l   f u n c t i o n   a t   0 x 3 1 c 8 
 
 0 x 3 1 b 4 :   0 x 3 1 c 8 
 
 0 x 3 1 b 6 :   0 x 4 3 0 c   m o v . w   # 0 ,   r 1 2                                                             ;   m o v e   0   i n t o   r 1 2 
 
 0 x 3 1 b 8 :   0 x 1 2 b 0   c a l l   # 0 x 3 1 0 0                                                               ;   c a l l   f u n c t i o n   a t   0 x 3 1 0 0 
 
 0 x 3 1 b a :   0 x 3 1 0 0 
 
 0 x 3 1 b c :   0 x 4 3 1 c   m o v . w   # 1 ,   r 1 2                                                             ;   m o v e   1   i n t o   r 1 2 
 
 0 x 3 1 b e :   0 x 1 2 b 0   c a l l   # 0 x 3 1 c 2                                                               ;   c a l l   f u n c t i o n   a t   0 x 3 1 c 2 
 
 0 x 3 1 c 0 :   0 x 3 1 c 2 
 
 0 x 3 1 c 2 :   0 x 4 3 0 3   n o p       - -     m o v . w   # 0 ,   C G                                           ;   n o p 
 
 0 x 3 1 c 4 :   0 x 3 f f f   j m p   0 x 3 1 c 4     ( o f f s e t :   - 2 )                                       ;   j u m p   t o   i t s e l f   -   i n f i n i t e   l o o p 
 
 0 x 3 1 c 6 :   0 x 4 3 0 3   n o p       - -     m o v . w   # 0 ,   C G                                           ;   n o p 
 
 0 x 3 1 c 8 :   0 x 4 3 1 c   m o v . w   # 1 ,   r 1 2                                                             ;   m o v e   1   i n t o   r 1 2 
 
 0 x 3 1 c a :   0 x 4 1 3 0   r e t       - -     m o v . w   @ S P + ,   P C                                       ;   r e t u r n   f r o m   m a i n 
 
 0 x 3 1 c c :   0 x d 0 3 2   b i s . w   # 0 x 0 0 1 0 ,   S R                                                     ;   s e t   B I T 4   i n   S R 
 
 0 x 3 1 c e :   0 x 0 0 1 0 
 
 0 x 3 1 d 0 :   0 x 3 f f d   j m p   0 x 3 1 c c     ( o f f s e t :   - 6 )                                       ;   j u m p   t o   b i s   i n s t r u c t i o n 
 
 0 x 3 1 d 2 :   0 x 4 3 0 3   n o p       - -     m o v . w   # 0 ,   C G                                           ;   n o p 
 
 