on internet may 2013 on gpl v. 2 see copying file
;
; reverse enginering of MF107
; th15jan97 XD. su18jan98 XD.
;
; rev. 0
; tc:  6
;
; tabella vettori d'interrupt
	.org 0000H
	.word 0
	.word 0
	.word 0255H ; P31 rise fall edge
	.word 0
	.word 005AH ; timer 0
	.word 005FH ; timer 1
; il reset parte da qua'
	.org 000CH
          DI  
          SRP  #%10 
          LD   %70,#%0
          LD   %71,#%0
; setup dei timers
          LD   T0,#%64
          LD   PRE0,#%C9
          LD   T1,#%7D
          LD   PRE1,#%13
; setup delle porte
          LD   P2M,#%0
          LD   P3M,#%1
          LD   P01M,#%4
;
          CLR  P0
          CLR  R15
; setup registri di interrupt
          LD   IPR,#%8
          LD   IMR,#%34
; setup stack pointer low
          LD   SPL,#%90
; load enable t0 t1
          LD   TMR,#%F
;
          LD   R2,#%4
          LD   R15,#%C
          LD   %50,#%A
          CLR  @R2
          INC  R2
          DJNZ R15,%0041
          CALL %011E
          LD   %8,#%12
          LD   R3,#%20
          LD   P3,#%50
          LD   %67,#%0
          LD   P2M,%67
; main loop
          EI   
          JR   %0057
; routine sotto interrupt
          DI   
          CALL %0081
          IRET
; routine sotto interrupt 
          DI   
          PUSH RP
          SRP  #%10
          INC  R3
          INC  R8
          CP   R8,#%24
          JR   C,%0072
          CLR  R8
          LD   R3,#%20
          OR   P3,#%40
          LD   R5,@R3
          COM  R5
          LD   P0,R5
          OR   P3,#%20
          AND  P3,#%10
          POP  RP
          IRET
; 
          DI   
          PUSH RP
          SRP  #%10
          TM   %4,#%2
          JR   NZ,%009B
          CALL %011E
          OR   %4,#%2
          LD   %71,#%0
          CALL %00DE
          LD   R9,#%6
          JR   %00C4
          DEC  %50
          JR   NZ,%00CD
          LD   %50,#%A
          CP   R9,#%0
          JR   NZ,%00C4
          TM   %4,#%4
          JR   Z,%00BD
          LD   R6,#%0
          CALL %00D0
          INC  R4
          CP   R4,#%24
          JR   C,%00CD
          CLR  %4
          CLR  R4
          JR   %00CD
          LD   R9,#%6
          INC  %71
          CALL %00DE
          LDC  R6,@RR12
          CALL %00D0
          INCW RR12
          DEC  R9
          POP  RP
          RET  
;
          LD   R15,#%24
          LD   R2,#%20
          LD   R7,@R2
          LD   @R2,R6
          LD   R6,R7
          INC  R2
          DJNZ R15,%00D4
          RET 
; 
          LD   R12,#%4
          LD   R13,#%80
          LD   %67,#%A0
          LD   %65,%71
          LD   %66,#%54
          LD   %68,#%1
          CALL %017A
          LD   R14,%54
          CP   R14,#%0
          JR   NZ,%0107
          OR   %4,#%4
          JR   %011D
          CP   R14,#%FF
          JR   NZ,%0107
          OR   %4,#%4
          JR   %011D
          SUB  R14,#%20
          JR   Z,%011D
          INCW RR12
          INCW RR12
          INCW RR12
          INCW RR12
          INCW RR12
          INCW RR12
          DJNZ R14,%010F
          RET
;  
          LD   R15,#%24
          LD   R2,#%20
          CLR  @R2
          INC  R2
          DJNZ R15,%0122
          RET
;  
          LD   %67,#%A0
          LD   %65,#%0
          LD   %66,#%4A
          LD   %68,#%10
          CALL %0155
          LD   %67,#%A0
          LD   %65,#%0
          LD   %66,#%54
          LD   %68,#%8
          CALL %017A
          LD   %67,#%A0
          LD   %66,#%58
          LD   %68,#%8
          CALL %0189
          JP   %0128
          CALL %01F6
          LD   %60,%65
          CALL %01CC
          CALL %01E3
          JP   C,%0252
          LD   %60,@%66
          CALL %01CC
          CALL %01E3
          JP   C,%0252
          INC  %66
          DEC  %68
          JR   NZ,%0164
          CALL %0228
          RET
