0 Members and 2 Guests are viewing this topic.
TextOut: ;; 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 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) \ inc hl \ ld h,(hl) \ ld l,a ; load sprite pointer into hl ld a,(hl) ; save letter width to scrap+3 ld (scrap+3),a 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 ix ; 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 textout ; _null: pop de ;restore stack ret ;return _space: pop de ld a,6 add a,d ld a,d jp textout