Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TextOut:
- di ; disable interupts for this becuase we are mapping memory page for the dcs font
- in a,(06)
- ld (page),a
- TextOutLoop:
- ;
- ; assumes a standards null termed string
- ;out puts text into the black buffer
- ; pointer to string to put out
- ;d = x
- ;e = y
- push de ; save xy
- ld a,(bc) ;ld a with first letter in the string
- inc bc ; inc for next iteration
- or a
- jp z,_null
- cp $20 ; if
- ; less than 32 (aka null) then abort
- jp z,_space ; if 32 add space
- push bc ; save location on string
- call dgetcharwidthlocfroma ; get page sprite and width
- ld (scrap+3),a ; save width
- cp 5 ; if 5 or more just to _setflag
- jp nc,_setflag ;
- xor a
- ld (IFWIDE),a
- _textoutloop2:
- ld a,d \ out (6),a
- pop bc
- ; sub $41 ; subtract 41 to properly reflect my table
- ; ld hl,LetterLut ; ld hl with table
- ; ld d,0
- ; ld e,a ; add a to hl
- ; add hl,de ;2 bytes per entry so we add it twice to compensate
- ; add hl,de ;
- ;ld a,(hl) ; save letter width to scrap+3
- ; inc hl ; in to actual letter data
- pop de ;resotre x y
- push bc ; save string pointer
- push de ; save x y again
- push hl ; save sprite pointer
- pop ix ; into ix
- push hl ; save sprite pointer
- ld a,d ; load a with x val
- ld bc,appbackupscreen ; load bc with buffer
- call putsprite8xb ; draw
- pop ix ;restore sprite pointer
- pop de ; restore x y
- push de ; resave xy
- ld a,d ; save x in a
- ld bc,plotsscreen ; load bc bufer
- call putsprite8xb ; draw
- pop de ; restore x y
- ld a,(scrap+3) ; load a with sprite width
- add a,d ; add sprite width to x
- ld d,a ; save
- pop bc ; restore string pointer
- jp textoutloop ;
- _null:
- ld a,(page)
- out (6),a
- pop de ;restore stack
- ei
- ret ;return
- _space:
- pop de
- ld a,3
- add a,d
- ld d,a
- jp textoutloop
- _setflag:
- inc hl
- ld a,(hl) \ inc hl \ ld h,(hl) \ ld l,a ; load sprite pointer into hl
- ld a,1
- ld (IFWIDE),a
- jp _textoutloop2
Advertisement
Add Comment
Please, Sign In to add comment