;  
          CALL %01F6
          LD   %60,%65
          CALL %01CC
          CALL %01E3
          JP   C,%0252
          CALL %0215
          OR   %67,#%1
          LD   %60,%67
          CALL %01CC
          CALL %01E3
          JP   C,%0252
          CALL %01B3
          LD   @%66,%60
          DEC  %68
          JR   Z,%01AC
          CALL %0236
          INC  %66
          JR   %019B
          CALL %023D
          CALL %0228
          RET
;  
          OR   %67,#%10
          LD   P2M,%67
          LD   %63,#%8
          CALL %0244
          RLC  %60
          DEC  %63
          JR   NZ,%01BC
          AND  %67,#%EF
          LD   P2M,%67
          RET  
;
          LD   %63,#%8
          RLC  %60
          JR   C,%01D8
          AND  P2,#%EF
          JR   %01DB
          OR   P2,#%10
          CALL %0244
          DEC  %63
          JR   NZ,%01CF
          RET  
;
          OR   %67,#%10
          LD   P2M,%67
          OR   P2,#%10
          CALL %0244
          AND  %67,#%EF
          LD   P2M,%67
          RET  
;
          LD   %64,#%0
          DEC  %64
          JR   Z,%020C
          CALL %0215
          LD   %60,%67
          CALL %01CC
          CALL %01E3
          JR   C,%01F9
          RET  
;
          CALL %0228
          JP   %0252
          OR   P2,#%10
          NOP  
          NOP  
          OR   P2,#%8
          NOP  
          NOP  
          AND  P2,#%EF
          NOP  
          NOP  
          AND  P2,#%F7
          RET  
          AND  P2,#%EF
          NOP  
          NOP  
          OR   P2,#%8
          NOP  
          NOP  
          OR   P2,#%10
          RET  
          AND  P2,#%EF
          CALL %0244
          RET  
;
          OR   P2,#%10
          CALL %0244
          RET
;  
          OR   P2,#%8
          SCF  
          TM   P2,#%10
          JR   NZ,%024E
          RCF  
          AND  P2,#%F7
          RET  
;
          JP   %0252
; routine sotto interrupt
          DI   
          PUSH RP
          LD   R7,#%0
          LD   R9,#%8
          SRP  #%40
          CALL %02B1
          LD   R7,#%5A
          DEC  R7
          JR   NZ,%0263
          LD   %46,#%0
          LD   R9,#%8
          LD   R7,P3
          AND  R7,#%2
          RCF  
          RR   R7
          RR   R7
          RRC  %46
          CALL %02B1
          DEC  R9
          JR   NZ,%026C
          LD   %67,#%A0
          LD   %65,%70
          LD   %4A,%46
          LD   %66,#%4A
          LD   %68,#%1
          CALL %0155
          INC  %70
          LD   %67,#%A0
          LD   %65,%70
          LD   %4A,#%0
          LD   %66,#%4A
          LD   %68,#%1
          CALL %0155
          CALL %02B1
          CALL %02B1
          LD   IRQ,#%0
          POP  RP
          IRET
; routine di ritardo per 1200 baud
          LD   R8,#%B2
          DEC  R8
          JR   NZ,%02B3
          RET
; fine 02B7H
; segue tabella a 0480 solo maiuscole
;
;
; ascii lookup table
;
	.org 480H
; simboli
CHARTBL .byte 0,0,0,0,0,0           ; 20H sp
	.byte 0,0,0,7DH,0,0         ; 21H !
	.byte 0,0,70H,0,70H,0       ; 22H "
	.byte 0,14H,7FH,14H,7FH,14H ; 23H #
	.byte 0,12H,2AH,7FH,2AH,24H ; 24H $
	.byte 0,62H,64H,08H,13H,23H ; 25H %
	.byte 0,36H,49H,35H,02H,05H ; 26H &
	.byte 0,0,0,70H,0,0         ; 27H '
	.byte 0,1CH,22H,41H,0,0     ; 28H (
	.byte 0,0,0,41H,22H,1CH     ; 29H )
	.byte 0,22H,14H,7FH,14H,22H ; 2AH *
	.byte 0,08H,08H,3EH,08H,08H ; 2BH +
	.byte 0,0,01H,06H,0,0       ; 2CH ,
	.byte 0,08H,08H,08H,08H,08H ; 2DH -
	.byte 0,0,0,01H,0,0         ; 2EH .
	.byte 0,02H,04H,08H,10H,20H ; 2FH /
