Advertisement
Guest User

asm lib include

a guest
Aug 9th, 2019
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. ; ----------------------------------------------------------------
  3. ; ----------------------------------------------------------------
  4. ; ----------------------------------------------------------------
  5.  
  6. ; ----------------------------------------------------------------
  7. ; Macro to check for negative value, type  minus '-' char if so,
  8. ; and keep the absolute value
  9. ; > Assumes VRAM write request has been previously sent
  10.  
  11. ; in:
  12. ; d0 (w) = base tile ID for charset - $20
  13. ; d1 (l) = input value
  14. ; breaks:
  15. ; d2
  16. ; ----------------------------------------------------------------
  17.  
  18. DecDoNeg:   macro
  19.         tst.l   d1          ; negative number?
  20.         bpl.s   .\@         ; if not, branch
  21.         neg.l   d1          ; negate it
  22.         move.w  #'-',d2         ; prepare to export minus '-' char
  23.         add.w   d0,d2           ; add base tile ID
  24.         mvdta.w d2          ; send map to plane layer
  25. .\@
  26.         endm
  27. ; ----------------------------------------------------------------
  28. ; Macro to determine decimal digit to display
  29.  
  30. ; in:
  31. ; d1 (l) = input value
  32. ; d3 (w) = index to decimal power of 10
  33. ; (DecArray must be at a near address)
  34. ; or
  35. ; \2 = address register with DecArray's address
  36. ; out:
  37. ; d2 (w) = digit
  38. ; ----------------------------------------------------------------
  39.  
  40. DecGetDigit:    macro
  41. .\@
  42.         moveq   #0,d2           ; clear digit buffer
  43.         rept    10          ; repeat for all numbers in 1 digit
  44.         if  NARG=2          ; if parsing DecArray through an address register:
  45.         sub.l   (\2,d3.w),d1        ; substract power of 10 to current input number
  46.         else                ; if DecArray has not been parsed through an address register:
  47.         sub.l   DecArray(pc,d3.w),d1    ; substract power of 10 to current input number
  48.         endif
  49.         bmi \1          ; if below zero, we're done
  50.         addq.w  #1,d2           ; else, increase number to output
  51.         endr
  52.         bra.s   .\@
  53.         endm
  54. ; ----------------------------------------------------------------
  55. ; Macro to prepare next decimal digit to display, if necessary
  56.  
  57. ; in:
  58. ; d1 (l) = input value
  59. ; d3 (w) = index to current decimal power of 10
  60. ; (DecArray must be at a near address)
  61. ; or
  62. ; \2 = address register with DecArray's address
  63. ; out:
  64. ; d3 (w) = index to next (backwards) power of 10
  65. ; breaks:
  66. ; d2
  67. ; ----------------------------------------------------------------
  68.  
  69. DecNextDigit:   macro
  70.         if  NARG=2          ; if parsing DecArray through an address register:
  71.         add.l   (\2,d3.w),d1        ; add power of 10 to current input number (fix it)
  72.         else                ; if DecArray has not been parsed through an address register:
  73.         add.l   DecArray(pc,d3.w),d1    ; add power of 10 to current input number (fix it)
  74.         endif
  75.         addq.w  #$01*4,d3       ; increase DecArray index
  76.         andi.w  #($08*4)-1,d3       ; keep in range
  77.         bne.s   \1          ; if we reached end of array, branch
  78.         endm
  79. ; ----------------------------------------------------------------
  80. ; Macro to type a nybble to plane layer
  81.  
  82. ; in:
  83. ; d0 (w) = base tile ID containing numbers
  84. ; d1 (b) = rightmost nybble to export to plane layer
  85.  
  86. ; breaks:
  87. ; d2
  88. ; ----------------------------------------------------------------
  89.  
  90. TypeNybble: macro
  91.         move.w  d1,d2           ; copy value to char buffer
  92.         andi.w  #$000F,d2       ; filter to one nybble only
  93.         cmpi.b  #$A,d2          ; is it between $A-$F range?
  94.         bcs.s   .\@         ; if not, branch
  95.         addi.b  #'A'-'0'-$A,d2      ; prebase with difference between 'A' and '0' chars
  96. .\@     addi.b  #'0',d2         ; add base char ID
  97.         add.w   d0,d2           ; add base tile ID
  98.         mvdta.w d2          ; send map to plane layer
  99.         endm
  100. ; ----------------------------------------------------------------
  101.  
  102.         ; to-do: de haber un conflicto, switch para las libs desde
  103.         ; buildconf o antes de llamarlo (si no hay problema en revisar
  104.         ; por variables declaradas)
  105.         xref    LoadASCII
  106.         xref    TypeASCII, TypeASCII_512
  107.         xref    TypePlainASCII, TypePlainASCII_512
  108.         xref    TypeByte, TypeWord, TypeLong
  109.         xref    TypeDec, TypeDecXDigits
  110.         xref    StrLen, PlainStrLen, DigitsDec
  111.         xref    DecArray, DecArray_End
  112.  
  113. ; ----------------------------------------------------------------
  114. ; ----------------------------------------------------------------
  115. ; ----------------------------------------------------------------
  116.  
  117.  
  118.         xref    AddressError
  119.         xref    ErrorTrap, ErrorExcept
  120.  
  121. ; ----------------------------------------------------------------
  122. ; ----------------------------------------------------------------
  123. ; ----------------------------------------------------------------
  124.  
  125.         xref    InitGObjChain, RunGObjects, Obj_Tail
  126.         xref    NewGObj
  127.         xref    DeleteGObj
  128.  
  129. ; ----------------------------------------------------------------
  130. ; ----------------------------------------------------------------
  131. ; ----------------------------------------------------------------
  132.  
  133.         xref    Pal_Basic, Pal_Basic_End
  134.         xref    PalBasicLoad1, PalBasicLoad2
  135.         xref    PalLoad1, PalIdxLoad1, PalLoad2, PalIdxLoad2
  136.         xref    PalFileLoad1, PalFileLoad2
  137.  
  138. ; ----------------------------------------------------------------
  139. ; ----------------------------------------------------------------
  140. ; ----------------------------------------------------------------
  141.  
  142.         xref    SlzDec
  143.  
  144. ; ----------------------------------------------------------------
  145. ; ----------------------------------------------------------------
  146. ; ----------------------------------------------------------------
  147.  
  148.         xref    UftcDec
  149.  
  150. ; ----------------------------------------------------------------
  151. ; ----------------------------------------------------------------
  152. ; ----------------------------------------------------------------
  153.  
  154.         ;xref   DisplaySprite           ; to-do
  155.         xref    BuildSprites, BuildMapping
  156.  
  157. ; ----------------------------------------------------------------
  158. ; ----------------------------------------------------------------
  159. ; ----------------------------------------------------------------
  160.  
  161.         xref    LoadTilemap_1024
  162.         xref    LoadTilemap, LoadTilemap_512
  163.         xref    LoadTilemapWBase, LoadTilemapWBase_512
  164.         xref    LoadTilemap_256
  165.  
  166. ; ----------------------------------------------------------------
  167. ; ----------------------------------------------------------------
  168. ; ----------------------------------------------------------------
  169.  
  170.         xref    ClearScreen
  171.         xref    ClearPlaneA, ClearPlaneB, ClearWindow, ClearSprites
  172.         xref    ClearHScroll, ClearVScroll
  173.  
  174. ; ----------------------------------------------------------------
  175. ; ----------------------------------------------------------------
  176. ; ----------------------------------------------------------------
  177.  
  178.         xref    LoadZ80
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement