trunk/src/emu/cpu/hmcs40/hmcs40op.inc
| r244784 | r244785 | |
| 242 | 242 | void hmcs40_cpu_device::op_ai() |
| 243 | 243 | { |
| 244 | 244 | // AI i: Add Immediate to A |
| 245 | | op_illegal(); |
| 245 | m_a += (m_op & 0xf); |
| 246 | m_s = m_a >> 4 & 1; |
| 247 | m_a &= 0xf; |
| 246 | 248 | } |
| 247 | 249 | |
| 248 | 250 | void hmcs40_cpu_device::op_ib() |
| 249 | 251 | { |
| 250 | 252 | // IB: Increment B |
| 251 | | op_illegal(); |
| 253 | m_b = (m_b + 1) & 0xf; |
| 254 | m_s = (m_b != 0); |
| 252 | 255 | } |
| 253 | 256 | |
| 254 | 257 | void hmcs40_cpu_device::op_db() |
| 255 | 258 | { |
| 256 | 259 | // DB: Decrement B |
| 257 | | op_illegal(); |
| 260 | m_b = (m_b - 1) & 0xf; |
| 261 | m_s = (m_b != 0xf); |
| 258 | 262 | } |
| 259 | 263 | |
| 260 | 264 | void hmcs40_cpu_device::op_amc() |
| 261 | 265 | { |
| 262 | 266 | // AMC: Add A to Memory with Carry |
| 263 | | op_illegal(); |
| 267 | m_a += ram_r() + m_c; |
| 268 | m_c = m_a >> 4 & 1; |
| 269 | m_s = m_c; |
| 270 | m_a &= 0xf; |
| 264 | 271 | } |
| 265 | 272 | |
| 266 | 273 | void hmcs40_cpu_device::op_smc() |
| 267 | 274 | { |
| 268 | 275 | // SMC: Subtract A from Memory with Carry |
| 269 | | op_illegal(); |
| 276 | m_a = ram_r() - m_a - (m_c ^ 1); |
| 277 | m_c = ~m_a >> 4 & 1; |
| 278 | m_s = m_c; |
| 279 | m_a &= 0xf; |
| 270 | 280 | } |
| 271 | 281 | |
| 272 | 282 | void hmcs40_cpu_device::op_am() |
| 273 | 283 | { |
| 274 | 284 | // AM: Add A to Memory |
| 275 | | op_illegal(); |
| 285 | m_a += ram_r(); |
| 286 | m_s = m_a >> 4 & 1; |
| 287 | m_a &= 0xf; |
| 276 | 288 | } |
| 277 | 289 | |
| 278 | 290 | void hmcs40_cpu_device::op_daa() |
| 279 | 291 | { |
| 280 | 292 | // DAA: Decimal Adjust for Addition |
| 281 | | op_illegal(); |
| 293 | if (m_c || m_a > 9) |
| 294 | { |
| 295 | m_a = (m_a + 6) & 0xf; |
| 296 | m_c = 1; |
| 297 | } |
| 282 | 298 | } |
| 283 | 299 | |
| 284 | 300 | void hmcs40_cpu_device::op_das() |
| 285 | 301 | { |
| 286 | 302 | // DAS: Decimal Adjust for Subtraction |
| 287 | | op_illegal(); |
| 303 | if (!m_c || m_a > 9) |
| 304 | { |
| 305 | m_a = (m_a + 10) & 0xf; |
| 306 | m_c = 0; |
| 307 | } |
| 288 | 308 | } |
| 289 | 309 | |
| 290 | 310 | void hmcs40_cpu_device::op_nega() |
| 291 | 311 | { |
| 292 | 312 | // NEGA: Negate A |
| 293 | | op_illegal(); |
| 313 | m_a = (0 - m_a) & 0xf; |
| 294 | 314 | } |
| 295 | 315 | |
| 296 | 316 | void hmcs40_cpu_device::op_comb() |
| 297 | 317 | { |
| 298 | 318 | // COMB: Complement B |
| 299 | | op_illegal(); |
| 319 | m_b ^= 0xf; |
| 300 | 320 | } |
| 301 | 321 | |
| 302 | 322 | void hmcs40_cpu_device::op_sec() |
| 303 | 323 | { |
| 304 | 324 | // SEC: Set Carry |
| 305 | | op_illegal(); |
| 325 | m_c = 1; |
| 306 | 326 | } |
| 307 | 327 | |
| 308 | 328 | void hmcs40_cpu_device::op_rec() |
| 309 | 329 | { |
| 310 | 330 | // REC: Reset Carry |
| 311 | | op_illegal(); |
| 331 | m_c = 0; |
| 312 | 332 | } |
| 313 | 333 | |
| 314 | 334 | void hmcs40_cpu_device::op_tc() |
| 315 | 335 | { |
| 316 | 336 | // TC: Test Carry |
| 317 | | op_illegal(); |
| 337 | m_s = m_c; |
| 318 | 338 | } |
| 319 | 339 | |
| 320 | 340 | void hmcs40_cpu_device::op_rotl() |
| 321 | 341 | { |
| 322 | 342 | // ROTL: Rotate Left A with Carry |
| 323 | | op_illegal(); |
| 343 | m_a = m_a << 1 | m_c; |
| 344 | m_c = m_a >> 4 & 1; |
| 345 | m_a &= 0xf; |
| 324 | 346 | } |
| 325 | 347 | |
| 326 | 348 | void hmcs40_cpu_device::op_rotr() |
| 327 | 349 | { |
| 328 | 350 | // ROTR: Rotate Right A with Carry |
| 329 | | op_illegal(); |
| 351 | UINT8 c = m_a & 1; |
| 352 | m_a = m_a >> 1 | m_c << 3; |
| 353 | m_c = c; |
| 330 | 354 | } |
| 331 | 355 | |
| 332 | 356 | void hmcs40_cpu_device::op_or() |
| 333 | 357 | { |
| 334 | 358 | // OR: OR A and B |
| 335 | | op_illegal(); |
| 359 | m_a |= m_b; |
| 336 | 360 | } |
| 337 | 361 | |
| 338 | 362 | |
| r244784 | r244785 | |
| 341 | 365 | void hmcs40_cpu_device::op_mnei() |
| 342 | 366 | { |
| 343 | 367 | // MNEI i: Memory Not Equal to Immediate |
| 344 | | op_illegal(); |
| 368 | m_s = (ram_r() != (m_op & 0xf)); |
| 345 | 369 | } |
| 346 | 370 | |
| 347 | 371 | void hmcs40_cpu_device::op_ynei() |
| 348 | 372 | { |
| 349 | 373 | // YNEI i: Y Not Equal to Immediate |
| 350 | | op_illegal(); |
| 374 | m_s = (m_y != (m_op & 0xf)); |
| 351 | 375 | } |
| 352 | 376 | |
| 353 | 377 | void hmcs40_cpu_device::op_anem() |
| 354 | 378 | { |
| 355 | 379 | // ANEM: A Not Equal to Memory |
| 356 | | op_illegal(); |
| 380 | m_s = (m_a != ram_r()); |
| 357 | 381 | } |
| 358 | 382 | |
| 359 | 383 | void hmcs40_cpu_device::op_bnem() |
| 360 | 384 | { |
| 361 | 385 | // BNEM: B Not Equal to Memory |
| 362 | | op_illegal(); |
| 386 | m_s = (m_b != ram_r()); |
| 363 | 387 | } |
| 364 | 388 | |
| 365 | 389 | void hmcs40_cpu_device::op_alei() |
| 366 | 390 | { |
| 367 | 391 | // ALEI i: A Less or Equal to Immediate |
| 368 | | op_illegal(); |
| 392 | m_s = (m_a <= (m_op & 0xf)); |
| 369 | 393 | } |
| 370 | 394 | |
| 371 | 395 | void hmcs40_cpu_device::op_alem() |
| 372 | 396 | { |
| 373 | 397 | // ALEM: A Less or Equal to Memory |
| 374 | | op_illegal(); |
| 398 | m_s = (m_a <= ram_r()); |
| 375 | 399 | } |
| 376 | 400 | |
| 377 | 401 | void hmcs40_cpu_device::op_blem() |
| 378 | 402 | { |
| 379 | 403 | // BLEM: B Less or Equal to Memory |
| 380 | | op_illegal(); |
| 404 | m_s = (m_b <= ram_r()); |
| 381 | 405 | } |
| 382 | 406 | |
| 383 | 407 | |
| r244784 | r244785 | |
| 386 | 410 | void hmcs40_cpu_device::op_sem() |
| 387 | 411 | { |
| 388 | 412 | // SEM n: Set Memory Bit |
| 389 | | op_illegal(); |
| 413 | ram_w(ram_r() | (1 << (m_op & 3))); |
| 390 | 414 | } |
| 391 | 415 | |
| 392 | 416 | void hmcs40_cpu_device::op_rem() |
| 393 | 417 | { |
| 394 | 418 | // REM n: Reset Memory Bit |
| 395 | | op_illegal(); |
| 419 | ram_w(ram_r() & ~(1 << (m_op & 3))); |
| 396 | 420 | } |
| 397 | 421 | |
| 398 | 422 | void hmcs40_cpu_device::op_tm() |
| 399 | 423 | { |
| 400 | 424 | // TM n: Test Memory Bit |
| 401 | | op_illegal(); |
| 425 | m_s = ((ram_r() & (1 << (m_op & 3))) != 0); |
| 402 | 426 | } |
| 403 | 427 | |
| 404 | 428 | |