Almost lost technologies

ここは昔の CPU を用いた工作記事を書くために用意しました。

SBC SC/MP-III デバッグ開始 (5)


シリアルまではOKです。次は動くようになったシリアルで NIBL を移植の予定。

 

 

SBC8070 基板の修正版
           1/       0 :                     ; Stest for INS8070 by efialtes_yh
       2/       0 :                     	CPU	8070
       3/       0 : =INS8070            TARGET:	EQU	"INS8070"
       4/       0 :                     
       5/       0 :                     ; 0x0000-0x3fff			ROM
       6/       0 :                     ; 0x4000-0xadff, 0xfe00-0xffff	RAM
       7/       0 :                     ; 0xfc00-0xfc3f			SERIAL INTERFACE
       8/       0 :                     
       9/       0 :                     ; more constants
      10/       0 : =0x4200             STACK:	 EQU	0x4200		; hardware stack
      11/       0 : =0xFC00             SERBASE: EQU	0xfc00		; serial interface base address
      12/       0 : =0xFC01             SERINTE: EQU	0xfc01		; serial interrupt enable
      13/       0 : =0xFC02             SERIID:  EQU	0xfc02		; serial interrupt identification (READ)
      14/       0 : =0xFC02             SERFCNT: EQU	0xfc02		; serial interrupt FIFO control (WRITE)
      15/       0 : =0xFC03             SERLCNT: EQU	0xfc03		; serial line control
      16/       0 : =0xFC04             SERMCNT: EQU	0xfc04		; serial MODEM control
      17/       0 : =0xFC05             SERLSTA: EQU	0xfc05		; serial line status
      18/       0 : =0xFC06             SERMSTA: EQU	0xfc06		; serial MODEM status
      19/       0 : =0xFC00             SERDIVL: EQU	0xfc00		; serial divisor latch (low)
      20/       0 : =0xFC01             SERDIVH: EQU	0xfc01		; serial divisor latch (high)
      21/       0 :                     
      22/       0 : =0xFF81             CNT0H:	EQU	0xff81
      23/       0 :                     
      24/       0 : =0x80               divacc:	 EQU	0x80		; divisor latch access code
      25/       0 : =0x14               lowdiv:  EQU	0x14		; lower divisor (19200)
      26/       0 : =0x0                uppdiv:  EQU	0x00		; upper divisor (19200)
      27/       0 : =0x17               dataspc: EQU	0x17		; DLAB=0, 8bit, 2stop, no parity
      28/       0 : =0xC1               fifospc: EQU	0xc1		; FIFO enabled TRIG=14 no-DMA
      29/       0 : =0x0                intmask: EQU	0x00		; interrupt mask - disable interrupt
      30/       0 :                     
      31/       0 :                     ; interpreter starts here
      32/       0 :                     ; assumptions "should be" refer to 1K RAM at X'1000-X'13ff)
      33/       0 :                             ORG 0
      34/       0 : 00                          NOP                     ; lost byte because of PC preincrement
      35/       1 : 24 3F 00                    JMP     COLD            ; Jump to cold start
      36/       4 : 24 3F 00                    JMP     COLD            ; Jump to interrupt a handler
      37/       7 : 24 3F 00                    JMP     COLD            ; Jump to interrupt b handler
      38/       A :                     
      39/      40 :                     	ORG	0x0040
      40/      40 : 25 00 42            COLD:   LD	SP,=STACK
      41/      43 : 26 00 FC            SERINI: LD	P2,=SERBASE
      42/      46 : C4 80               	LD	A, =divacc
      43/      48 : CA 03               	ST	A, SERLCNT-SERBASE, P2
      44/      4A : C4 14               	LD	A, =lowdiv
      45/      4C : CA 00               	ST	A, SERBASE-SERBASE, P2
      46/      4E : C4 00               	LD	A, =uppdiv
      47/      50 : CA 01               	ST	A, SERINTE-SERBASE, P2
      48/      52 : C4 17               	LD	A, =dataspc
      49/      54 : CA 03               	ST	A, SERLCNT-SERBASE, P2
      50/      56 : C4 C1               	LD	A, =fifospc
      51/      58 : CA 02               	ST	A, SERFCNT-SERBASE, P2
      52/      5A : C4 00               	LD	A, =intmask
      53/      5C : CA 01               	ST	A, SERINTE-SERBASE, P2
      54/      5E : C2 05               	LD	A, SERLSTA-SERBASE, P2	; read LSR to clear any false
      55/      60 : C2 06               	LD	A, SERMSTA-SERBASE, P2	; read MSR to clear any false
      56/      62 :                     ;
      57/      62 : 26 6D 00            MAIN:	LD	P2,=HELLOSTRING
      58/      65 : 20 A4 00            	JSR	PUTS
      59/      68 :                     MAIN1:
      60/      68 : 20 87 00            	JSR	GETC
      61/      6B : 74 FB               	BRA	MAIN1
      62/      6D :                     ;
      63/      6D :                     HELLOSTRING:
      64/      6D : 57 48 41 54 20 49   		DB	'W','H','A','T',' ','I','S',' ','P','A','S','T'
                    53 20 50 41 53 54 
      65/      79 : 20 49 53 20 50 52   		DB	' ','I','S',' ','P','R','O','L','O','G','U','E',0x0d,0x0a,0x00
                    4F 4C 4F 47 55 45 
                    0D 0A 00          
      66/      88 :                     ;
      67/      88 :                     ; GETC: output single character in A
      68/      88 :                     ;
      69/      88 : 56                  GETC:	PUSH	P2
      70/      89 : 26 00 FC            	LD	P2,=SERBASE
      71/      8C : C2 05               GETC1:	LD	A,SERLSTA-SERBASE, P2
      72/      8E : D4 01               	AND	A,=0x01		; bit0 = DR
      73/      90 : 6C FA               	BZ	GETC1		; NOT EMPTY
      74/      92 : C2 00               	LD	A,SERBASE-SERBASE, P2	; poke to Trasmit reg.
      75/      94 : 5E                  	POP	P2
      76/      95 :                     ;
      77/      95 :                     ; PUTC: output single character in A
      78/      95 :                     ;
      79/      95 : 56                  PUTC:	PUSH	P2
      80/      96 : 0A                  	PUSH	A
      81/      97 : 26 00 FC            	LD	P2,=SERBASE
      82/      9A : C2 05               PUTC1:	LD	A,SERLSTA-SERBASE, P2
      83/      9C : D4 60               	AND	A,=0x60		; bit5 = THRE, bit6 = TEMT
      84/      9E : 6C FA               	BZ	PUTC1		; NOT EMPTY
      85/      A0 : 38                  	POP	A
      86/      A1 : CA 00               	ST	A,SERBASE-SERBASE, P2	; poke to Trasmit reg.
      87/      A3 : 5E                  	POP	P2
      88/      A4 : 5C                  	RET
      89/      A5 :                     ;
      90/      A5 :                     ; PUTS:	output P2 pointed string terminated by '0' 
      91/      A5 : 0A                  PUTS:	PUSH	A
      92/      A6 : C6 01               PUTS1:	LD	A,@0x01, P2
      93/      A8 : DC 00               	OR	A,=0x00
      94/      AA : 6C 05               	BZ	PUTSE
      95/      AC : 20 94 00            	JSR	PUTC
      96/      AF : 74 F5               	BRA	PUTS1
      97/      B1 :                     ;
      98/      B1 : 38                  PUTSE:	POP	A
      99/      B2 : 5C                  	RET
     100/      B3 :