english greek
Αρχική arrow Specifications arrow COP420 4-Bit Processor

COP420 4-Bit Processor

Υποβλήθηκε από Colin Appleby
Κυριακή, 31 Αύγουστος 2008

COP420 4-Bit Processor inside NewBrain Computer

TJ’s Workshop – COP Tips

Here are some tips for using the second processor inside the NewBrain Computer.

In addition to the Z80A which is its main processor, the NewBrain contains a National Semiconductor COP420 4-bit processor which is used as an intelligent I/O controller and manages the keyboard, line display, and tape I/O.

Communication between the two processors is handled via two page zero locations; COPCTL and COPST.  The COPCTL is a command byte which is written to the COP at interrupt time, and COPST is a series of flags which tell the Z80 what the COP has done, or is doing. There is also a third location, COPBUFF, which is used as a data buffer either to or from the COP. The COPCTL, COPST, and COPBUFF (the names are those used by the technical manual) are at 59, 60 and 61 respectively.

Unless tape I/O is going on, COPBUFF will normally contain the keyboard matrix value of the last key pressed. This value will remain until another key is pressed (it won’t change when you release the key).

The technical manual mentions the function of several of the commands, but is inexplicably coy about telling you what their values are … a deficiency which a little trial and error soon remedies.

It appears that only the top four bits of COPCTL are read by the COP, and those values for which I have been able to discover the function are as follows:

D0 - Do nothing (the default value, and the only one given in the technical manual).

80 - Perform tape I/O (I am uncertain of the details of the operation).

F0 - Rescan keyboard; this will rewrite COPBUFF with the value of any key currently pressed (it will not clear it if no key is being pressed).

A0 – Update line display from buffer area. The line display buffer runs from 62 - 77 inclusive, and is in reverse order (62 is the rightmost character).

So what use is all this? Well the rescan keyboard’ command allows us to tell when a key is being pressed, and also when it is released, which is otherwise impossible on the Newbrain. The following Basic subroutine will return the matrix value of any kept currently being held down (except STOP, REPEAT, the STOP can be detected by other means, of course). If more than one key is held down at once, only one will register, exactly which depends on the key.

The value is six bits wide, the top two bits give the status of SHIFT, CONTROL and GRAPHIC; SHIFT sets bit six, CONTROL bit seven, and GRAPHIC both bits, when pressed. The value returned from each key on the keyboard follows:

1000 a = PEEK(61): IF a = 0 RETURN

1010 POKE 61,0: POKE 59,240: RETURN

(This returns the key in a. It clears COPBUFF and rescans the keyboard if a key is being pressed).

Key      Value      Key      Value      Key

   1           9             2            8            3

   6           4             7            3            8

   (           22            )            23          

   E          12           R           11           T

   L          36           0            38           P

 ESC       31           A           46           S

   G         42            J            51           K

   +          29        NLN         30           Z

   V         57           B            56           N

               55           /             47         VTX

  SPC     15         CRL          2          CRU  

 Value     Key      Value      Key     Value

   7            4             6            5           5     

  19           9            20           0          21

  24           Q           14          W         13

  10           Y           37           U         35

  26           =           27            -          28

  45           D           44            F         43

  62           L           39             ;          40

  60           X           59            C         58

  52           M          53             ,          54

  25         HOM      63           INS       61

  50         CRD       34           CRR     18

ESC = Escape,   NLN=Newline

VTX = Videotext,   HOM = Home

INS = Insert,   SPC = Space

CRL = Cursor left

CRU = Cursor up

CRD = Cursor down

CRR = Cursor right

SHIFT adds 64 to value

CONTROL adds 128

GRAPHIC = adds 192

 

The other COP command which I have found useful is the one to rewrite the line display. Using this, the line display can be poked with values, and then updated by setting COPCTL to A0 (POKE 59,160).

 The following short program demonstrates that the line display can in fact display 256 different characters, not the 64 or so sated in the manual, the characters are displayed 16 at a time; pressing any key shows the next group.

