; de is C3A0 here
RO2A:45AE E5 push hl ; Save the old values in stack
RO2A:45AF D5 push de
RO2A:45B0 0E 08 ld c,08 ; Write 8 in c
RO2A:45B2 3E 00 ld a,00 ; Write 0 in a
RO2A:45B4 12 ld (de),a ; Write a in where de points
RO2A:45B5 13 inc de ;
RO2A:45B6 0D dec c ;
RO2A:45B7 20 FB jr nz,45B4 ; if c != 0: Jump back to 45B4
; This effectively zeroes C3A0-C3A8
RO2A:45B9 D1 pop de ; Load the old value of de from stack
RO2A:45BA 0E 09 ld c,09 ; Write 9 in c
RO2A:45BC 0D dec c ;
RO2A:45BD 28 12 jr z,45D1 ; If c is zero, jump to 45D1.
RO2A:45BF 2A ldi a,(hl) ; load and increment what's in hl into a
RO2A:45C0 FE E0 cp a,E0 ; If a is NOT e0, jump to 45BC. Remember, e0 is
RO2A:45C2 20 F8 jr nz,45BC ; the "end string" character.
RO2A:45C4 CB 39 slr c ; multiply c by 2
RO2A:45C6 79 ld a,c ; Write c in a
RO2A:45C7 B7 or a ;
RO2A:45C8 28 07 jr z,45D1 ; If a is 0, jump to 45D1
; ^ this is the "center text" routine, though I don't
; understand it much.
RO2A:45CA 3E 00 ld a,00 ; load 0 in a
RO2A:45CC 12 ld (de),a ; Write a in where de points.
RO2A:45CD 13 inc de ;
RO2A:45CE 0D dec c ;
RO2A:45CF 20 FB jr nz,45CC ; If c is not zero, jump back to 45CC
; Why do this? This just zeroes it again
RO2A:45D1 E1 pop hl ; Load old hl from stack
RO2A:45D2 0E 08 ld c,08 ; Write 8 in c
RO2A:45D4 2A ldi a,(hl) ; Load what's in (hl) to a, increment
RO2A:45D5 12 ld (de),a ; write what's in a to (de)
RO2A:45D6 0D dec c ;
RO2A:45D7 C8 ret z ; return from subroutine if c is zero
RO2A:45D8 13 inc de ;
RO2A:45D9 FE E0 cp a,E0 ;
RO2A:45DB 20 F7 jr nz,45D4 ;jump to 45D4 if a != e0
RO2A:45DD 3E 00 ld a,00 ;
RO2A:45DF 12 ld (de),a ;
RO2A:45E0 13 inc de ;
RO2A:45E1 0D dec c ;
RO2A:45E2 20 FB jr nz,45DF ; zeroing again
RO2A:45E4 C9 ret ; return from subroutine
Overly commented, I know, but it's the first ASM I read..
It's a routine that centers text in Telefang and writes it in memory. derp derp
____________________