Geekboy

Untitled

Feb 12th, 2013
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. TextOut:
  2.  di ; disable interupts for this becuase we are mapping memory page for the dcs font
  3.  in a,(06)
  4.  ld (page),a
  5.  
  6. TextOutLoop:
  7. ;
  8. ; assumes a standards null termed string
  9. ;out puts text into the black buffer
  10. ; pointer to string to put out
  11. ;d = x
  12. ;e = y
  13.  push de              ; save xy
  14.   ld a,(bc)           ;ld a with first letter in the string
  15.   inc bc              ; inc for next iteration
  16.   or a
  17.   jp z,_null
  18.   cp $20               ; if
  19.       ; less than 32 (aka null) then abort
  20.   jp z,_space          ; if 32 add space
  21.   push bc              ; save location on string
  22.    call dgetcharwidthlocfroma ; get page sprite and width
  23.    ld (scrap+3),a      ; save width
  24.    cp 5                ;  if 5 or more just to _setflag
  25.    jp nc,_setflag      ;
  26.    xor a
  27.    ld (IFWIDE),a
  28. _textoutloop2:
  29.    ld a,d \ out (6),a
  30.   pop bc
  31.  ; sub $41        ; subtract 41 to properly reflect my table
  32.  ; ld hl,LetterLut ; ld hl with table
  33.  ; ld d,0
  34.  ; ld e,a       ; add a to hl
  35.  ; add hl,de    ;2 bytes per entry so we add it twice to compensate
  36.  ; add hl,de    ;
  37.  
  38.   ;ld a,(hl)    ; save letter width to scrap+3
  39.  
  40.  ; inc hl    ; in to actual letter data
  41.  pop de      ;resotre x y
  42.  push bc     ; save string pointer
  43.   push de    ; save x y again
  44.    push hl   ; save sprite pointer
  45.    pop ix    ; into ix
  46.     push hl  ; save sprite pointer
  47.      ld a,d  ; load a with x val
  48.      ld bc,appbackupscreen ; load bc with buffer
  49.      call putsprite8xb     ; draw
  50.    pop ix    ;restore sprite pointer
  51.   pop de     ; restore x y
  52.    push de   ; resave xy
  53.     ld a,d   ; save x in a
  54.     ld bc,plotsscreen   ; load bc bufer
  55.     call putsprite8xb   ; draw
  56.    pop de    ; restore x y
  57.    ld a,(scrap+3) ; load a with sprite width
  58.    add a,d   ; add sprite width to x
  59.    ld d,a    ; save
  60.   pop bc     ; restore string pointer
  61.   jp textoutloop ;
  62. _null:
  63.  ld a,(page)
  64.  out (6),a
  65.  pop de      ;restore stack
  66.  ei
  67.  ret         ;return
  68. _space:
  69.  pop de
  70.   ld a,3
  71.   add a,d
  72.   ld d,a
  73.  
  74.   jp textoutloop
  75.  
  76. _setflag:
  77.  inc hl
  78.   ld a,(hl) \ inc hl \ ld h,(hl) \ ld l,a ; load sprite pointer into hl
  79.  ld a,1
  80.  ld (IFWIDE),a
  81.  jp _textoutloop2
Advertisement
Add Comment
Please, Sign In to add comment