Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; ----------------------------------------------------------------
- ; ----------------------------------------------------------------
- ; ----------------------------------------------------------------
- ; ----------------------------------------------------------------
- ; Macro to check for negative value, type minus '-' char if so,
- ; and keep the absolute value
- ; > Assumes VRAM write request has been previously sent
- ; in:
- ; d0 (w) = base tile ID for charset - $20
- ; d1 (l) = input value
- ; breaks:
- ; d2
- ; ----------------------------------------------------------------
- DecDoNeg: macro
- tst.l d1 ; negative number?
- bpl.s .\@ ; if not, branch
- neg.l d1 ; negate it
- move.w #'-',d2 ; prepare to export minus '-' char
- add.w d0,d2 ; add base tile ID
- mvdta.w d2 ; send map to plane layer
- .\@
- endm
- ; ----------------------------------------------------------------
- ; Macro to determine decimal digit to display
- ; in:
- ; d1 (l) = input value
- ; d3 (w) = index to decimal power of 10
- ; (DecArray must be at a near address)
- ; or
- ; \2 = address register with DecArray's address
- ; out:
- ; d2 (w) = digit
- ; ----------------------------------------------------------------
- DecGetDigit: macro
- .\@
- moveq #0,d2 ; clear digit buffer
- rept 10 ; repeat for all numbers in 1 digit
- if NARG=2 ; if parsing DecArray through an address register:
- sub.l (\2,d3.w),d1 ; substract power of 10 to current input number
- else ; if DecArray has not been parsed through an address register:
- sub.l DecArray(pc,d3.w),d1 ; substract power of 10 to current input number
- endif
- bmi \1 ; if below zero, we're done
- addq.w #1,d2 ; else, increase number to output
- endr
- bra.s .\@
- endm
- ; ----------------------------------------------------------------
- ; Macro to prepare next decimal digit to display, if necessary
- ; in:
- ; d1 (l) = input value
- ; d3 (w) = index to current decimal power of 10
- ; (DecArray must be at a near address)
- ; or
- ; \2 = address register with DecArray's address
- ; out:
- ; d3 (w) = index to next (backwards) power of 10
- ; breaks:
- ; d2
- ; ----------------------------------------------------------------
- DecNextDigit: macro
- if NARG=2 ; if parsing DecArray through an address register:
- add.l (\2,d3.w),d1 ; add power of 10 to current input number (fix it)
- else ; if DecArray has not been parsed through an address register:
- add.l DecArray(pc,d3.w),d1 ; add power of 10 to current input number (fix it)
- endif
- addq.w #$01*4,d3 ; increase DecArray index
- andi.w #($08*4)-1,d3 ; keep in range
- bne.s \1 ; if we reached end of array, branch
- endm
- ; ----------------------------------------------------------------
- ; Macro to type a nybble to plane layer
- ; in:
- ; d0 (w) = base tile ID containing numbers
- ; d1 (b) = rightmost nybble to export to plane layer
- ; breaks:
- ; d2
- ; ----------------------------------------------------------------
- TypeNybble: macro
- move.w d1,d2 ; copy value to char buffer
- andi.w #$000F,d2 ; filter to one nybble only
- cmpi.b #$A,d2 ; is it between $A-$F range?
- bcs.s .\@ ; if not, branch
- addi.b #'A'-'0'-$A,d2 ; prebase with difference between 'A' and '0' chars
- .\@ addi.b #'0',d2 ; add base char ID
- add.w d0,d2 ; add base tile ID
- mvdta.w d2 ; send map to plane layer
- endm
- ; ----------------------------------------------------------------
- ; to-do: de haber un conflicto, switch para las libs desde
- ; buildconf o antes de llamarlo (si no hay problema en revisar
- ; por variables declaradas)
- xref LoadASCII
- xref TypeASCII, TypeASCII_512
- xref TypePlainASCII, TypePlainASCII_512
- xref TypeByte, TypeWord, TypeLong
- xref TypeDec, TypeDecXDigits
- xref StrLen, PlainStrLen, DigitsDec
- xref DecArray, DecArray_End
- ; ----------------------------------------------------------------
- ; ----------------------------------------------------------------
- ; ----------------------------------------------------------------
- xref AddressError
- xref ErrorTrap, ErrorExcept
- ; ----------------------------------------------------------------
- ; ----------------------------------------------------------------
- ; ----------------------------------------------------------------
- xref InitGObjChain, RunGObjects, Obj_Tail
- xref NewGObj
- xref DeleteGObj
- ; ----------------------------------------------------------------
- ; ----------------------------------------------------------------
- ; ----------------------------------------------------------------
- xref Pal_Basic, Pal_Basic_End
- xref PalBasicLoad1, PalBasicLoad2
- xref PalLoad1, PalIdxLoad1, PalLoad2, PalIdxLoad2
- xref PalFileLoad1, PalFileLoad2
- ; ----------------------------------------------------------------
- ; ----------------------------------------------------------------
- ; ----------------------------------------------------------------
- xref SlzDec
- ; ----------------------------------------------------------------
- ; ----------------------------------------------------------------
- ; ----------------------------------------------------------------
- xref UftcDec
- ; ----------------------------------------------------------------
- ; ----------------------------------------------------------------
- ; ----------------------------------------------------------------
- ;xref DisplaySprite ; to-do
- xref BuildSprites, BuildMapping
- ; ----------------------------------------------------------------
- ; ----------------------------------------------------------------
- ; ----------------------------------------------------------------
- xref LoadTilemap_1024
- xref LoadTilemap, LoadTilemap_512
- xref LoadTilemapWBase, LoadTilemapWBase_512
- xref LoadTilemap_256
- ; ----------------------------------------------------------------
- ; ----------------------------------------------------------------
- ; ----------------------------------------------------------------
- xref ClearScreen
- xref ClearPlaneA, ClearPlaneB, ClearWindow, ClearSprites
- xref ClearHScroll, ClearVScroll
- ; ----------------------------------------------------------------
- ; ----------------------------------------------------------------
- ; ----------------------------------------------------------------
- xref LoadZ80
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement