home *** CD-ROM | disk | FTP | other *** search
- ;The _substr routine didn't work last time, the new one will (thanks Jonah =p)
- ;-}InFuZeD{
- .org $D748 ;_asm_exec_ram
-
- Program:
- ld hl,DemoString
- ld b,15
- ld c,2
- call _substr
- call _strpixels
- ld a,128
- sub c
- rra
- ld ($C37C),a
- xor a
- ld ($C37D),a
- ld hl,$C0F9
- call 4AA5h ;_vputs
- jp 55AAh ;_getkey
-
-
- DemoString:
- .db "_This Is Centered_",0
-
- ;Find The Length (# Of Characters) Of The String Pointed To By HL
- ;-=-=--=-=-=-=-==-=--=-=-=-===-=-=-=-=-==--=-=-==-=-=-==--=-=-==-
- ;Input: HL = Pointer to Zero-Terminated String
- ;Output: A = Length Of String
- ;Destroys: HL, BC, A
- ;=-=-=-=-=-===-=-=-=-=-=-===-=-=-=-=--==--=-=-===-=-=-=-===-=-=-=
- _strlen:
- xor a
- ld c,a
- cpir
- dec a
- sub c
- ret
-
- ;Get A Piece Of A String - Thanks To Jonah For Improving It (Then fixing it)
- ;-=-=--=-=-=-=-==-=--=-=-=-===-=-=-=-=-==--=-=-==-=-=-==--=-=-==-
- ;Input:
- ; HL = Pointer To String
- ; E = First Character
- ; D = How Many Characters After The First
- ;Output: HL points to your new string (_textShadow)
- ;Destroys: All Registers
- _substr:
- dec e
- ld d,0
- add hl,de
- ld b,d
- ld de,$C0F9
- push de
- ldir
- pop hl
- ret
-
- ;Find The Length (# Of Pixels) Of The String Pointed To By HL (_vputs text)
- ;-=-=--=-=-=-=-==-=--=-=-=-===-=-=-=-=-==--=-=-==-=-=-==--=-=-==-
- ;Input: HL = Pointer to Zero-Terminated String
- ;Output: C = Length Of String (Pixels)
- ;Destroys: All Registers
- ;=-=-=-=-=-===-=-=-=-=-=-===-=-=-=-=--==--=-=-===-=-=-=-===-=-=-=
- _strpixels:
- ld c,0
- _strpl:
- ld a,(hl)
- or a
- ret z
- push hl
- call $56A1 ;_get_vchar
- ld a,(hl)
- add a,c
- ld c,a
- pop hl
- inc hl
- jr _strpl
-
-
-
-
-
- .end
-