Calculator Community > ASM
GAME: Optimize this! (z80 assembly)
Halifax:
Basically everything can be optimized about this code. Post your optimized code with timings and bytes and we will see who has the most optimized code in the end!
c1-->CODE ec1
xor a
ld hl,0
ld d,e
ld l,h
mainloop:
ld a,$FF
out (1),a
ld a,$FE
out (1),a
nop
nop
in a,(1)
cp '1'
call z,is_1
cp '2'
call z,is_2
cp '3'
call z,is_3
cp '4'
call z,is_4
cp '5'
call z,is_5
cp 0
jp z,mainloop
jp mainloop
is_1:
ld de,no_label1
ld b,5
call convert_num
ret
is_2:
ld de,no_label2
ld b,5
call convert_num
ret
is_3:
ld de,no_label3
ld b,5
call convert_num
ret
is_4:
ld de,no_label4
ld b,5
call convert_num
ret
is_5:
ld de,no_label5
ld b,5
call convert_num
ret
convert_num:
ld hl,0
conv_loop:
ld a,(de)
inc de
cp '1'
ccf
adc hl,hl
djnz conv_loop
ret
c2ec2
DJ Omnimaga:
let's hope CoBB from MC won't find this topic because he's instant winner by default then O_O
Halifax:
These optimizations are all easily findable, whether it is something I have said before, or something recently posted on MaxCoderz.
DJ Omnimaga:
ok, now if i knew assembly. I hope an assembly coder like iambian or jon passes by
JonimusPrime:
I fail at asm but even I can find Optimizations in that (too bad I'm too lazy to go through and type them).
Navigation
[0] Message Index
[#] Next page
Go to full version