10 CLOSE #1: OPEN #1,5

20 ba=62: FOR i=0 TO 255 STEP 16

30 FOR j=15 TO 0 STEP -1: POKE ba+j,i+15-j: NEXT j

40 POKE 59,160: GET #1,a: NEXT i

50 CLOSE #1: END

As you will notice, the top 128 characters are simply flashing versions of the bottom 128, and the ‘new’ characters are mostly pretty weird and wonderful …

I have written a game using the line display only using some of the new ‘graphics’ (a world first?), but a more practical use is to enable upper and lower case to be distinguished on the line display, by flashing lower case letters. The following subroutine does just that, displaying a$ in upper/lower case.

1000 IF LEN(a$)}16 THEN a$ = LEFT$(a$,16)

1010 FOR i=1 TO LEN(a$)

1020 a=ASC(MID$(a$,i))

1030 IF a}96 AND a{123 THEN a=a+96

1040 POKE 78-i,a

1050 NEXT i

1060 FOR i=i TO 16

1070 POKE 78-i,32

1080 NEXT i

1090 POKE 59,160

1100 RETURN

The loop from 1010 to 1050 puts the string into the buffer, converting any lower case letters to their flashing upper case equivalents. The loop from 1060 to 1080 clears the rest of the display, and 1090 makes the COP display the buffer.

By Stephen Burt

PCW 165

Digitized by Colin Appleby © 2008

Τελευταία ενημέρωση Κυριακή, 31 Αύγουστος 2008

Σύνδεση Χρήστη





Δεν έχετε λογαριασμό ακόμα; Δημιουργία λογαριασμού
Newbrain

Στατιστικά

Γλώσσες: 2
Μέλη: 616
Νέα: 93
Σύνδεσμοι: 16
Visits since 15/09/2004
mod_vvisit_countermod_vvisit_countermod_vvisit_countermod_vvisit_countermod_vvisit_countermod_vvisit_countermod_vvisit_countermod_vvisit_counter
mod_vvisit_counterToday430
mod_vvisit_counterYesterday314
mod_vvisit_counterThis Week1981
mod_vvisit_counterThis Month3988
Έχουμε 29 επισκέπτες σε σύνδεση

Please use the NB CATALOG page here to insert your hardware and help us catalog everything that survived all these years.

Most  programs on this website are in WinRar format. The WinRar compression program is available for free on the Internet.

Latest Version is 3.0B4 (28/06/2017)

Latest Full Version is 3.0B4 (Jun 2017)

------------------------------------------
Latest Version is 2.65B1
(10/12/2016)

Latest update is 2.64FN1

Latest Full Version is 2.64FINal

* Register to be able to download

  • IOS Image Rotator
  • IOS Image Rotator
  • IOS Image Rotator
  • IOS Image Rotator

Shouter

Saphir17: For the diy-hard NB fanboys... Check Ebay for : GRUNDY NEWBRAIN RETRO COMPUTER MUG (Ημερομηνία: 25/02/2022 16:41)
gillespienewbrain: Hi, Can anyone tell me what commands I need to load a program from PC to NB over serial using PC2NB or the emulator? (Ημερομηνία: 08/08/2019 17:13)
Shoppie: Hello all, Found my old Newbrain in my garage again. The sticker on the bottoms shows I bought it in March 1984.... The good old computer days :-) (Ημερομηνία: 03/04/2018 14:12)

Δεν σας επιτρέπετε η συγγραφή!

Δημοσκοπήσεις

Do you have a Newbrain Home Computer?

Αποτελέσματα

Συνδικάτο

RSS 0.91
RSS 1.0
RSS 2.0
ATOM 0.3
OPML
Powered by Elxis - Open Source CMS.
Copyright (C) 2006-2023 Elxis.org. All rights reserved.