CODINGSOURCES ★ Coding source &002 ★
; **** Charge A avec $00 ****
Methode 1:
  ld a,0        ; 2 bytes, 2 cycles, Doesn't affect flags

Methode 2:
  xor a         ; 1 byte, 1 cycle, Flag results: C=0, Z=1

; **** Compare A to $00 ****
Methode 1:
  cp 0          ; 2 bytes, 2 cycles

Methode 2:
  or a          ; 1 byte, 1 cycle

Methode 3:
  and a         ; 1 byte, 1 cycle

; **** Call/Return ****
Methode 1:       ; 4 bytes, 10 cycles
  ...
  call sub
  ret

Methode 2:       ; 3 bytes, 4 cycles
  ...
  jp sub

; **** Exchange DE & HL ****
Methode 1:        ; 6 bytes, 6 cycles
  ld a,d
  ld d,h
  ld h,a
  ld a,e
  ld e,l
  ld l,a

Methode 2:       ; 4 bytes, 9 cycles
  push de
  ld d,h
  ld e,l
  pop  hl

Methode 3:       ; thx power
  ex de,hl

; **** HL = -HL ****
Methode 1:               ; 7 bytes, 8 cycles
  ld a,l
  cpl
  ld l,a
  ld a,h
  cpl
  ld h,a
  inc hl

Methode 2:               ; 7 bytes, 7 cycles
  xor a
  sub l
  ld l,a
  ld a,0
  sbc h
  ld h,a

; **** A = CONST - A ****
Methode 1:               ; 4 bytes, 4 cycles
  ld b,a
  ld a,CONST
  sub b

Methode 2:               ; 3 bytes, 3 cycles
  cpl
  add CONST+1

; **** HL = HL + A ****
Methode 1:               ; 6 bytes, 6 cycles
  add l
  ld l,a
  ld a,0
  adc h
  ld h,a

Method 2:               ; 5 bytes, 5 cycles
  add l
  ld l,a
  jr nc,.notcarry
  inc h
.notcarry:

; **** decremente de 1 les 4 bits haut de A ****

Methode 1:
rra
rra
rra
rra
dec  a
rla
rla
rla
rla

Methode 2:
sub #10                ; wouff , thx Targhan / Arkos

HERMOL, 1 juin 2003 pour http://cpcrulez.fr

[next=coding_src]

A voir aussi sur CPCrulez , les sujets suivants pourront vous intéresser...

» Coding Listing - Rsx - Bankswap   (CPC Amstrad International)
» Coding Source 12 Scrolloverscan
» Coding Listing - Mc - Hinter
» Coding Listing - Rsx - Mix Your Modes   (Popular Computing Weekly)
» Coding Listing - Screen Dump For Epson   (Computing With The Amstrad)
» Coding Listing - Graphic - Vertikalspiegelung   (CPC Amstrad International)
» Coding Source 64 - Modification Et Listage Des Secteurs d'Une Disquette   (Cahier de l'Amstrad)
» Coding Listing - Serpent   (The Amstrad User)
» Coding Listing - Graphic - Infinite Colours   (Popular Computing Weekly)
CPC RULEZ CPC RULEZ CPC RULEZ CPC RULEZ CPC RULEZ CPC RULEZ CPC RULEZ CPC RULEZ CPC RULEZ CPC RULEZ CPC RULEZ CPC RULEZ CPC RULEZ CPC RULEZ CPC RULEZ CPC RULEZ CPC RULEZ CPC RULEZ CPC RULEZ CPC RULEZ CPC RULEZ CPC RULEZ CPC RULEZ CPC RULEZ CPC RULEZ CPC RULEZ CPC RULEZ CPC RULEZ CPC RULEZ
CPCrulez[Content Management System] v8.00 par hERMOL
Page créée en 072 millisecondes et consultée 128 fois