Advertisement
Guest User

Untitled

a guest
Feb 28th, 2019
240
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. !yxppccct = %00001100
  2. !nTiles = $01 ; Number of 16x16 tiles - 1
  3. !spriteStatusTable = $14C8
  4.  
  5. print "INIT ",pc
  6.     rtl
  7. print "MAIN ",pc
  8.     phb
  9.     phk
  10.     plb
  11.     jsr .spriteStart
  12.     plb
  13.     rtl
  14.  
  15. .spriteStart:
  16.     lda !spriteStatusTable,x    ;
  17.     cmp #$08                    ;
  18.     bne .return                 ; if status != normal, return
  19.     lda $9D : bne .return
  20.     lda #$00 : %SubOffScreen()
  21.  
  22.     jsr .graphics
  23.     jsr .move
  24.     jsl $01A7DC ; Check for contact with mario
  25.     bcc .return
  26.     jsr .onContact
  27. .return:
  28.     rts
  29.  
  30. .move:
  31.     lda $14E4,x     ;
  32.     xba             ;
  33.     lda $00E4,x     ;
  34.     rep #$20        ;
  35.     sbc $D1         ;
  36.  
  37.     cmp #$007F
  38.     bpl .clampLow
  39.     lda #$007F
  40. .clampLow:
  41.     cmp #$FF80
  42.     bmi .doneClamping
  43.     lda #$FF80
  44. .doneClamping:
  45.     sep #$20
  46.     eor #$FF
  47.     sta $B6,x
  48.     jsl $018022
  49.     rts
  50.  
  51. .onContact:
  52.     lda #$00 : sta !spriteStatusTable,x
  53.     lda #$09 : sta $1DFC
  54.  
  55.     stz $00 : stz $01
  56.     lda #$1C : sta $02
  57.     lda #$01
  58.     %SpawnSmoke()
  59.     rts
  60.  
  61.  
  62. ;;============;;
  63. ;;  Graphics  ;;
  64. ;;============;;
  65. .graphics:
  66.     %GetDrawInfo() ; y = index, $00 = xpos, $01 = ypos
  67.     phx
  68.     ldx #!nTiles
  69. .graphicLoop:
  70.     lda $00  : adc hDisp,x   : sta $0300|!Base2,y
  71.     lda $01  : adc vDisp,x   : sta $0301|!Base2,y
  72.     lda tilemap,x : sta $0302|!Base2,y
  73.  
  74.     lda #!yxppccct
  75.     ora $64
  76.     sta $0303|!Base2,y
  77.  
  78.     iny #4 ; See Asar's pseudo opcodes
  79.  
  80.     dex
  81.     bpl .graphicLoop
  82.     plx
  83.  
  84.     lda #!nTiles
  85.     ldy #$02
  86.     jsl $01B7B3
  87.     rts
  88.  
  89. tilemap:    db $40, $42, $40, $42
  90. hDisp:      db $00, $10, $FF, $10
  91. vDisp:      db $00, $00, $F0, $F0
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement