@program prog_code,prog_name include macrodjm.h ; *** 68kASM source for: Dumb Jumping Man v3.00.92beta *** ; *** For use on a TI-92 calulator running Fargo v1.0b12 *** ; Written and created by: ; Donald R. Barnes ; email: x96barnes3@wmich.edu ; web: http://www.geocities.com/SiliconValley/Park/1809/ ; Copyright 1996 ; You may distribute this file freely ;************** Start of Fargo program *************** prog_code: jsr graylib[on] ;grayscale on move.l a6,grayplane bsr ClrScr ;clr screen SetFont #2 ;Set large font WriteStr #55,#25,#1,title1 ;Write title SetFont #0 ;Set small font WriteStr #0,#104,#1,title3 ;Write line 2 of title WriteStr #0,#110,#1,title2 ;Write line 3 of title WriteStr #0,#116,#1,title4 ;Write line 4 of title jsr flib[idle_loop] ;pause cmp #264,d0 beq last move.w #0,score move.w #2000,speed move.w #3,lives newround: bsr ClrScr ;clr screen bsr drawbg ;draw background bsr flexing cmp #264,d1 beq last clr.l d0 clr.w johnx clr.l johnvx move.w #200,johnx move.w #960,johny move.w #20,d0 jsr flib[random] sub.w #10,d0 move.w d0,johnvx move.l #14000,johnvy move.w #3,johna move.w #120,padx ;---------- Game loop ; padx ; d1 key press Spr padx,#100,#12 ;put pad bsr putjohn gameloop: bsr getkey cmp #264,d1 beq last clr.l d7 ; john guy stuff bsr putjohn ; erase john clr.l d4 move.w johnvx,d4 add.w d4,johnx move.l johnvy,d7 divs #1000,d7 sub.w d7,johny bsr putjohn ; put john sub.l #100,johnvy cmp.w #160,johnx ble hitwall cmp.w #2110,johnx bge hitwall afterwall: bsr hittest move.w speed,d5 bsr wait move.w ($75A0),d7 move.w d7,d1 and.w #$FFF0,d1 cmp.w #$0050,d1 bne afterkeyz2 testleft: btst #2,d7 bne testright cmp.w #16,d7 bne la testright: btst #0,d7 bne aftertests cmp.w #206,d7 bne ra afterkeyz2: move.w #2500,d5 bsr wait aftertests: cmp.w #960,johny bgt died cmp.w #0,johny blt died bra gameloop ;---------- last: jsr graylib[off] rts ;return (end of prog) ;**************************Sub routines************************* died: bsr putjohn ; pull old john clr.l d6 move.w johnx,d6 divu #10,d6 move.w d6,d6 Spr d6,#96,#5 cmp.w #0,lives beq gameover cmp.w #3,lives beq life1 cmp.w #2,lives beq life2 cmp.w #1,lives beq life3 dback: jsr flib[idle_loop] ;pause sub.w #1,lives bra newround life1: SetFont #0 ;Set font WriteStr #55,#25,#1,died1 ;Write title bra dback life2: SetFont #0 ;Set font WriteStr #55,#25,#1,died2 ;Write title bra dback life3: SetFont #0 ;Set font WriteStr #55,#25,#1,died3 ;Write title bra dback gameover: SetFont #0 ;Set large font WriteStr #55,#25,#1,died4 ;Write title SetFont #2 ;Set large font WriteStr #80,#42,#1,gameover1 ;Write title jsr flib[idle_loop] ;pause bra last hitwall: neg.w johnvx bra afterwall ; ***************** put john putjohn: clr.l d4 clr.l d5 move.w johnx,d4 move.w johny,d5 divu #10,d4 divu #10,d5 move.w d5,d5 ;rids remainder in long word cmp.w #96,d5 bgt.w nevermind cmp.w #0,d5 blt.w nevermind Spr d4,d5,johna nevermind: rts ;*******************keypresses right: cmp.w #208,padx bne ra bra aftertests ra: cmp.w #208,padx beq aftertests Spr padx,#100,#12 add.w #1,padx Spr padx,#100,#12 bra aftertests left: cmp.w #16,padx bne la bra aftertests la: cmp.w #16,padx beq aftertests Spr padx,#100,#12 sub.w #1,padx Spr padx,#100,#12 bra aftertests ;************** Flexing flexing: move.w #60000,d0 flex1: Spr #20,#96,#1 move d0,d5 bsr wait Spr #20,#96,#1 Spr #20,#96,#2 move d0,d5 bsr wait Spr #20,#96,#2 bsr getkey cmp #13,d1 beq flex2 cmp #264,d1 beq flex2 sub #4000,d0 cmp #4000,d0 bne flex1 flex2: rts ;**************Get key getkey: clr.w d1 tst.w ($75B0) beq no_key clr.w ($75B0) move.w ($75B2),d1 no_key: rts ;**************Draw BackGround drawbg: move.w #1,d0 drawbg1: move.w #16,d1 muls.w d0,d1 spr #0,d1,#10 spr #224,d1,#10 add.w #1,d0 cmp #7,d0 bne drawbg1 move.w #0,d0 drawbg2: move.w #16,d1 muls.w d0,d1 spr d1,#112,#11 add.w #1,d0 cmp #15,d0 bne drawbg2 SetFont #0 WriteStr #1,#1,#1,status1 ;Write score: SetFont #0 ;Set large font WriteStr #150,#1,#1,status2 ;Write title bsr updatescore rts ;**************Wait ; input d5 loop length wait: dbra d5,wait rts ;*******************PUT ID putid: move.w #0,d7 move.w #0,spd cmp.w #1,d3 beq qu1 cmp.w #2,d3 beq qu2 cmp.w #3,d3 beq qu3 cmp.w #4,d3 beq qu4 cmp.w #5,d3 beq qu5 cmp.w #10,d3 beq qu10 cmp.w #11,d3 beq qu11 cmp.w #12,d3 beq qu12 in2: rts qu1: lea john1(PC),a0 bra in2 qu2: lea john2(PC),a0 bra in2 qu3: lea john3(PC),a0 bra in2 qu4: lea john4(PC),a0 bra in2 qu5: lea john5(PC),a0 bra in2 qu10: lea bg1(PC),a0 bra in2 qu11: lea bg2(PC),a0 bra in2 qu12: lea tramp(PC),a0 move.w #8,d7 bra in2 ;************* Clear screen ClrScr: movem.l d0-d1/a0-a1,-(a7) clr.l d0 ;clear d0 move.l #959,d1 ;sets counter to size of LCD memory move.l grayplane,a0 ;sets addres of start of plane 2 for gray scale move.l #$4440,a1 ;sets address of start of LCD mem loopclr: move.l d0,(a0)+ ;clears for gray plane(2) move.l d0,(a1)+ ;clears for LCD plane(1) dbra d1,loopclr ;loops until all of both planes are clear (960 times) movem.l (a7)+,d0-d1/a0-a1 rts ;************** Put Sprite ****************** ; Puts a 16x16 grayscale bitmap on the LCD screen ; I'll explain this as best as possible. ; (You must be in grayscale mode to use this routine!) ,------------------------------- ; input: grayplane The location of the 2nd LCD plane ; d0 xpos in pixels ; d1 ypos in pixels ; d3 Sprite number ; d7 special ; This should be specified at putid subroutine ; (There must be a subroutine in the prog at address putid) ; which will return a0 as the address of the sprite ; based on the value of register d3) ; output: Contents of sprite on 1st and 2nd LCD planes ;------------------------------- putspr: bsr putid ;get address for sprite number d3 divu #16,d0 ;d0 = d0 / 16 first 16 bits are quotient ;next 16 bits are remainder move.l d0,d3 ;d3 = d0 move.w d0,d0 ;rids remainder in long word lsr.l #8,d3 ;slides remainder into first 16 bits lsr.l #8,d3 ;slides remainder into first 16 bits ;d3 = remainder lsl.w #1,d0 ;Logical Shift Left d0 by #1 bit ;(d0 = d0 * 2) Trust me ; lsl.w #4,d1 ;Logical Shift Left d1 by #4 bits ;(d1 = d1 * 16) (2^4 = 16) move.l d1,d2 ;(d2 = d1) lsl.w #1,d1 ;(d1 = d1 * 2 ) lsl.w #5,d2 ;(d2 = d2 * 32) (multiplies by 2^5 or 32) sub.w d1,d2 ;(d2 = d2 - d1) add.w d0,d2 ;(d2 = d2 + d0) ext.l d2 ;extends d2 from a word to a longword lea $4440,a1 ; load 1st address of LCD mem move.l grayplane,a2 ; load 1st address of grayscale 2nd plane mem adda.l d2,a1 ;add d2 to the address adda.l d2,a2 ;add d2 to the address moveq #2,d0 cmp.w #8,d7 beq itspad moveq #15,d0 ;Sets counter to 15, so that next part will loop 16 x's itspad: cmp tramp,a0 beq trampspr PSNext: move.w (a0)+,d4 ;gets a row of the first plane move.w (a0)+,d5 ;gets a row of the second plane move.w d4,d6 ;copy row into d6 move.w d5,d1 ;copy row into d7 move.w #16,d2 ;set d2=16 sub.w d3,d2 ;subtract d3(remainder) from 16 to get shift lsl.w d2,d1 ;Right shift to get right half 2nd plane lsl.w d2,d6 ;Left shift to get right half 1st plane movea.w a1,a3 ;Copy address for LCD movea.l a2,a4 ;Copy addrs for plane 2 adda.w #2,a3 ;Add 2 bytes, so that right half appears 2 bytes to the right adda.l #2,a4 ; again for 2nd plane cmp.w #7,d7 beq padspr eor.w d6,(a3) ;put onto screen (LCD) RIGHT HALF eor.w d1,(a4) ;put onto screen (2nd plane) lsr.w d3,d4 ;scroll using the remainder eor.w d4,(a1) ;put onto screen (LCD) LEFT HALF lsr.w d3,d5 ;again for second plane eor.w d5,(a2) ;put onto 2nd plane ;memory, points a0 to next 16 bits padback: lea 30(a1),a1 ;Add 30 to get to next row to put for LCD lea 30(a2),a2 ;Same here for Gray plane ;NOTE: 30*8=240, there's 240 pixels per row ;Adding 30 will point a1 and a2 at next row dbra d0,PSNext ;Decrement d0 by 1, loop until d0=0 (15 times) rts padspr: move.w d6,(a3) ;put onto screen (LCD) RIGHT HALF move.w d1,(a4) ;put onto screen (2nd plane) lsr.w d3,d4 ;scroll using the remainder move.w d4,(a1) ;put onto screen (LCD) LEFT HALF lsr.w d3,d5 ;again for second plane move.w d5,(a2) ;put onto 2nd plane ;memory, points a0 to next 16 bits bra padback ; ********** Converts a number to a string ConvStr: adda.l d1,a0 clr.b (a0) subq.b #1,d1 RepConv: divu #10,d0 move.l d0,d2 lsr.l #8,d2 lsr.l #8,d2 add.b #48,d2 move.b d2,-(a0) and.l #$FFFF,d0 dbra d1,RepConv rts ;******************* HIT TEST hittest: cmp.w #840,johny blt nogood move.w padx,d7 move.w johnx,d4 mulu #10,d7 add.w #80,d4 sub.w d7,d4 cmp.w #160,d4 bge nogood cmp.w #0,d4 blt nogood bsr putjohn ; pull john move.w #20,d0 ;It is good! jsr flib[random] sub.w #10,d0 move.w d0,johnvx clr.l d0 move.l #5000,johnvy move.w #80,d0 jsr flib[random] muls #100,d0 add.l d0,johnvy add.w #1,johna cmp.w #5,johna blt nexframe move.w #3,johna nexframe: bsr putjohn ; put john add.w #1,score ; cmp.w #1000,speed ;speed up feature not implemented ; ble nogood ;there are some bugs in this feature ; sub.w #50,speed ;so i left it out bsr updatescore nogood: rts trampspr: moveq #3,d0 ;Sets counter to 15, so that next part will loop 16 x's bra PSNext updatescore: move.w score,d0 moveq #3,d1 lea tstr(PC),a0 bsr ConvStr SetFont #0 ;Set font WriteStr #28,#1,#4,tstr move.w lives,d0 moveq #1,d1 lea tstr(PC),a0 bsr ConvStr SetFont #0 ;Set font WriteStr #195,#1,#4,tstr rts ;************** Vars title1 dc.b "Dumb Jumping Man",0 title3 dc.b "v3.00.92",129,0 title2 dc.b "By Don Barnes ",0 title4 dc.b "Copyright 1996",0 status1 dc.b "Score:",0 status2 dc.b "Lives:",0 tstr dc.l 0 died1 dc.b "Dumb John is dead...",0 died2 dc.b "Oh darn...did I do that?",0 died3 dc.b "Now I'm gonna get medival on your [buttox]...",0 died4 dc.b "Dumb John is dead...for real this time.",0 gameover1 dc.b "GAME OVER",0 score dc.l 0 lives dc.l 3 speed dc.l 2000 ;not implemented...yet johnx dc.l 0 johny dc.l 0 johnvx dc.l 0 johnvy dc.l 0 johna dc.l 0 padx dc.l 0 x dc.w 0 ;misc variable xb dc.w 0 ;misc variable keyz dc.w 0 ;current keypress spd dc.w 0 ;spritdirection prog_name: dc.b "Dumb Jumping Man v3.00.92",129,0 ;************** Sprite Data grayplane dc.l 0 ; Address to second plane for gray scale blank: dc.w %0000000000000000,%0000000000000000 dc.w %0000000000000000,%0000000000000000 dc.w %0000000000000000,%0000000000000000 dc.w %0000000000000000,%0000000000000000 dc.w %0000000000000000,%0000000000000000 dc.w %0000000000000000,%0000000000000000 dc.w %0000000000000000,%0000000000000000 dc.w %0000000000000000,%0000000000000000 dc.w %0000000000000000,%0000000000000000 dc.w %0000000000000000,%0000000000000000 dc.w %0000000000000000,%0000000000000000 dc.w %0000000000000000,%0000000000000000 dc.w %0000000000000000,%0000000000000000 dc.w %0000000000000000,%0000000000000000 dc.w %0000000000000000,%0000000000000000 dc.w %0000000000000000,%0000000000000000 john2: dc.w %0000000000000000,%0000000000000000 dc.w %0000000000000000,%0000000000000000 dc.w %0000000000000000,%0000000000000000 dc.w %0000000000000000,%0000000000000000 dc.w %0000011111100000,%0000011111100000 dc.w %0000100000010000,%0000111111010000 dc.w %0000110000110000,%0000111111110000 dc.w %0000001001000000,%0000001111000000 dc.w %0000001111000000,%0000001111000000 dc.w %0000001111000000,%0000000000000000 dc.w %0000010111100000,%0000011111100000 dc.w %0000001111100000,%0000011111100000 dc.w %0000010000100000,%0000111101100000 dc.w %0000000011000000,%0000000011000000 dc.w %0000000011110000,%0000000000110000 dc.w %0000001111100000,%0000001111100000 john1: dc.w %0000000000000000,%0000000000000000 dc.w %0000000000000000,%0000000000000000 dc.w %0000000000000000,%0000000000000000 dc.w %0000011111100000,%0000011111100000 dc.w %0000100000010000,%0000111111010000 dc.w %0000110000110000,%0000111111110000 dc.w %0000001001000000,%0000001111000000 dc.w %0000001111000000,%0000001111000000 dc.w %0000001111000000,%0000000000000000 dc.w %0000011011100000,%0000011111100000 dc.w %0000011011100000,%0000011111100000 dc.w %0000010000100000,%0000011101100000 dc.w %0000001111000000,%0000001111000000 dc.w %0000001110000000,%0000001110000000 dc.w %0000001110000000,%0000000000000000 dc.w %0000001111100000,%0000001111100000 john3: dc.w %0000000000000000,%0000000000000000 dc.w %0000000000000000,%0000000000000000 dc.w %0000011000000000,%0000111000000000 dc.w %0000101100000000,%0001100000000000 dc.w %0000000110000000,%0000000110000000 dc.w %0000000011000000,%0000000011000000 dc.w %0000000001100000,%0000000001100000 dc.w %0000000010010000,%0000000010010000 dc.w %0000000011111000,%0000000111111000 dc.w %0000000111110000,%0000001111110000 dc.w %0010001111100000,%0010011111100000 dc.w %0100111111100000,%0111111111000000 dc.w %1000001110010000,%1111111110000000 dc.w %0100001000001000,%0111111000000000 dc.w %0010010000000000,%0011110000000000 dc.w %0001100000000000,%0001100000000000 john4: dc.w %0000000000000000,%0000000000000000 dc.w %0000000000000000,%0000000000000000 dc.w %0001100000000000,%0001100000000000 dc.w %0010010000000000,%0011110000000000 dc.w %0100001000001000,%0111111000000000 dc.w %1000001110010000,%1111111110000000 dc.w %0100111111100000,%0111111111000000 dc.w %0010001111100000,%0010011111100000 dc.w %0000000111110000,%0000001111110000 dc.w %0000000011111000,%0000000111111000 dc.w %0000000010010000,%0000000010010000 dc.w %0000000001100000,%0000000001100000 dc.w %0000000011000000,%0000000011000000 dc.w %0000000110000000,%0000000110000000 dc.w %0000101100000000,%0001100000000000 dc.w %0000011000000000,%0000111000000000 john5: dc.w %0000000000000000,%0000000000000000 dc.w %0000000000000000,%0000000000000000 dc.w %0000000000000000,%0000000000000000 dc.w %0000000000000000,%0000000000000000 dc.w %0000000000000000,%0000000000000000 dc.w %0000000000000000,%0000000000000000 dc.w %0000000000000000,%0000000000000000 dc.w %0000000000000000,%0000000000000000 dc.w %0000000000000000,%0000000000000000 dc.w %0000000000001110,%0000000000001110 dc.w %0000000000000010,%0000000000000000 dc.w %0000000100000010,%0000000000000000 dc.w %1111100100000010,%0000000100000000 dc.w %1000100100000010,%0010000000000000 dc.w %1000111111100010,%0011111111100000 dc.w %1111111111111110,%1111111111111100 bg1: dc.w %1111111011111110,%1111111111111111 dc.w %0000000000000000,%1111111111111111 dc.w %1110111111101111,%1111111111111111 dc.w %1110111111101111,%1111111111111111 dc.w %1110111111101111,%1111111111111111 dc.w %0000000000000000,%1111111111111111 dc.w %1111111011111110,%1111111111111111 dc.w %1111111011111110,%1111111111111111 dc.w %1111111011111110,%1111111111111111 dc.w %0000000000000000,%1111111111111111 dc.w %1110111111101111,%1111111111111111 dc.w %1110111111101111,%1111111111111111 dc.w %1110111111101111,%1111111111111111 dc.w %0000000000000000,%1111111111111111 dc.w %1111111011111110,%1111111111111111 dc.w %1111111011111110,%1111111111111111 bg2: dc.w %1111111111111111,%1111111111111111 dc.w %1111111111111111,%1111111111111111 dc.w %1111111111111111,%1111111111111111 dc.w %1111111111111111,%1111111111111111 dc.w %1111111111111111,%1111111111111111 dc.w %1111111111111111,%1111111111111111 dc.w %0000000011111111,%1111111111111111 dc.w %0000000011111111,%0000000011111111 dc.w %1111111111111111,%0000000011111111 dc.w %1111111111111111,%1111111111111111 dc.w %1111111111111111,%1111111111111111 dc.w %1111111111111111,%1111111111111111 dc.w %1111111111111111,%1111111111111111 dc.w %1111111111111111,%1111111111111111 dc.w %1111111111111111,%1111111111111111 dc.w %1111111111111111,%1111111111111111 tramp: dc.w %0000000000000000,%1111111111111111 dc.w %1111111111111111,%0000000000000000 dc.w %0000000000000000,%1111111111111111 ;*************** End of Fargo program **************** reloc_open add_library romlib add_library flib add_library graylib reloc_close end