Heaven/TQA Posted July 24, 2005 Author Share Posted July 24, 2005 thomas and how would you deal with 8.8 in your formular??? * vex=(px-ex)/16 * vey=(py-ey)/16 * ex=ex+vex * ey=ey+vey calc lda px sec sbc ex cmp #$80 ror @ cmp #$80 ror @ cmp #$80 ror @ cmp #$80 ror @ clc adc ex sta ex ? 1st 16 bit sbc but what happens with the div 16? ror high lsr low ? Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted July 24, 2005 Share Posted July 24, 2005 ; 16 bit div 8 lda hi cmp #$80 ror ror lo cmp #$80 ror ror lo cmp #$80 ror ror lo sta hi Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted July 24, 2005 Share Posted July 24, 2005 Not for -1, I don't think: lda #-1 cmp #$80 ror A holds -1, not zero. 895287[/snapback] Easy to fix: ; the last shift ... cmp #$80 ror bpl .pos ; not absolutely necessary adc #0 .pos: Quote Link to comment Share on other sites More sharing options...
Heaven/TQA Posted July 24, 2005 Author Share Posted July 24, 2005 thanks thomas, for your help... works! * Enemy Engine - Test * pmbase equ $8000 p0 equ $8400 org $4000 init ldx #3 init0 lda #0 sta 53256,x lda #15 sta 704,x dex bpl init0 lda 53770 sta ex+1 lda 53770 sta ey+1 lda #>pmbase sta 54279 lda #3 sta 53277 ldx #0 txa init1 sta p0,x sta p0+256,x sta p0+512,x sta p0+758,x inx bne init1 lda #62 sta 559 lda #8 sta 704 lda py+1 sta oldpy lda ey+1 sta oldey lda 53770 sta ex+1 lda 53770 sta ey+1 main_loop jsr wait_vbl jsr calc jsr get_stick jsr set_pm dec count2 bne main1 lda #32 sta count2 lda 53770 sta px+1 lda 53770 sta py+1 main1 inc count bpl main_loop lda #0 sta count lda 53770 ;random sta ex+1 lda 53770 sta ey+1 jmp main_loop wait_vbl lda #1 sta 540 wait0 lda 540 bne wait0 rts set_pm lda #0 ldx oldpy ldy #7 clear0 sta p0,x inx dey bpl clear0 ldx oldey ldy #7 clear1 sta p0+256,x inx dey bpl clear1 lda py+1 sta oldpy lda ey+1 sta oldey ldy #7 ldx py+1 lda px+1 sta 53248 ;hposp0 set0 lda shape0,y sta p0,x inx dey bpl set0 ldy #7 ldx ey+1 lda ex+1 sta 53249 ;hposp1 set1 lda shape1,y sta p0+256,x inx dey bpl set1 rts ;* Joystick routine get_stick lda 632 ;stick0 tay get_stick1 and #$f8 ;right? beq stick_r tya get_stick2 and #244 ;left? beq stick_l get_stick0 tya get_stick3 and #241 ;up? beq stick_u tya get_stick4 and #242 ;down? beq stick_d joy_end rts stick_r inc px+1 rts stick_l dec px+1 rts stick_u dec py+1 rts stick_d inc py+1 rts * vex=(px-ex)/16 * vey=(py-ey)/16 * ex=ex+vex * ey=ey+vey calc lda px sec sbc ex sta vex lda px+1 sbc ex+1 cmp #$80 ror @ ror vex cmp #$80 ror @ ror vex cmp #$80 ror @ ror vex cmp #$80 ror @ ror vex sta vex+1 lda vex clc adc ex sta ex lda vex+1 adc ex+1 sta ex+1 lda py sec sbc ey sta vey lda py+1 sbc ey+1 cmp #$80 ror @ ror vey cmp #$80 ror @ ror vey cmp #$80 ror @ ror vey cmp #$80 ror @ ror vey sta vey+1 lda vey clc adc ey sta ey lda vey+1 adc ey+1 sta ey+1 rts shape0 dta %00000000 dta %01111110 dta %01111110 dta %01111110 dta %01111110 dta %01111110 dta %01111110 dta %00000000 shape1 dta %00000000 dta %10000001 dta %01000010 dta %00100100 dta %00011000 dta %00011000 dta %00000000 dta %00000000 vex dta 0,0 vey dta 0,0 ex dta 0,0 ey dta 0,0 px dta 100,0 py dta 100,0 oldpy dta 0 oldey dta 0 count dta 0 count2 dta 64 run init now boinxx gets the first enemies... any this is a nice routine for highscore table as well --> bounty bob strikes back... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.