Sunday 3 June 2018

ZX Spectrum +2 memory map

The ZX Spectrum +2 has 131,072 bytes of RAM and 32,768 bytes of ROM making a total of 163,840 bytes (160K) in all.

The processor hardware can only address 65,536 bytes therefore paging is used to move pages of memory in and out of the processor address space. The processor always 'sees' the memory as 16K of ROM and 48K of RAM.

The ZX Spectrum +2 memory map is shown below. The first 16K is ROM which can have either ROM 0 or ROM 1 paged in to position. RAMs 2 and 5 are fixed in position and any RAM page can be paged into position RAM 0 - 7 (16 KB in size).

Memory banks 1,3,5 and 7 are contended, which reduces the speed of memory access in these banks.

The +2 memory map

  • ROM 0 - 128k editor and menu system
  • ROM 1 -  48K BASIC
  • RAM 5 - the normal screen
  • RAM 7 - shadow screen 

Screen memory layout

The RAM 5 normal screen memory layout is as follows

RAM 5 bank screen memory layout

 Paging


Paging is controlled by performing I/O writes to ports 0x7ffd. The paging logic decodes the address bus partially (uses A15 and A1 lines only), so the exact port is 0xxx xxxx  xxxx xx0x. The bits are described in the table below:

Port 0x7ffd


An example of a typical bank switch on the 128 is:
     LD      A,(0x5b5c)      ;Previous value of port held somewhere convinient
     AND     0xf8
     OR      4               ;Select bank 4
     LD      BC,0x7ffd
     DI
     LD      (0x5b5c),A
     OUT     (C),A
     EI
The principle is the same for all bank switching: change only the bits you need to.


Clear command


If you do wish to reserve memory for machine code so that it is not used by BASIC, then issue the command CLEAR n, where n is the last byte you wish to be available to BASIC. So, if you want your machine code to sit at address &8000 in the memory map, then issue the command:

CLEAR 32767
We want the last byte of memory available to basic to be just before our code, so (&8000 – 1) is 32767 in decimal. Assemble and load your code into address 32768 and run.

Sunday 18 March 2018

Windows 10 how to change an interface network category using Powershell

By default the windows 10 firewall uses three categories of network to determine what firewall rules to apply to a network interface, public, private and domain.

The Public category is intended for network connections to public networks and applies the most restrictive firewall ruleset.

The Private category is intended for network connections to trusted networks like a home network and the firewall ruleset is more relaxed.

Sometimes Windows incorrectly assigns a network connection to the wrong category.

Follow the following steps to determine what network category has been applied to a network connection and if necessary change it


Step 1 - Run Powershell as admin

Step 2 - Run the command 'get-netconnectionprofile' to view the network category for each network connection

Example output:
 
Name             : Unidentified network
InterfaceAlias   : vEthernet (Default Switch)
InterfaceIndex   : 9
NetworkCategory  : Public
IPv4Connectivity : NoTraffic
IPv6Connectivity : NoTraffic

Name             : Network
InterfaceAlias   : Ethernet
InterfaceIndex   : 16
NetworkCategory  : Private
IPv4Connectivity : Internet
IPv6Connectivity : NoTraffic


Step 3 - Use the 'set-netconnectionprofile' command to change the interface network category

For example:
set-netconnectionprofile -InterfaceIndex 9 -NetworkCategory Private

Sunday 18 February 2018

Setting up uTorrent

This is a guide for setting up uTorrent on BT Home Hub with UPnP disabled.

These instructions were written with uTorrent 3.5.1


Step 1 Confirm listening port

Go to Options > Preferences > Connection and confirm which port uTorrent is set to listen on.
Ensure Randomize port each start is turned off. 
uTorrent Connection preferences

Step 2 Define a new app for mTorrent

On the BT Home Hub go to advanced settings > port forwarding > supported applications and add a new game or application for uTorrent as shown below. Use the port number as confirmed in step 1.


Adding uTorrent as a new game or application on the BT Home Hub

Step 3 Set port forwarding

On the BT Home Hub go to Port Forwarding > Configuration. Select the game or application mTorrent to be forwarded to your PC running mTorrent and then select Add then Apply.

Set port forwading on the BT Home Hub


Step 4 Confirm all is now working

Confirm uTorrent now shows a green tick in the bottom right hand corner of the window indicating Network OK.