; numeri
	.byte 0,3EH,45H,49H,51H,3EH ; 30H 0
	.byte 0,0,21H,7FH,01H,0     ; 31H 1
	.byte 0,23H,45H,49H,49H,31H ; 32H 2
	.byte 0,42H,41H,49H,59H,66H ; 33H 3
	.byte 0,0CH,14H,24H,7FH,04H ; 34H 4
	.byte 0,72H,51H,51H,51H,4EH ; 35H 5
	.byte 0,1EH,29H,49H,49H,46H ; 36H 6
	.byte 0,40H,47H,48H,50H,60H ; 37H 7
	.byte 0,36H,49H,49H,49H,36H ; 38H 8
	.byte 0,31H,49H,49H,4AH,3CH ; 39H 9
; altri caratteri speciali
	.byte 0,0,0,14H,0,0         ; 3AH :
	.byte 0,0,01H,16H,0,0       ; 3BH ;
	.byte 0,08H,14H,22H,41H,0   ; 3CH <
	.byte 0,14H,14H,14H,14H,14H ; 3DH =
	.byte 0,0,41H,22H,14H,08H   ; 3EH >
	.byte 0,20H,40H,4DH,50H,20H ; 3FH ?
; lettere maiuscole
	.byte 0,3EH,41H,5DH,4DH,39H ; 40H @
	.byte 0,1FH,24H,44H,24H,1FH ; 41H A
	.byte 0,7FH,49H,49H,49H,36H ; 42H B
	.byte 0,3EH,41H,41H,41H,22H ; 43H C
	.byte 0,7FH,41H,41H,41H,3EH ; 44H D
	.byte 0,7FH,49H,49H,49H,41H ; 45H E
	.byte 0,7FH,48H,48H,48H,40H ; 46H F
	.byte 0,3EH,41H,41H,45H,47H ; 47H G
	.byte 0,7FH,08H,08H,08H,7FH ; 48H H
	.byte 0,00H,41H,7FH,41H,00H ; 49H I
	.byte 0,02H,01H,01H,01H,7EH ; 4AH J
	.byte 0,7FH,08H,14H,22H,41H ; 4BH K
	.byte 0,7FH,01H,01H,01H,01H ; 4CH L
	.byte 0,7FH,20H,18H,20H,7FH ; 4DH M
	.byte 0,7FH,10H,08H,04H,7FH ; 4EH N
	.byte 0,3EH,41H,41H,41H,3EH ; 4FH O
	.byte 0,7FH,48H,48H,48H,30H ; 50H P
	.byte 0,3EH,41H,45H,42H,3DH ; 51H Q
	.byte 0,7FH,48H,4CH,4AH,31H ; 52H R
	.byte 0,32H,49H,49H,49H,26H ; 53H S
	.byte 0,40H,40H,7FH,40H,40H ; 54H T
	.byte 0,7EH,01H,01H,01H,7EH ; 55H U
	.byte 0,7CH,02H,01H,02H,7CH ; 56H V
	.byte 0,7FH,02H,0CH,02H,7FH ; 57H W
	.byte 0,63H,14H,08H,14H,63H ; 58H X
	.byte 0,60H,10H,0FH,10H,60H ; 59H Y
	.byte 0,43H,45H,49H,51H,61H ; 5AH Z
	.byte 0,7FH,7FH,41H,41H,41H ; 5BH [
	.byte 0,20H,10H,08H,04H,02H ; 5CH 
	.byte 0,41H,41H,41H,7FH,7FH ; 5DH ]
	.byte 0,04H,08H,10H,08H,04H ; 5EH ^
	.byte 0,01H,01H,01H,01H,01H ; 5FH _
;
;
	.end
;
;