RosettaCodeData/Task/Generic-swap/Z80-Assembly/generic-swap-2.z80
2023-07-01 13:44:08 -04:00

8 lines
252 B
Z80 Assembly

;8-bit swap using the stack.
ld a,(&C000)
push af
ld a,(&D000)
ld (&C000),a ;store the byte at &D000 into &C000
pop af ;now a = the byte at &C000
ld (&D000),a ;now the byte at &D000 equals the byte that was originally at &C000