 
 import Foundation
 
-//Script Based of z80.pl from the SMS Miracle Emulator 
+//Script Based of z80.pl from the SMS Miracle Emulator
 //Additional elements ported from https://github.com/remogatto/z80/
 
 

    if opcode == "RES" {
        mask = 0xff - mask
    }

   //Format Output
    print(NSString(format : "0x%02x", mask), separator: "", terminator: "", to: &hexOutput)
    
    //Return hex code


func RLC(_ a : String, _ b : String) { rotate_shift(opcode: "RLC", register: a)}

func RLCA(_ a : String, _ b : String) {
    ln(sList : ["z80.A = ( z80.A << 1 ) | ( z80.A >> 7 )"])
    ln(sList : ["z80.F = ( z80.F & ( FLAG_P | FLAG_Z | FLAG_S ) ) |"])
    ln(sList : ["        ( z80.A & ( FLAG_C | FLAG_3 | FLAG_5 ) )"])
}


func RLA(_ a : String, _ b : String) {
    ln(sList : ["var bytetemp : UInt8 = z80.A"])
    ln(sList : ["z80.A = ( z80.A << 1 ) | ( z80.F & FLAG_C )"])
