Skip to content

Commit

Permalink
adds noti rx
Browse files Browse the repository at this point in the history
  • Loading branch information
leandromoreira committed Sep 11, 2014
1 parent fe1284c commit 319063e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pchip16/cpu.py
Expand Up @@ -1075,5 +1075,15 @@ def pal_rx(params):

########################
### Ex - Not/Neg ###
def noti_rx(params):
#Set RX to NOT HHLL
hhll = params['hhll']
self.r[params['x']] = ~hhll & 0xFFFF
return 4

instruction_table[0xE0] = {
'Mnemonic': 'NOTI RX, HHLL',
'execute': noti_rx
}
########################
return instruction_table
18 changes: 18 additions & 0 deletions tests/test_cpu.py
Expand Up @@ -1513,3 +1513,21 @@ def test_PAL_RX():
chip16.gpu.palette[0xF]['r'].should.be.eql(float(125)/255)
chip16.gpu.palette[0xF]['g'].should.be.eql(float(150)/255)
chip16.gpu.palette[0xF]['b'].should.be.eql(float(200)/255)

def test_NOTI_rx():
#Set RX to NOT HHLL
chip16 = cpu.Cpu()

initial_address = 0x0000
chip16.pc = initial_address

chip16.write_8bit(initial_address, 0xE0) #op code
chip16.write_8bit(initial_address + 1, 0b00000001) #y,x
chip16.write_8bit(initial_address + 2, 0b11001100) #ll
chip16.write_8bit(initial_address + 3, 0b00110011) #hh

chip16.r[0x1] = 0xFACA

chip16.step()

chip16.r[0x1].should.be.eql(0b1100110000110011)

0 comments on commit 319063e

Please sign in to comment.