NNNNNNp NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNONNNNNNNNNNNNNNNNNNNNNNMO`  @`! #@%`')+-/1 3@5`79;=?A CGIMOQ U`WY[_a cogkmoq s@u`wy{}/@` @ `  @ O o @ ` ɠ / ` ׀  @` `!Aa   !Aa!!#A%a')+-/1!3A5a79;=?A!CAEaGIKMOQ!SAUaWY[O`  @`! #@%`')+-/1 3@5`79;=?A CGIMOQ U`WY[_a cogkmoq s@u`wy{}/@` @ `  @ O o @ ` ɠ / ` ׀  @` `!Aa   !Aa!!#A%a')+-/1!3A5a79;=?A!CAEaGIKMOQ!SAUaWY[PAGE_6 1MAD  iGRABBER =iDFADER yiJSCROLLER iKOTHELLO BASi]GEM шidSECRETS YiREAD ME i\DESKTOP INF/].  i..  iMAD PRG$i!MAD SRC)i ` OQ.aRarCatavAC6azA"|aA2CaA߬CaACaApCaC&aaaaRaa09 aapaQaa Jy gJy fa`B9B9 B9   4<2<<aDQQB9B9B9 9!o <F29 SAg3 #!`a&aJ9zf 9"9 l# `N %%  # $% % " $% "%%% $%Ah J9! k9 ְ<g2<g\Q`T#!zBB9 3 NuFZnJy g# 3 NuJy g#> 3 NuJy g#Y 3 NuJy g#t 3 NuJy g# 3 NuNu   p ` P @ 0  x ph`h`X P H @ 8 0p P 0   `@ <<,2< y! 4<6<a PQ Q4< azQUX@QB9B9B9B9NuB?< NA\Bg/</<?<NN /<?<NN\?<%NNTBBBg?<NN /<?<?<NNP/<?<?< NNPF'#&pF#By Nu/9 ְ<f  Nu<fBy `<9fB9B9B9B9 9 k`B9 B9!By 3 By NuH9J9!f<g`&LNs! B9!`!` 2<AgTQ`9! 9! `HPKMB9!NsH瀀09 g>S@ y 3 # LNu!J9!fNuA0<BBBBQNuHA g$TR< mBS`A"Ca.LNuHA|JPgNRSl S`AC|aJQf(< y!&a09!*A1. 3 3 LNuHBy y gRy `JBy AJPg:RSl S`ACap Q l3 JQfBy LNuHJ9zgS9zACza0LNuHA"y!a$IxCda Cza 3| C|a 3(Ca (Ca "Ja,LNu$%% $%%%$%%%$%%%%HA@0<0QLNuHG1.E!.BC8<2< 4<<g6< g<g*<f<#!3!`.#!&3!*<@`%H5CBj@RDaPRCQ `Q3!LNuBy 29!C1.E!.*<g<g QNu6*10<g<fJjgBy ``2< ja^0 aN0%Hj5|`6*10<f 10<g`4< ja0a0%Hj5|`R6*10<f 10<gJjg2Bj3 `"< ja0Pa0%HRj5|`By By By C1.! !9!gxBy!"29!1<o,<g< g`3 `6Caaa< y!a !y!3 `9!gxBy!"29!1<o,<g< g`d3 `6CaaLa< y!a !y!3 `9!g29!1<o8<g"< g<gPBy!"`3 `6SCaaaBy!"< y!a!y!3 `9!g$29!1<o4<g < g<g6By!"`J3 `6RCala8apBy!"< y!atP!Ry!3 C 29 1 y!a??3773qs>π???? ??`@@?????|p@|0xx??@0?:A-s4XSw|~>A=<@}~ `ss x>x>??  `''`  @@!''H@ "   @ @G (+???? ' EEHHH""@0<0QLNuH<gaP`LNu<< <8" " $   $   ,  D H  *********************************************************************** * * M M AAA DDDD * MM MM A A D D * M M M AAAAA D D * M M A A D D * M M A A DDDD * * Program by Paul Lay * * Art by Harvey A. Kong Tin * * For PAGE 6 Magazine (England) * * 23rd April 1988 * *********************************************************************** *********************************************************************** * * Credits * * The HISOFT DEVPAC assembler was used to write this code on an * Atari 520STM. I would expect that the source code may well be * compatible accross other assembler formats. DEGAS ELITE was used * to design the graphics. These are both fine programs! * * Thanks to Harvey for doing the sprite designs, some of which were * taken from some stuff he'd done for my latest game, CROSSLAND, * available from MICRODEAL (a great game so go out and buy it ... plug * ... plug ... plug ...). * *********************************************************************** *********************************************************************** * * Main program. * *********************************************************************** main_program lea.l stack_top,SP * set up the stack bsr init_machine * initialise the ST new_game bsr vb_wait * wait for vertical blank lea.l blank_palette,A1 bsr set_palette * all colours go black bsr cls * clear the screen lea.l screen_addr,A0 lea.l title_screen,A1 bsr draw_screen * draw the title screen lea.l screen_addr+$AB0,A0 * print credits move.l #page_6_magazine,A1 bsr print_string lea.l screen_addr+$1432,A0 lea.l presents,A1 bsr print_string lea.l screen_addr+$5FAC,A0 lea.l program_paul_lay,A1 bsr print_string lea.l screen_addr+$6906,A0 lea.l art_harvey_kong_tin,A1 bsr print_string lea.l screen_addr+$7270,A0 lea.l high_score,A1 bsr print_string lea.l title_palette,A1 bsr set_palette * set colour palette bsr wait_fer_start * wait for game start new_screen bsr vb_wait * wait for vertical blank bsr set_up_new_screen * draw and set up screen bsr initialise * initialise things mp_loop_1 bsr down_time * time goes down move.w delay,D0 * delay loop mp_loop_2 bsr play_sounds * process the sound effects bsr handle_keys * process any key presses bsr vb_wait * wait for vertical blank dbra D0,mp_loop_2 * next delay bsr handle_objects * process boulders and jewels bsr handle_player * process the player tst.w alive * player alive? beq mp_explode * if not then explode tst.w exited * player finished screen? bne.s mp_exit * if true then exit bsr set_sounds * set sound effects bra.s mp_loop_1 * and repeat mp_exit clr.b snd_reg * set up sound registers clr.b snd_dat * for exit sound move.b #$08,snd_reg move.b #$10,snd_dat move.b #$0B,snd_reg clr.b snd_dat move.b #$0C,snd_reg move.b #$80,snd_dat move.b #$0D,snd_reg move.b #$0A,snd_dat move.w #$07,D2 * loop 8 times mp_exp1 move.w #$06,D1 * loop 7 times move.b #$08,D0 * first frequency mp_exp2 move.b #$01,snd_reg * sound chip register $01 move.b D0,snd_dat * set frequency sub.b #$01,D0 * reduce frequency bsr vb_wait * wait for vertical blank dbra D1,mp_exp2 * loop dbra D2,mp_exp1 * loop clr.b snd_reg * turn sounds off clr.b snd_dat move.b #$08,snd_reg clr.b snd_dat move.l current_screen_ptr,D0 * get screen pointer add.l #$114,D0 * move onto next screen cmp.l #screen_6,D0 * gone past last screen? ble.s mp_exp3 * if not then continue move.l #screen_0,D0 * reset to first screen move.w delay,D1 * get delay value subq.w #$01,D1 * reduce delay beq.s mp_exp3 * if delay too short then skip move.w D1,delay * set new delay value mp_exp3 move.l D0,current_screen_ptr * set new screen pointer bra new_screen * go onto next screen mp_explode bsr down_lives * lives go down bsr explode_player * player explodes tst.b lives * any lives left? bne new_screen * if true then restart screen move.l score,D0 * get score move.l highest,D1 * get high score cmp.l D0,D1 * new high score? bge.s mp_no_new_high * if not then skip move.l D0,highest * set new high score mp_no_new_high bra new_game * start another game page_6_magazine dc.b 25,10,16,14,37,6,37,22,10,16,10,35,18,23,14,$FF presents dc.b 25,27,14,28,14,23,29,28,$FF program_paul_lay dc.b 25,27,24,16,27,10,22,36,37,25,10,30,21,37,21,10,34,$FF art_harvey_kong_tin dc.b 10,27,29,36,37,17,10,27,31,14,34,37,20,24,23,16,37 dc.b 29,18,23,$FF even high_score dc.b 17,18,16,17,37,28,12,24,27,14,36,37 highest dc.b 0,0,0,0,$FF even *********************************************************************** * * Wait for start routine. * *********************************************************************** wait_fer_start lea.l starts_lookup,A0 * start keys lookup table move.b #$FF,the_key * flush keyboard wfs_loop_1 tst.b the_stick * joystick button pressed? bmi.s wfs_skip_1 * if true start at first move.b the_key,D0 * get keyboard status cmp.b #$FF,D0 * any key pressed? beq.s wfs_loop_1 * if not then try again move.w #$03,D1 * 4 entries in lookup table wfs_loop_2 cmp.b (A0),D0 * table entry matches key? beq.s wfs_skip_1 * if true then go there addq.l #$06,A0 * next table entry dbra D1,wfs_loop_2 * loop bra.s wait_fer_start * try again wfs_skip_1 addq.l #$02,A0 * reference screen address move.l (A0),current_screen_ptr * set screen address move.b #$04,lives * set lives clr.l score * clear score clr.b the_key * flush keyboard move.w #$07,delay * initially slow rts starts_lookup dc.b $BB,$00 dc.l screen_0 dc.b $BC,$00 dc.l screen_1 dc.b $BD,$00 dc.l screen_2 dc.b $BE,$00 dc.l screen_3 *********************************************************************** * * Set sounds routine. * *********************************************************************** set_sounds tst.w exit_appeared * has an exit appeared beq.s ss_no_exit * if not then skip move.l #sound_0_data,snd_1_ptr * set sound pointers move.w #sound_0_length,snd_1_count rts ss_no_exit tst.w ticker * time ticking away? beq.s ss_no_tick * if not then skip move.l #sound_1_data,snd_1_ptr * set sound pointers move.w #sound_1_length,snd_1_count rts ss_no_tick tst.w jewel_collected * collected a jewel? beq.s ss_no_jewel * if not then skip move.l #sound_2_data,snd_1_ptr * set sound pointers move.w #sound_2_length,snd_1_count rts ss_no_jewel tst.w rock_hit_ground * rock hit ground? beq.s ss_no_rock * if not then skip move.l #sound_3_data,snd_1_ptr * set sound pointers move.w #sound_3_length,snd_1_count rts ss_no_rock tst.w player_moved * has player moved? beq.s ss_no_play * if not then skip move.l #sound_4_data,snd_1_ptr * set sound pointers move.w #sound_4_length,snd_1_count rts ss_no_play rts sound_0_data dc.b $03,$00,$0F dc.b $02,$F0,$0F dc.b $02,$E0,$0F dc.b $02,$D0,$0E dc.b $02,$C0,$0E dc.b $02,$B0,$0E dc.b $02,$A0,$0D dc.b $02,$90,$0D dc.b $02,$80,$0D dc.b $02,$70,$0C dc.b $02,$60,$0C dc.b $02,$50,$0C dc.b $02,$40,$0B dc.b $02,$30,$0B dc.b $02,$20,$0B dc.b $00,$00,$00 sound_0_length equ $10 sound_1_data dc.b $00,$98,$0D dc.b $00,$90,$0C dc.b $00,$88,$0B dc.b $00,$80,$0A dc.b $00,$78,$09 dc.b $00,$70,$08 dc.b $00,$68,$07 dc.b $00,$60,$06 dc.b $00,$00,$00 sound_1_length equ $09 sound_2_data dc.b $00,$68,$0F dc.b $00,$60,$0E dc.b $00,$58,$0D dc.b $00,$50,$0C dc.b $00,$48,$0B dc.b $00,$40,$0A dc.b $00,$38,$09 dc.b $00,$30,$08 dc.b $00,$00,$00 sound_2_length equ $09 sound_3_data dc.b $03,$F0,$0F dc.b $03,$D0,$0F dc.b $03,$B0,$0E dc.b $03,$90,$0E dc.b $03,$70,$0D dc.b $03,$50,$0D dc.b $03,$30,$0C dc.b $03,$10,$0C dc.b $00,$00,$00 sound_3_length equ $09 sound_4_data dc.b $01,$00,$0B dc.b $00,$E0,$0A dc.b $00,$C0,$09 dc.b $00,$A0,$08 dc.b $00,$80,$07 dc.b $00,$60,$06 dc.b $00,$40,$05 dc.b $00,$20,$04 dc.b $00,$00,$00 sound_4_length equ $09 even *********************************************************************** * * Explode player routine. * *********************************************************************** explode_player move.b #$06,snd_reg * set up sound registers move.b #$1A,snd_dat * for explode sound move.b #$07,snd_reg move.b #$F7,snd_dat move.b #$0F,D5 * noise pitch value move.b #explode,D0 * first explode sprite move.w #$03,D1 * loop over 4 explode sprites ep_loop_1 move.l player_addr,A0 * get player address sub.l #$A08,A0 * modify address left and up move.w #$02,D2 * loop over 3 rows ep_loop_2 move.w #$02,D3 * loop over 3 columns ep_loop_3 bsr draw_graphic * draw explode character addq.l #$08,A0 * address next column dbra D3,ep_loop_3 * next column add.l #$9E8,A0 * address next row dbra D2,ep_loop_2 * next row move.w #$0B,D2 * delay loop ep_loop_4 bsr vb_wait * wait for vertical blank move.b #$08,snd_reg * sound register $08 move.b D5,snd_dat * set noise pitch value dbra D2,ep_loop_4 * next delay subq.b #$02,D5 * update noise pitch value addq.w #$04,D0 * update explode sprite dbra D1,ep_loop_1 * next explode loop clr.b snd_reg * turn sounds off clr.b snd_dat move.b #$01,snd_reg clr.b snd_dat move.b #$07,snd_reg move.b #$FE,snd_dat move.b #$08,snd_reg clr.b snd_dat rts *********************************************************************** * * Initialise the ST. * *********************************************************************** gemdos equ $01 super equ $20 xbios equ $0E initmous equ $00 setscreen equ $05 setpalette equ $06 mfpint equ $0D ikbdws equ $19 wvbl equ $25 screen_addr equ $78000 snd_reg equ $FF8800 snd_dat equ $FF8802 init_machine clr.l -(SP) * enter supervisor mode move.w #super,-(SP) trap #gemdos addq.l #$06,SP clr.w -(SP) * set screen address move.l #screen_addr,-(SP) move.l #screen_addr,-(SP) move.w #setscreen,-(SP) trap #xbios add.l #$0C,SP move.l #blank_palette,-(SP) * all colours go black move.w #setpalette,-(SP) trap #xbios addq.l #$06,SP move.w #wvbl,-(SP) * wait for vertical blank trap #xbios addq.l #$02,SP clr.l -(SP) * disable mouse clr.l -(SP) clr.w -(SP) move.w #initmous,-(SP) trap #xbios add.l #$0C,SP move.l #kb_commands,-(SP) * enable joystick move.w #kb_length_commands,-(SP) move.w #ikbdws,-(SP) trap #xbios addq.l #$08,SP move.l #kb_int,-(SP) * set keyboard interrupt move.w #$06,-(SP) move.w #mfpint,-(SP) trap #xbios addq.l #$08,SP move.w #$2700,SR * disable interrupts move.l #vbi_int,$70 * set vertical blank interrupt move.w #$2300,SR * enable interrupts move.b #$07,snd_reg * sound reqister $07 move.b #$FE,snd_dat * enable sound channel A clr.w snd_1_count rts blank_palette dc.w $000,$000,$000,$000,$000,$000,$000,$000 dc.w $000,$000,$000,$000,$000,$000,$000,$000 kb_commands dc.b $14,$12 kb_length_commands equ $01 even *********************************************************************** * * Handle run time keys routine. * *********************************************************************** handle_keys move.l D0,-(SP) * save register move.b the_key,D0 * get keyboard status cmp.b #$FF,D0 * any key pressed? bne.s hk_skip_1 * if true then process key hk_exit move.b #$FF,the_key * flush keyboard move.l (SP)+,D0 * restore register rts hk_skip_1 cmp.b #$01,D0 * escape key pressed? bne.s hk_skip_2 * if not then skip clr.w alive * kill player bra.s hk_exit hk_skip_2 cmp.b #$39,D0 * space bar pressed? bne.s hk_exit * if not then exit clr.b snd_reg * turn sounds off clr.b snd_dat move.b #$01,snd_reg clr.b snd_dat move.b #$08,snd_reg clr.b snd_dat move.b #$FF,the_key * flush keyboard hk_loop_1 move.b the_key,D0 * any key pressed? bmi.s hk_loop_1 * if not then wait bra.s hk_exit *********************************************************************** * * Initialise variables. * *********************************************************************** initialise clr.b the_key * flush keyboard clr.b read_stick * flush joystick clr.w counter * clear time counter move.w #$FFFF,alive * indicate player is alive clr.w exited * indicate screen not exited rts *********************************************************************** * * Keyboard interrupt. * *********************************************************************** kb_int movem.l D0-D1/A0,-(SP) * save registers move.b $FFFFFC02,D0 * get interrupt byte tst.b read_stick * joystick value? bne.s ki_stick_value * if true then set value cmp.b #$FF,D0 * joystick header? beq.s ki_stick_header * if true then set header bra.s ki_control_keys * look for control keys ki_exit bclr.b #$06,$FFFFFA11 * interrupt done movem.l (SP)+,D0-D1/A0 * restore registers rte ki_stick_value move.b D0,the_stick * save the joystick value clr.b read_stick * clear read value indicator bra.s ki_exit ki_stick_header move.b #$FF,read_stick * set read value indicator bra.s ki_exit ki_control_keys move.b D0,the_key * set key press move.w #$07,D1 * loop over 8 entries in table lea.l control_keys_lookup,A0 * control keys look up table ki_loop_1 cmp.b (A0)+,D0 * table entry matches key? beq.s ki_skip_1 * if true then make movement addq.l #$02,A0 * reference next table entry dbra D1,ki_loop_1 * loop bra.s ki_exit ki_skip_1 move.b (A0)+,D0 * get and mask and.b D0,the_stick * mask joystick value move.b (A0),D0 * get or mask or.b D0,the_stick * mask joystick value bra.s ki_exit control_keys_lookup dc.b $48,$FF,$01 dc.b $C8,$FE,$00 dc.b $50,$FF,$02 dc.b $D0,$FD,$00 dc.b $4B,$FF,$04 dc.b $CB,$FB,$00 dc.b $4D,$FF,$08 dc.b $CD,$F7,$00 even *********************************************************************** * * Vertical blank interrupt. * *********************************************************************** vbi_int clr.b vb_indicator * indicate vertical blank rte *********************************************************************** * * Play sounds routine. * *********************************************************************** play_sounds movem.l D0/A0,-(SP) * save registers move.w snd_1_count,D0 * any sound being played? beq.s ps_exit * if not then exit subq.w #$01,D0 * reduce count move.l snd_1_ptr,A0 * get pointer to sound data move.b #$01,snd_reg * sound register $01 move.b (A0)+,snd_dat * step size move.b #$00,snd_reg * sound register $00 move.b (A0)+,snd_dat * frequency move.b #$08,snd_reg * sound register $08 move.b (A0)+,snd_dat * volume move.w D0,snd_1_count * set count move.l A0,snd_1_ptr * set pointer ps_exit movem.l (SP)+,D0/A0 * restore registers rts *********************************************************************** * * Wait for vertical blank period. * *********************************************************************** vb_wait move.b #$FF,vb_indicator * set vertical blank indicator vw_loop tst.b vb_indicator * indicator cleared? bne.s vw_loop * if not then loop rts *********************************************************************** * * Clear screen routine. * *********************************************************************** cls lea.l screen_addr,A0 * get screen address move.w #$7CF,D0 * loop 2000 times cls_loop clr.l (A0)+ * clear 4 bytes clr.l (A0)+ * clear 4 bytes clr.l (A0)+ * clear 4 bytes clr.l (A0)+ * clear 4 bytes dbra D0,cls_loop * loop rts *********************************************************************** * * Increase score routine. * *********************************************************************** up_score movem.l D0/A0-A1,-(SP) * save registers lea.l score,A0 * get address of score cmp.l #$09090909,(A0) * reached maximum? beq.s us_skip_0 * if true then exit addq.l #$02,A0 * second to last digit us_loop move.b (A0),D0 * get digit addq.b #$01,D0 * increment it cmp.b #$0A,D0 * gone past 9? blt.s us_skip_1 * if not then skip clr.b (A0) * reset digit to 0 subq.l #$01,A0 * move onto next left digit bra.s us_loop * loop us_skip_1 move.b D0,(A0) * set digit lea.l screen_addr+$7922,A0 * print score lea.l score,A1 bsr print_string us_skip_0 movem.l (SP)+,D0/A0-A1 * restore registers rts *********************************************************************** * * Decrease number of jewels needed. * *********************************************************************** down_jewels movem.l D0/A0-A1,-(SP) * save registers lea.l collect,A0 * get address of jewels count tst.w (A0) * any more to collect? beq.s dj_skip_0 * if not then exit addq.l #$01,A0 * last digit dj_loop move.b (A0),D0 * get digit subq.b #$01,D0 * decrement digit bge.s dj_skip_1 * if positive then skip move.b #$09,(A0) * reset digit to 9 subq.l #$01,A0 * move onto next left digit bra.s dj_loop * loop dj_skip_1 move.b D0,(A0) * store digit lea.l screen_addr+$78D2,A0 * print jewels lea.l collect,A1 bsr print_string tst.w (A1) * all jewels collected? bne.s dj_skip_0 * if not then skip move.b #exit,D0 * display exit move.l exit_addr,A0 bsr draw_graphic move.w exit_ptr,D0 lea.l screen_image,A0 move.b #exit,$00(A0,D0.w) move.w #$FFFF,exit_appeared * want exit appeared sound dj_skip_0 move.w #$FFFF,jewel_collected * want jewel collected sound movem.l (SP)+,D0/A0-A1 * restore registers rts *********************************************************************** * * Decrease time. * *********************************************************************** down_time movem.l D0/A0-A1,-(SP) * save registers clr.w ticker * clear timer ticking indicator cmp.w #$06,counter * counter counted enough? beq.s dt_skip_2 * if true then decrement time addq.w #$01,counter * increment counter bra.s dt_skip_0 * exit dt_skip_2 clr.w counter * reset counter lea.l time,A0 * get address of time tst.w (A0) * any time left? beq.s dt_skip_0 * if not then exit addq.l #$01,A0 * last digit dt_loop move.b (A0),D0 * get digit subq.b #$01,D0 * decrement digit bge.s dt_skip_1 * if positive then skip move.b #$09,(A0) * reset digit to 9 subq.l #$01,A0 * move onto next left digit bra.s dt_loop * loop dt_skip_1 move.b D0,(A0) * set digit lea.l screen_addr+$78FA,A0 * print time lea.l time,A1 bsr print_string cmp.w #$0A,(A1) * timer ticking? bge.s dt_no_tick * if not then skip move.w #$FFFF,ticker * want timer ticking sound dt_no_tick tst.w (A1) * any time left? bne.s dt_skip_0 * if true then skip clr.w alive * kill off player dt_skip_0 movem.l (SP)+,D0/A0-A1 * restore registers rts *********************************************************************** * * Decrease lives. * *********************************************************************** down_lives movem.l A0-A1,-(SP) * save registers tst.b lives * any lives left? beq.s dl_skip * if not then skip subq.b #$01,lives * decrement lives lea.l screen_addr+$78B2,A0 * print lives lea.l lives,A1 bsr print_string dl_skip movem.l (SP)+,A0-A1 * restore registers rts *********************************************************************** * * Set up a new screen. * * Screen data in A1.l * *********************************************************************** set_up_new_screen movem.l A0-A1,-(SP) * save registers lea.l screen_addr,A0 * screen address move.l current_screen_ptr,A1 * pointer to screen data bsr draw_screen * draw the screen move.l A1,A2 * refernce time & collection add.l #$F0,A2 add.l #$78A0,A0 * print out status string lea.l status_string,A1 bsr print_string add.l #$12,A0 * print out lives lea.l lives,A1 bsr print_string move.w (A2)+,collect * get jewels required add.l #$20,A0 * print out jewels required lea.l collect,A1 bsr print_string move.w (A2)+,time * get time add.l #$28,A0 * print out time lea.l time,A1 bsr print_string add.l #$28,A0 * print out score lea.l score,A1 bsr print_string move.l A2,A1 * set the colour palette bsr.s set_palette movem.l (SP)+,A0-A1 * restore registers rts status_string dc.b 21,36,37,37,12,36,37,37,37,29,36,37,37,37,28,36,37,37 dc.b 37,37,$FF even lives dc.b 0,$FF even collect dc.b 0,0,$FF even time dc.b 0,0,$FF even score dc.b 0,0,0,0,$FF even *********************************************************************** * * Set palette colour. * * Palette pointer in A1.l * *********************************************************************** set_palette movem.l D0/A0-A1,-(SP) * save registers lea.l $FF8240,A0 * hardware colour palette move.w #$0F,D0 * loop over 16 colours sp_loop move.w (A1)+,(A0)+ * set colour register dbra D0,sp_loop * next colour movem.l (SP)+,D0/A0-A1 * restore registers rts *********************************************************************** * * Draw a screen routine. * * Screen address in A0.l, data in A1.l * *********************************************************************** object_addr equ $00 object_ptr equ $04 object_falling equ $06 object_type equ $08 draw_screen movem.l D0-D4/A0-A3,-(SP) * save registers lea.l screen_image,A3 * screen image lea.l object_states,A2 * object states clr.w D3 * screen image offset move.w #-1,D4 * number of objects move.w #$0B,D1 * loop over 12 rows ds_next_row move.w #$13,D2 * loop over 20 columns ds_next_column move.b (A1)+,D0 * get byte from screen pointer move.b D0,(A3)+ * put this in screen image cmp.b #jewel,D0 * a jewel? beq.s remember_object * if true remember jewel cmp.b #exit,D0 * an exit? beq.s remember_exit * if true remember exit cmp.b #boulder,D0 * a boulder? beq.s remember_object * if true remember boulder cmp.b #digger,D0 * the player? bne.s forget_object * if not then skip remember_player move.l A0,player_addr * remember player address move.w D3,player_ptr * remember screen image offset bra.s forget_object remember_exit move.l A0,exit_addr * remember exit address move.w D3,exit_ptr * remember screen image offset move.b #ground,D0 * make exit look like ground move.b D0,-1(A3) bra.s forget_object remember_object move.l A0,object_addr(A2) * remember object address move.w D3,object_ptr(A2) * remember screen image offset clr.w object_falling(A2) * not falling move.b D0,object_type(A2) * remember object type add.l #$10,A2 * update object states pointer addq.w #$01,D4 * increment number of objects forget_object bsr draw_graphic * draw sprite addq.l #$08,A0 * move onto next column addq.w #$01,D3 * increment screen image offset dbra D2,ds_next_column * next column loop add.l #$960,A0 * move onto next row dbra D1,ds_next_row * next row loop move.w D4,number_objects * remember number of objects movem.l (SP)+,D0-D4/A0-A3 * restore registers rts *********************************************************************** * * Handle the objects. * *********************************************************************** handle_objects clr.w rock_hit_ground * no rock hit ground sound move.w number_objects,D1 * loop over all objects lea.l screen_image,A1 * screen image lea.l object_states,A2 * object states ho_loop move.b object_type(A2),D2 * get object type cmp.b #jewel,D2 * a jewel? beq.s ho_move * if true then move it cmp.b #boulder,D2 * a boulder? beq.s ho_move * if true then move it ho_next add.l #$10,A2 * move onto next object dbra D1,ho_loop * next object loop rts ho_move move.w object_ptr(A2),D3 * get screen image pointer move.b $14(A1,D3.w),D4 * get what's below object cmp.b #empty,D4 * empty? beq.s ho_go_down * if true then move object down cmp.b #digger,D4 * player? bne.s ho_no_go_down * if not then skip tst.w object_falling(A2) * object falling? beq.s ho_no_go_down * if not then skip clr.w alive * kill off player bra.s ho_go_down * move object down ho_no_go_down bra.s ho_try_left * try to move object left ho_go_down move.b #empty,D0 * draw empty sprite move.l object_addr(A2),A0 bsr draw_graphic move.b D0,$00(A1,D3.w) * empty screen image move.b D2,D0 add.l #$A00,A0 * move object down bsr draw_graphic * draw object move.b D0,$14(A1,D3.w) * update screen image move.l A0,object_addr(A2) * update object address add.w #$14,object_ptr(A2) * update screen image pointer move.w #$FFFF,object_falling(A2) * falling down bra.s ho_next * move onto next object ho_try_left move.w object_ptr(A2),D3 * get screen image offset move.b -1(A1,D3.w),D4 * get what's on left of object cmp.b #empty,D4 * empty? bne.s ho_no_go_left * if not then skip move.b $13(A1,D3.w),D4 * get what's below left cmp.b #empty,D4 * empty? beq.s ho_go_left * if true then move object left ho_no_go_left bra.s ho_try_right * try to go right ho_go_left move.b #empty,D0 * draw empty sprite move.l object_addr(A2),A0 bsr draw_graphic move.b D0,$00(A1,D3.w) * empty screen image move.b D2,D0 sub.l #$08,A0 * move object left bsr draw_graphic * draw object move.b D0,-1(A1,D3.w) move.l A0,object_addr(A2) * update object address sub.w #$01,object_ptr(A2) * update screen image pointer move.w #$FFFF,object_falling(A2) * falling down bra ho_next * move onto next object ho_try_right move.w object_ptr(A2),D3 * get screen image offset move.b $01(A1,D3.w),D4 * get what's to right of object cmp.b #empty,D4 * empty? bne.s ho_no_go_right * if not then skip move.b $15(A1,D3.w),D4 * get what's below right cmp.b #empty,D4 * empty? beq.s ho_go_right * if true then go right ho_no_go_right tst.w object_falling(A2) * object falling? beq ho_next * if not then move onto next clr.w object_falling(A2) * object not falling move.w #$FFFF,rock_hit_ground * want rock hit ground sound bra ho_next * move onto next object ho_go_right move.b #empty,D0 * draw empty sprite move.l object_addr(A2),A0 bsr draw_graphic move.b D0,$00(A1,D3.w) * empty screen image move.b D2,D0 addq.l #$08,A0 * move object right bsr draw_graphic * draw object move.b D0,$01(A1,D3.w) move.l A0,object_addr(A2) * update object address addq.w #$01,object_ptr(A2) * update screen image offset move.w #$FFFF,object_falling(A2) * falling down bra ho_next * move onto next object *********************************************************************** * * Handle the player. * *********************************************************************** handle_player clr.w jewel_collected * no jewel collected sound yet clr.w player_moved * no player moved sound yet clr.w exit_appeared * no exit appeared soubnd yet lea.l screen_image,A1 * get address of screen image move.b the_stick,stick * get joystick value hp_try_up btst.b #$00,stick * joystick up? beq.s hp_try_down * if not try down clr.w player_pushing * not pushing anything move.w player_ptr,D1 * get screen image offset move.b -20(A1,D1.w),D2 * get what's above player cmp.b #ground,D2 * empty or ground? ble.s hp_go_up * if true then go up cmp.b #jewel,D2 * jewel? beq.s hp_up_collect * if true collect jewel cmp.b #exit,D2 * exit? beq.s hp_up_exit * if true exit screen bra hp_draw_it * draw player hp_up_exit move.w #$FFFF,exited * indicate exited screen bra.s hp_go_up * move player up hp_up_collect move.w D1,D3 * collect jewel sub.w #$14,D3 bsr collect_jewel bsr up_score * increase score bsr down_jewels * decrease jewels required hp_go_up move.b #empty,D0 * empty player location move.l player_addr,A0 bsr draw_graphic move.b D0,$00(A1,D1.w) * empty screen image move.b #digger,-20(A1,D1.w) * update screen image sub.l #$A00,player_addr * update player address sub.w #$14,player_ptr * update screen image offset move.w #$FFFF,player_moved * want player moved sound bra hp_draw_it * draw player hp_try_down btst.b #$01,stick * joystick down? beq.s hp_try_left * if not then try left clr.w player_pushing * not pushing move.w player_ptr,D1 * get screen image offset move.b $14(A1,D1.w),D2 * get what's below player cmp.b #ground,D2 * empty or ground? ble.s hp_go_down * if true then go down cmp.b #jewel,D2 * jewel? beq.s hp_down_collect * if true then collect jewel cmp.b #exit,D2 * exit? beq.s hp_down_exit * if true then exit screen bra hp_draw_it * draw player hp_down_exit move.w #$FFFF,exited * indicate screen exited bra.s hp_go_down * move player down hp_down_collect move.w D1,D3 * collect jewel add.w #$14,D3 bsr collect_jewel bsr up_score * increase score bsr down_jewels * decrease jewels required hp_go_down move.b #empty,D0 * empty player location move.l player_addr,A0 bsr draw_graphic move.b D0,$00(A1,D1.w) * empty screen image move.b #digger,$14(A1,D1.w) * update screen image add.l #$A00,player_addr * update player address add.w #$14,player_ptr * update screen image offset move.w #$FFFF,player_moved * want player moved sound bra hp_draw_it * draw player hp_try_left btst.b #$02,stick * joystick left? beq hp_try_right * if not try right move.w player_ptr,D1 * get screen image offset move.b -1(A1,D1.w),D2 * get what's left of player cmp.b #ground,D2 * empty or ground? ble.s hp_go_left * if true then go left cmp.b #jewel,D2 * jewel? beq.s hp_left_collect * if true collect jewel cmp.b #exit,D2 * exit? beq.s hp_left_exit * if true then exit screen cmp.b #boulder,D2 * boulder? beq left_push_boulder * if true try to push boulder clr.w player_pushing * not pushing bra hp_draw_it * draw player hp_left_exit move.w #$FFFF,exited * indicate screen exited bra.s hp_go_left * go left hp_left_collect move.w D1,D3 * collect jewel subq.w #$01,D3 bsr collect_jewel bsr up_score * increase score bsr down_jewels * decrease jewels required hp_go_left clr.w player_pushing * not pushing move.b #empty,D0 * empty player position move.l player_addr,A0 bsr draw_graphic move.b D0,$00(A1,D1.w) * empty screen image move.b #digger,-1(A1,D1.w) * update screen image sub.l #$08,player_addr * update player address sub.w #$01,player_ptr * update screen image offset move.w #$FFFF,player_moved * want player moved sound bra hp_draw_it * draw player hp_try_right btst.b #$03,stick * stick right? beq.s hp_all_done * if not then skip move.w player_ptr,D1 * get screen image offset move.b $01(A1,D1.w),D2 * get what's to right of player cmp.b #ground,D2 * empty or ground? ble.s hp_go_right * if true go right cmp.b #jewel,D2 * jewel? beq.s hp_right_collect * if true collect jewel cmp.b #exit,D2 * exit? beq.s hp_right_exit * if true exit screen cmp.b #boulder,D2 * boulder? beq right_push_boulder * if true try to push boulder hp_all_done clr.w player_pushing * not pushing bra.s hp_draw_it * draw player hp_right_exit move.w #$FFFF,exited * indicate screen exited bra.s hp_go_right * go right hp_right_collect move.w D1,D3 * collect jewel addq.w #$01,D3 bsr.s collect_jewel bsr up_score * increase score bsr down_jewels * decrease jewels required hp_go_right clr.w player_pushing * not pushing move.b #empty,D0 * empty player position move.l player_addr,A0 bsr draw_graphic move.b D0,$00(A1,D1.w) * empty screen image move.b #digger,$01(A1,D1.w) * update screen image addq.l #$08,player_addr * update player address addq.w #$01,player_ptr * update screen image offset move.w #$FFFF,player_moved * want player moved sound hp_draw_it lea.l faces,A1 * face look up table move.w face_ptr,D1 * get face pointer move.b $00(A1,D1.w),D0 * get face sprite move.l player_addr,A0 * draw face bsr draw_graphic addq.w #$01,D1 * update face pointer cmp.w #$03,D1 * last face? ble.s hp_drawn * if not then skip clr.w D1 * reset face pointer hp_drawn move.w D1,face_ptr * set face pointer rts faces dc.b digger,digger+$04,digger+$08,digger+$0C even face_ptr dc.w $00 *********************************************************************** * * Collect a jewel routine. * *********************************************************************** collect_jewel movem.l D4/A2,-(SP) * save registers lea.l object_states,A2 * address of object states cj_loop move.b object_type(A2),D4 * get object type cmp.b #jewel,D4 * jewel? bne.s cj_skip * if not then skip move.w object_ptr(A2),D4 * get screen image offset cmp.w D3,D4 * same as collected jewel? beq.s cj_found * if true then collect it cj_skip add.l #$10,A2 * move onto next object bra.s cj_loop * loop cj_found move.b #dead,object_type(A2) * remove jewel tst.w object_falling(A2) * was it falling? beq.s cj_not_falling * if not then skip clr.w alive * kill off player cj_not_falling movem.l (SP)+,D4/A2 * restore registers rts *********************************************************************** * * Push a boulder left. * *********************************************************************** left_push_boulder move.w player_pushing,D3 * get pushing status cmp.w #$02,D3 * pushed enough? beq.s left_move_boulder * if true then move boulder addq.w #$01,D3 * increase pushing status move.w D3,player_pushing * set pushing status bra hp_draw_it * draw player left_move_boulder clr.w player_pushing * not pushing move.w D1,D3 * get what's left of boulder subq.w #$01,D3 move.b -1(A1,D3.w),D2 cmp.b #empty,D2 * empty? beq.s left_roll_boulder * if true then move the boulder bra hp_draw_it * draw player left_roll_boulder lea.l object_states,A2 * object states lpb_loop move.b object_type(A2),D4 * get object type cmp.b #boulder,D4 * boulder? bne.s lpb_skip * if not then skip move.w object_ptr(A2),D4 * get screen image offset cmp.w D3,D4 * matches pushed offset? beq.s lpb_found * if true then move it lpb_skip add.l #$10,A2 * move onto next object bra.s lpb_loop * next object loop lpb_found move.l object_addr(A2),A0 * get boulder address subq.l #$08,A0 * move it left move.b #boulder,D0 bsr draw_graphic * draw boulder subq.w #$01,D3 move.b D0,$00(A1,D3.w) * update screen image move.l A0,object_addr(A2) * set address move.w D3,object_ptr(A2) * set screen image offset clr.w object_falling(A2) * not falling bra hp_go_left * go left *********************************************************************** * * Push a boulder right. * *********************************************************************** right_push_boulder move.w player_pushing,D3 * get pushing status cmp.w #$02,D3 * pushed enough? beq.s right_move_boulder * if true then move boulder addq.w #$01,D3 * increase pushing status move.w D3,player_pushing * set pushing status bra hp_draw_it * draw player right_move_boulder clr.w player_pushing * not pushing move.w D1,D3 * get what's right of boulder addq.w #$01,D3 move.b $01(A1,D3.w),D2 cmp.b #empty,D2 * empty? beq.s right_roll_boulder * if true then move the boulder bra hp_draw_it * draw player right_roll_boulder lea.l object_states,A2 * object states rpb_loop move.b object_type(A2),D4 * get object type cmp.b #boulder,D4 * boulder? bne.s rpb_skip * if not then skip move.w object_ptr(A2),D4 * get screen image offset cmp.w D3,D4 * matches pushed offset? beq.s rpb_found * if true then move it rpb_skip add.l #$10,A2 * move onto next object bra.s rpb_loop * next object loop rpb_found move.l object_addr(A2),A0 * get boulder address addq.l #$08,A0 * move it right move.b #boulder,D0 bsr.s draw_graphic * draw boulder addq.w #$01,D3 move.b D0,$00(A1,D3.w) * update screen image move.l A0,object_addr(A2) * set address move.w D3,object_ptr(A2) * set screen image offset clr.w object_falling(A2) * not falling bra hp_go_right * go right *********************************************************************** * * Draw a graphic routine. * * Graphic in D0.b, address in A0.l * *********************************************************************** draw_graphic movem.l D0-D1/A0-A2,-(SP) * save registers ext.w D0 * find offset into graphic data lea.l graphic,A1 move.l $00(A1,D0.w),A2 move.w #$0F,D1 * loop over 16 scan lines dg_next_scan move.l (A2)+,(A0)+ * copy 2 graphics planes move.l (A2)+,(A0) * copy 2 graphics planes add.l #$9C,A0 * update screen address dbra D1,dg_next_scan * next scan loop movem.l (SP)+,D0-D1/A0-A2 * restore registers rts *********************************************************************** * * Graphics data. * *********************************************************************** * Lookup table for graphics. graphic dc.l empty_graphic,ground_graphic,jewel_graphic dc.l exit_graphic,boulder_graphic,wall_graphic dc.l edge_graphic,dig1_graphic,dig2_graphic dc.l dig3_graphic,dig4_graphic,exp1_graphic dc.l exp2_graphic,exp3_graphic,exp4_graphic * Lookup table indexes. empty equ $00 ground equ $04 jewel equ $08 exit equ $0C boulder equ $10 wall equ $14 edge equ $18 digger equ $1C explode equ $2C dead equ $FF empty_graphic dc.b 0,0,0,0,0,0,0,0 dc.b 0,0,0,0,0,0,0,0 dc.b 0,0,0,0,0,0,0,0 dc.b 0,0,0,0,0,0,0,0 dc.b 0,0,0,0,0,0,0,0 dc.b 0,0,0,0,0,0,0,0 dc.b 0,0,0,0,0,0,0,0 dc.b 0,0,0,0,0,0,0,0 dc.b 0,0,0,0,0,0,0,0 dc.b 0,0,0,0,0,0,0,0 dc.b 0,0,0,0,0,0,0,0 dc.b 0,0,0,0,0,0,0,0 dc.b 0,0,0,0,0,0,0,0 dc.b 0,0,0,0,0,0,0,0 dc.b 0,0,0,0,0,0,0,0 dc.b 0,0,0,0,0,0,0,0 ground_graphic dc.b 1,16,158,128,0,0,0,0 dc.b 65,24,142,0,0,0,0,0 dc.b 97,204,134,24,0,0,0,0 dc.b 241,134,198,88,0,0,0,0 dc.b 96,0,96,28,0,0,0,0 dc.b 35,193,32,0,0,0,0,0 dc.b 7,207,135,129,0,0,0,0 dc.b 7,231,239,207,0,0,0,0 dc.b 0,227,223,227,0,0,0,0 dc.b 0,48,7,227,0,0,0,0 dc.b 240,56,243,240,0,0,0,0 dc.b 200,4,249,248,0,0,0,0 dc.b 4,0,252,112,0,0,0,0 dc.b 3,7,126,0,0,0,0,0 dc.b 0,255,28,0,0,0,0,0 dc.b 1,248,0,0,0,0,0,0 jewel_graphic dc.b 1,128,1,128,1,128,1,128 dc.b 1,192,3,192,1,192,3,192 dc.b 6,192,7,224,6,192,7,224 dc.b 3,208,15,240,3,208,15,240 dc.b 19,184,15,248,3,184,31,248 dc.b 57,188,7,252,1,188,63,252 dc.b 9,206,119,254,1,206,127,254 dc.b 60,131,3,255,0,131,255,255 dc.b 0,0,0,127,0,0,255,255 dc.b 49,50,0,12,0,0,127,254 dc.b 3,60,0,0,0,0,63,252 dc.b 7,24,0,0,0,0,31,248 dc.b 14,128,1,0,0,0,15,240 dc.b 5,128,2,0,0,0,7,224 dc.b 3,128,0,0,0,0,3,192 dc.b 1,128,0,0,0,0,1,128 exit_graphic dc.b 0,0,0,0,0,0,0,0 dc.b 0,0,0,0,0,0,0,0 dc.b 0,0,0,0,0,0,0,0 dc.b 251,111,251,127,251,127,251,127 dc.b 251,111,251,127,251,127,251,127 dc.b 203,102,203,102,0,0,251,127 dc.b 0,0,203,102,203,102,251,127 dc.b 0,0,203,102,203,102,203,102 dc.b 203,102,203,102,0,0,203,102 dc.b 251,230,251,230,251,230,251,230 dc.b 251,230,251,230,251,230,251,230 dc.b 0,0,0,0,0,0,251,230 dc.b 0,0,0,0,0,0,251,230 dc.b 0,0,0,0,0,0,0,0 dc.b 0,0,0,0,0,0,0,0 dc.b 0,0,0,0,0,0,0,0 boulder_graphic dc.b 0,0,0,0,0,0,7,224 dc.b 15,240,4,32,4,32,31,248 dc.b 28,56,15,240,12,48,63,252 dc.b 63,252,35,196,0,0,127,254 dc.b 127,254,35,196,35,196,255,255 dc.b 119,222,107,230,35,196,255,255 dc.b 92,58,63,252,16,8,255,255 dc.b 92,58,63,252,28,56,255,255 dc.b 92,58,63,252,28,56,255,255 dc.b 92,58,63,252,16,8,255,255 dc.b 123,222,103,230,35,196,255,255 dc.b 127,254,35,196,35,196,255,255 dc.b 63,252,35,196,0,0,127,254 dc.b 28,56,15,240,12,48,63,252 dc.b 15,240,4,32,0,0,31,248 dc.b 0,0,0,0,0,0,7,224 wall_graphic dc.b 255,254,127,255,255,255,0,0 dc.b 255,252,63,255,255,255,0,0 dc.b 255,248,31,255,255,255,0,0 dc.b 255,240,15,255,255,255,0,0 dc.b 255,224,7,255,255,255,0,0 dc.b 255,192,3,255,255,255,0,0 dc.b 255,128,1,255,255,255,0,0 dc.b 255,0,0,255,255,255,0,0 dc.b 0,255,0,0,255,255,0,0 dc.b 0,127,0,0,254,127,0,0 dc.b 0,63,0,0,252,63,0,0 dc.b 0,31,0,0,248,31,0,0 dc.b 0,15,0,0,240,15,0,0 dc.b 0,7,0,0,224,7,0,0 dc.b 0,3,0,0,192,3,0,0 dc.b 0,1,0,0,128,1,0,0 edge_graphic dc.b 254,254,254,254,255,255,255,255 dc.b 0,0,254,254,255,255,255,255 dc.b 0,0,254,254,255,255,255,255 dc.b 0,0,254,254,255,255,255,255 dc.b 0,0,254,254,255,255,255,255 dc.b 0,0,254,254,255,255,255,255 dc.b 0,0,254,254,255,255,255,255 dc.b 0,0,0,0,255,255,255,255 dc.b 254,254,254,254,255,255,255,255 dc.b 0,0,254,254,255,255,255,255 dc.b 0,0,254,254,255,255,255,255 dc.b 0,0,254,254,255,255,255,255 dc.b 0,0,254,254,255,255,255,255 dc.b 0,0,254,254,255,255,255,255 dc.b 0,0,254,254,255,255,255,255 dc.b 0,0,0,0,255,255,255,255 dig1_graphic dc.b 31,252,0,0,31,252,0,0 dc.b 63,254,0,0,63,254,0,0 dc.b 0,127,0,0,63,255,0,0 dc.b 16,63,0,0,31,255,31,0 dc.b 29,191,2,62,63,255,63,128 dc.b 51,193,2,127,55,255,55,128 dc.b 51,128,2,127,113,255,115,128 dc.b 127,128,0,127,127,255,127,128 dc.b 127,128,0,62,255,255,255,128 dc.b 207,128,0,0,207,255,207,193 dc.b 15,0,0,0,63,255,63,255 dc.b 0,0,0,0,63,255,63,255 dc.b 0,0,0,0,1,255,1,255 dc.b 12,0,0,0,31,255,31,255 dc.b 0,0,0,0,31,255,31,255 dc.b 0,0,0,0,15,254,15,254 dig2_graphic dc.b 31,248,0,0,31,248,0,0 dc.b 63,252,0,0,63,252,0,0 dc.b 96,6,0,0,127,254,0,0 dc.b 64,2,0,0,127,254,0,0 dc.b 0,0,0,0,127,254,0,0 dc.b 128,1,128,1,255,255,0,0 dc.b 0,0,128,1,255,255,0,0 dc.b 0,0,128,1,255,255,0,0 dc.b 0,0,128,1,255,255,64,2 dc.b 63,252,0,0,255,255,127,254 dc.b 0,0,0,0,127,254,127,254 dc.b 0,0,0,0,127,254,127,254 dc.b 0,0,0,0,127,254,127,254 dc.b 0,0,0,0,127,254,127,254 dc.b 0,0,0,0,63,252,63,252 dc.b 0,0,0,0,15,240,15,240 dig3_graphic dc.b 63,248,0,0,63,248,0,0 dc.b 127,252,0,0,127,252,0,0 dc.b 254,0,0,0,255,252,0,0 dc.b 252,8,0,0,255,248,0,248 dc.b 253,248,124,0,255,252,1,252 dc.b 131,188,254,112,255,252,1,252 dc.b 1,204,254,64,255,142,1,206 dc.b 1,254,254,0,255,254,1,254 dc.b 1,254,124,0,255,255,1,255 dc.b 1,243,0,0,255,243,131,243 dc.b 0,240,0,0,255,252,255,252 dc.b 0,0,0,0,255,252,255,252 dc.b 0,0,0,0,255,128,255,128 dc.b 0,48,0,0,255,120,255,120 dc.b 0,0,0,0,255,248,255,248 dc.b 0,0,0,0,127,240,127,240 dig4_graphic dc.b 31,248,0,0,31,248,0,0 dc.b 63,252,0,0,63,252,0,0 dc.b 64,0,0,0,127,254,0,0 dc.b 48,4,0,0,127,254,63,252 dc.b 58,252,65,2,127,254,127,254 dc.b 169,45,220,115,255,255,127,254 dc.b 52,88,213,83,227,143,119,222 dc.b 124,126,131,129,255,255,127,254 dc.b 62,188,129,65,255,255,127,254 dc.b 61,60,0,64,253,127,125,126 dc.b 12,96,2,128,127,254,127,254 dc.b 0,0,0,0,127,254,127,254 dc.b 19,144,2,128,115,158,115,158 dc.b 8,32,0,0,120,62,120,62 dc.b 7,192,0,0,63,252,63,252 dc.b 0,0,0,0,15,240,15,240 exp1_graphic dc.b 0,0,0,0,0,0,0,0 dc.b 0,0,0,0,0,0,0,0 dc.b 0,0,0,0,0,0,0,0 dc.b 0,0,0,0,0,0,0,0 dc.b 0,0,0,0,0,128,0,0 dc.b 0,128,0,0,8,144,0,0 dc.b 1,128,1,128,7,224,0,128 dc.b 1,192,3,192,3,192,1,192 dc.b 1,128,3,192,7,224,0,128 dc.b 1,192,0,128,7,208,0,0 dc.b 0,0,0,0,8,128,0,0 dc.b 0,0,0,0,0,128,0,0 dc.b 0,0,0,0,0,0,0,0 dc.b 0,0,0,0,0,0,0,0 dc.b 0,0,0,0,0,0,0,0 dc.b 0,0,0,0,0,0,0,0 exp2_graphic dc.b 0,0,0,0,0,0,0,0 dc.b 0,0,0,0,0,0,0,0 dc.b 0,0,0,0,0,0,0,0 dc.b 0,0,0,0,4,32,0,0 dc.b 0,0,0,0,0,128,0,0 dc.b 1,128,0,0,11,208,0,0 dc.b 6,96,1,128,39,228,0,0 dc.b 5,160,3,192,15,224,0,0 dc.b 5,160,3,192,39,244,0,0 dc.b 6,96,1,128,7,224,0,0 dc.b 1,128,0,0,11,208,0,0 dc.b 0,0,0,0,1,0,0,0 dc.b 0,0,0,0,4,32,0,0 dc.b 0,0,0,0,0,0,0,0 dc.b 0,0,0,0,0,0,0,0 dc.b 0,0,0,0,0,0,0,0 exp3_graphic dc.b 0,0,0,0,0,128,0,0 dc.b 0,0,0,0,4,16,0,0 dc.b 2,64,0,0,18,64,0,0 dc.b 0,0,1,16,1,20,0,0 dc.b 5,200,4,128,33,232,4,0 dc.b 6,212,3,228,5,240,3,132 dc.b 21,240,31,240,15,240,16,208 dc.b 15,252,15,244,143,252,7,224 dc.b 39,248,3,252,39,253,1,240 dc.b 15,250,7,240,15,250,3,208 dc.b 3,236,17,72,19,252,1,64 dc.b 5,32,1,34,133,162,0,32 dc.b 0,16,16,16,16,0,0,16 dc.b 0,32,2,128,10,160,0,0 dc.b 2,0,0,0,2,4,0,0 dc.b 0,0,0,0,0,64,0,0 exp4_graphic dc.b 0,0,0,0,0,0,0,0 dc.b 0,0,0,0,17,32,0,0 dc.b 0,128,0,0,4,128,0,0 dc.b 7,64,0,128,71,192,0,0 dc.b 18,192,13,40,31,236,0,0 dc.b 43,216,23,224,63,248,1,0 dc.b 151,240,15,232,159,248,7,192 dc.b 31,233,31,240,63,253,7,192 dc.b 175,232,31,244,191,252,7,192 dc.b 15,248,63,240,63,248,7,192 dc.b 31,196,15,248,31,252,1,0 dc.b 11,176,39,192,191,241,0,0 dc.b 7,208,8,32,15,244,0,0 dc.b 69,0,0,0,69,128,0,0 dc.b 0,0,0,0,16,16,0,0 dc.b 0,0,0,0,0,128,0,0 *********************************************************************** * * Print a character routine. * * Character in D0.b, address in A0.l * *********************************************************************** print_character movem.l D0/A0-A1,-(SP) * save registers ext.w D0 * evaluate character offset mulu.w #$0E,D0 ext.l D0 add.l #character_set,D0 move.l D0,A1 move.w #$06,D0 * loop over 7 scan lines pc_loop move.w (A1)+,(A0) * copy scan word add.l #$A0,A0 * update screen address dbra D0,pc_loop * next scan loop movem.l (SP)+,D0/A0-A1 * restore registers rts *********************************************************************** * * Print a string routine. * * Address in A0.l, string in A1.l * *********************************************************************** print_string movem.l D0/A0-A1,-(SP) * save registers ps_loop move.b (A1)+,D0 * get character cmp.b #$FF,D0 * end of string marker? beq.s ps_skip * if true then skip bsr.s print_character * print character addq.l #$08,A0 * update screen address bra.s ps_loop * loop ps_skip movem.l (SP)+,D0/A0-A1 * restore registers rts *********************************************************************** * * Character set data. * *********************************************************************** character_set dc.b 15,240,60,60,60,252,63,60 dc.b 60,60,60,60,15,240 dc.b 3,192,15,192,3,192,3,192 dc.b 3,192,3,192,63,252 dc.b 15,240,60,60,0,60,0,240 dc.b 3,192,15,0,63,252 dc.b 63,252,0,240,3,192,0,240 dc.b 0,60,60,60,15,240 dc.b 0,240,3,240,15,240,60,240 dc.b 63,252,0,240,0,240 dc.b 63,252,60,0,63,240,0,60 dc.b 0,60,60,60,15,240 dc.b 15,240,60,0,60,0,63,240 dc.b 60,60,60,60,15,240 dc.b 63,252,0,60,0,240,3,192 dc.b 15,0,15,0,15,0 dc.b 15,240,60,60,60,60,15,240 dc.b 60,60,60,60,15,240 dc.b 15,240,60,60,60,60,15,252 dc.b 0,60,0,240,15,192 dc.b 3,192,15,240,60,60,60,60 dc.b 63,252,60,60,60,60,63,240 dc.b 60,60,60,60,63,240,60,60 dc.b 60,60,63,240,15,240,60,60 dc.b 60,0,60,0,60,0,60,60 dc.b 15,240,63,192,60,240,60,60 dc.b 60,60,60,60,60,240,63,192 dc.b 63,252,60,0,60,0,63,240 dc.b 60,0,60,0,63,252,63,252 dc.b 60,0,60,0,63,240,60,0 dc.b 60,0,60,0,15,252,60,0 dc.b 60,0,60,252,60,60,60,60 dc.b 15,252,60,60,60,60,60,60 dc.b 63,252,60,60,60,60,60,60 dc.b 15,240,3,192,3,192,3,192 dc.b 3,192,3,192,15,240,0,60 dc.b 0,60,0,60,0,60,0,60 dc.b 60,60,15,240,60,60,60,240 dc.b 63,192,63,0,63,192,60,240 dc.b 60,60,60,0,60,0,60,0 dc.b 60,0,60,0,60,0,63,252 dc.b 240,60,252,252,255,252,243,60 dc.b 240,60,240,60,240,60,60,60 dc.b 63,60,63,252,63,252,60,252 dc.b 60,60,60,60,15,240,60,60 dc.b 60,60,60,60,60,60,60,60 dc.b 15,240,63,240,60,60,60,60 dc.b 63,240,60,0,60,0,60,0 dc.b 15,240,60,60,60,60,60,60 dc.b 63,60,60,240,15,60,63,240 dc.b 60,60,60,60,63,240,60,240 dc.b 60,60,60,60,15,240,60,60 dc.b 60,0,15,240,0,60,60,60 dc.b 15,240,63,252,3,192,3,192 dc.b 3,192,3,192,3,192,3,192 dc.b 60,60,60,60,60,60,60,60 dc.b 60,60,60,60,15,252,60,60 dc.b 60,60,60,60,60,60,60,60 dc.b 15,240,3,192,240,60,240,60 dc.b 240,60,243,60,255,252,252,252 dc.b 240,60,60,60,60,60,15,240 dc.b 3,192,15,240,60,60,60,60 dc.b 60,60,60,60,60,60,15,240 dc.b 3,192,3,192,3,192,63,252 dc.b 0,60,0,240,3,192,15,0 dc.b 60,0,63,252,0,0,3,192 dc.b 3,192,0,0,3,192,3,192 dc.b 0,0 dc.b 0,0,0,0,0,0,0,0 dc.b 0,0,0,0,0,0 *********************************************************************** * * Screen data. * *********************************************************************** s equ empty g equ ground j equ jewel x equ exit b equ boulder w equ wall e equ edge p equ digger title_screen dc.b s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s dc.b s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s dc.b s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s dc.b e,s,s,s,s,e,s,s,e,e,e,e,s,s,e,e,e,e,e,s dc.b e,e,s,s,e,e,s,e,s,s,s,s,e,s,e,s,s,s,s,e dc.b e,s,e,e,s,e,s,e,s,s,s,s,e,s,e,s,s,s,s,e dc.b e,s,s,s,s,e,s,e,e,e,e,e,e,s,e,s,s,s,s,e dc.b e,s,s,s,s,e,s,e,s,s,s,s,e,s,e,s,s,s,s,e dc.b e,s,s,s,s,e,s,e,s,s,s,s,e,s,e,e,e,e,e,s dc.b s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s dc.b s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s dc.b s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s title_palette dc.w $000,$167,$740,$070,$060,$720,$740,$760 dc.w $737,$147,$167,$666,$333,$444,$555,$777 screen_0 dc.b e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e dc.b e,p,g,w,s,g,g,g,w,g,b,g,g,g,w,w,g,s,x,e dc.b e,g,g,s,g,w,g,s,g,g,j,s,w,g,g,g,g,b,g,e dc.b e,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,g,g,g,e dc.b e,b,g,b,g,s,g,j,g,w,b,s,w,s,s,g,g,g,s,e dc.b e,g,s,g,s,w,g,g,s,g,g,g,g,g,s,s,g,w,g,e dc.b e,b,g,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,e dc.b e,g,g,g,w,g,w,b,w,g,g,g,g,g,b,b,j,b,b,e dc.b e,g,s,g,g,g,j,g,s,s,b,b,b,g,g,g,g,g,g,e dc.b e,w,w,g,b,g,g,g,w,g,g,g,g,g,w,s,g,b,s,e dc.b e,j,s,g,w,g,j,g,g,g,w,w,g,w,w,g,g,g,j,e dc.b e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e dc.b 0,6,4,0 dc.w $000,$040,$050,$070,$510,$720,$740,$760 dc.w $017,$147,$167,$666,$333,$444,$555,$777 screen_1 dc.b e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e dc.b e,x,b,g,w,w,w,w,g,g,g,g,g,g,g,g,g,g,g,e dc.b e,j,g,g,g,g,s,w,g,w,w,w,w,w,w,w,w,w,g,e dc.b e,w,w,p,w,s,b,w,g,g,g,g,g,g,j,w,b,w,g,e dc.b e,b,w,g,w,g,b,w,w,w,w,w,w,w,b,w,b,w,g,e dc.b e,b,w,g,w,j,g,w,b,j,g,b,g,w,b,w,j,w,g,e dc.b e,j,w,g,w,g,g,w,w,w,w,g,j,w,b,w,g,w,g,e dc.b e,g,w,g,w,g,g,g,g,g,w,w,g,w,g,w,g,w,g,e dc.b e,g,w,g,w,w,w,w,w,g,g,g,g,g,g,g,g,w,g,e dc.b e,g,w,g,w,b,b,g,w,g,w,w,w,w,w,w,w,w,g,e dc.b e,g,g,g,g,g,g,j,w,g,g,g,g,g,g,g,g,g,g,e dc.b e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e dc.b 0,7,5,0 dc.w $000,$017,$147,$167,$040,$050,$060,$070 dc.w $510,$710,$720,$666,$333,$444,$555,$777 screen_2 dc.b e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e dc.b e,j,b,w,x,b,w,g,g,g,g,g,g,g,b,b,g,b,b,e dc.b e,g,b,w,j,g,w,g,w,w,w,w,w,g,g,g,g,g,g,e dc.b e,g,b,w,g,g,w,g,w,j,w,j,b,w,w,w,w,g,g,e dc.b e,g,g,w,w,g,w,g,w,b,w,b,g,g,g,g,w,g,j,e dc.b e,g,g,g,g,p,g,g,g,g,g,g,g,w,w,g,g,w,w,e dc.b e,g,g,w,g,w,w,g,w,g,g,g,g,g,g,g,g,g,b,e dc.b e,w,g,w,g,w,g,g,w,g,w,w,w,g,w,w,w,g,j,e dc.b e,b,g,w,g,w,g,w,g,g,w,j,w,g,w,b,w,g,g,e dc.b e,g,g,w,g,w,g,w,g,b,w,b,w,w,w,j,w,g,g,e dc.b e,j,g,w,j,w,j,w,g,g,g,g,b,g,g,g,g,g,g,e dc.b e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e dc.b 1,0,6,5 dc.w $000,$510,$720,$740,$017,$147,$167,$367 dc.w $040,$050,$060,$666,$333,$444,$555,$777 screen_3 dc.b e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e dc.b e,x,w,b,w,b,w,b,w,b,w,b,w,b,w,b,b,w,b,e dc.b e,g,w,j,w,b,w,j,w,b,w,j,w,b,w,j,b,w,j,e dc.b e,g,w,g,g,b,w,g,w,j,w,g,w,b,w,g,g,w,g,e dc.b e,g,w,g,g,j,w,g,w,g,w,g,w,j,w,g,g,w,g,e dc.b e,g,w,g,g,g,w,g,w,g,w,g,w,g,w,w,g,w,g,e dc.b e,j,w,g,g,g,w,g,w,g,w,g,w,g,w,g,g,w,g,e dc.b e,g,w,w,w,g,w,g,w,g,w,g,w,g,w,g,w,w,g,e dc.b e,g,w,g,g,g,w,g,w,g,w,g,w,g,w,g,g,w,g,e dc.b e,g,w,g,g,g,w,g,w,g,w,g,w,g,w,g,g,w,g,e dc.b e,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,p,e dc.b e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e dc.b 0,9,5,0 dc.w $000,$414,$626,$737,$330,$440,$550,$660 dc.w $134,$245,$356,$666,$333,$444,$555,$777 screen_4 dc.b e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e dc.b e,x,g,w,j,b,j,j,b,j,b,b,j,b,j,j,j,b,j,e dc.b e,p,g,w,b,j,j,j,j,b,b,j,b,j,b,b,b,j,b,e dc.b e,g,g,w,j,b,j,b,j,b,j,j,j,j,j,j,b,b,j,e dc.b e,g,j,w,b,j,b,j,b,j,b,j,b,j,j,b,j,b,b,e dc.b e,g,g,w,j,b,b,j,b,b,b,b,b,b,b,j,b,b,b,e dc.b e,g,g,w,w,w,w,w,w,w,w,g,w,w,w,w,w,w,w,e dc.b e,g,g,w,g,g,g,g,g,g,g,g,g,g,g,g,g,b,g,e dc.b e,w,g,w,g,b,j,b,b,g,g,g,g,g,g,g,g,g,g,e dc.b e,g,g,w,g,g,b,g,g,g,g,g,g,g,b,g,b,b,b,e dc.b e,j,g,g,g,g,g,g,g,b,g,g,g,g,g,g,g,j,j,e dc.b e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e dc.b 2,5,7,5 dc.w $000,$440,$550,$660,$404,$515,$626,$737 dc.w $240,$351,$462,$666,$333,$444,$555,$777 screen_5 dc.b e,e,e,e,e,e,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g,g,g,g,g,j,g,g,g,g,g,e dc.b e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e,e dc.b 0,6,4,0 dc.w $000,$017,$147,$167,$040,$050,$060,$070 dc.w $510,$710,$720,$666,$333,$444,$555,$777 *********************************************************************** * * Equates. * *********************************************************************** delay equ * the_key equ delay+$04 exit_appeared equ the_key+$04 ticker equ exit_appeared+$04 snd_1_count equ ticker+$04 snd_1_ptr equ snd_1_count+$04 jewel_collected equ snd_1_ptr+$04 rock_hit_ground equ jewel_collected+$04 player_moved equ rock_hit_ground+$04 alive equ player_moved+$04 exited equ alive+$04 counter equ exited+$04 vb_indicator equ counter+$04 read_stick equ vb_indicator+$04 the_stick equ read_stick+$04 stick equ the_stick+$04 current_screen_ptr equ stick+$04 number_objects equ current_screen_ptr+$04 player_addr equ number_objects+$04 player_ptr equ player_addr+$04 player_pushing equ player_ptr+$04 exit_addr equ player_pushing+$04 exit_ptr equ exit_addr+$04 object_states equ exit_ptr+$04 screen_image equ object_states+$1000 stack_bottom equ screen_image+$1000 stack_top equ stack_bottom+$1000 *********************************************************************** . @iD.. @iGRABBER PRGOiEpGRABBER SRCYiF ICTURE0PI1:i\ `DB?< NA\/ yV0<JgQ`!<NAX9=R<9o<0=3Nupicture0.pi"0  ,************************************* * * * ST Screen Grabber * * * * --------------------------------- * * * * By Paul Lay * * * ************************************* *************** *** equates *** *************** gemdos equ $01 super equ $20 term equ $31 create equ $3C close equ $3E write equ $40 vblqueue equ $0456 dumpflag equ $04EE *********************** *** install routine *** *********************** *** enter supervisor mode *** clr.l -(SP) ; use user stack move.w #super,-(SP) trap #gemdos addq.l #$06,SP move.l D0,-(SP) ; save old supervisor stack *** insert routine in VBL routine list *** move.l vblqueue,A0 ; get pointer to list move.w #$07,D0 ; loop over 8 entries search_vbi_queue tst.l (A0)+ ; check whether free beq.s set_vbi_vector dbra D0,search_vbi_queue bra.s exit_programme ; could not install set_vbi_vector move.l #grabber,-(A0) ; set vector to routine *** routine installed so return to desktop *** exit_programme *** exit supervisor mode *** move.w #super,-(SP) trap #gemdos addq.l #$06,SP *** terminate program *** clr.w -(SP) ; good return code move.l #$400,-(SP) ; reserve $400 bytes move.w #term,-(SP) ; terminate program trap #gemdos *********************************** *** vbi routine to grab display *** *********************************** grabber tst.w dumpflag ; check for ALT-HELP beq.s save_display rts **************************** *** save display routine *** **************************** save_display *** get resolution and palette values *** move.b $FF8260,D0 ; get screen resolution and.w #$0003,D0 move.w D0,resolution add.b #'1',D0 move.b D0,extender move.w #$0F,D0 ; get colours move.l #$FF8240,A0 move.l #palette,A1 next_colour move.w (A0)+,D1 and.w #$0777,D1 move.w D1,(A1)+ dbra D0,next_colour *** open file *** move.w #$00,-(SP) ; read/write status move.l #filename,-(SP) move.w #create,-(SP) trap #gemdos addq.l #$08,SP move.w D0,handle *** save resolution and palette values *** move.l #resolution,-(SP) move.l #$22,-(SP) ; 34 bytes move.w handle,-(SP) move.w #write,-(SP) trap #gemdos add.l #$0C,SP *** get screen start address *** clr.l D0 move.b $FF8201,D0 lsl.l #$08,D0 move.b $FF8203,D0 lsl.l #$08,D0 *** save screen memory *** move.l D0,-(SP) move.l #$7D00,-(SP) ; 32000 bytes move.w handle,-(SP) move.w #write,-(SP) trap #gemdos add.l #$0C,SP **** close file *** move.w handle,-(SP) move.w #close,-(SP) trap #gemdos addq.l #$04,SP *** update filename *** move.b version,D0 ; get version number addq.b #$01,D0 ; update version number cmp.b #'9',D0 ble.s updated move.b #'0',D0 updated move.b D0,version ; save new version number move.w #$FFFF,dumpflag ; reset ALT-HELP rts ; return control to program ***************** *** variables *** ***************** save_ssp ds.l $01 handle ds.w $01 resolution ds.w $01 palette ds.w $10 filename dc.b 'picture' version dc.b '0.pi' extender dc.b $00,$00 . ziJ.. ziFADER ASMiLFADER PRGiSBURNS PI1Hi"}CRUISE PI1Ni<"}. iK.. iSTARS ASMiT^STARS PRGi\?; **************************************************************************** ; * ; * Degas Fading Slide Show Program ; * ; * By Paul Lay, (C) 1986 ; * ; **************************************************************************** ; **************************************************************************** ; * ; * Equates ; * ; **************************************************************************** gemdos equ $01 ; gemdos trap vector & codes term equ $00 setdta equ $1A open equ $3D close equ $3E read equ $3F setblock equ $4A sfirst equ $4E snext equ $4F xbios equ $0E ; xbios trap vector & codes getrez equ $04 setpalette equ $06 random equ $11 jdisint equ $1A jenabint equ $1B wvbl equ $25 scrn_mmry equ $78000 ; actually displayed scrn_bffr equ $70000 ; buffer area scrn_load equ scrn_bffr-$22 scrn_palette equ scrn_load+$02 ; **************************************************************************** ; * ; * Program ; * ; **************************************************************************** start move.l SP,A5 ; reserve appropriate memory move.l #$68000,SP ; initialize stack move.l 4(A5),A5 move.l $0C(A5),D0 add.l $14(A5),D0 add.l $1C(A5),D0 add.l #$100,D0 move.l D0,-(SP) move.l A5,-(SP) move.w #$00,-(SP) move.w #setblock,-(SP) trap #gemdos add.l #$0C,SP move.w #$06,-(SP) ; disable keyboard & midi ACIAs move.w #jdisint,-(SP) trap #xbios addq.l #$04,SP move.w #getrez,-(SP) ; enquire screen resolution trap #xbios addq.l #$02,SP add.b D0,file_name+$04 ; set filename extender first_file_loop move.l #dta,-(SP) ; search for first file move.w #setdta,-(SP) trap #gemdos addq.l #$06,SP move.w #$00,-(SP) ; normal attributes move.l #file_name,-(SP) move.w #sfirst,-(SP) trap #gemdos addq.l #$08,SP tst.w D0 ; check file found bne.l no_files next_file_loop move.w #$00,-(SP) ; open file for reading move.l #dta+$1E,-(SP) move.w #open,-(SP) trap #gemdos addq.l #$08,SP move.w D0,handle move.l #scrn_load,-(SP) ; read in file move.l #$7D22,-(SP) move.w handle,-(SP) move.w #read,-(SP) trap #gemdos add.l #$0C,SP move.w handle,-(SP) ; close file move.w #close,-(SP) trap #gemdos addq.l #$04,SP move.w #wvbl,-(SP) ; wait for VBL trap #xbios addq.l #$02,SP bsr.l clear_screen ; clear the screen move.l #scrn_palette,-(SP) ; set colour palette move.w #setpalette,-(SP) trap #xbios addq.l #$06,SP bsr.s fade_in ; fade in buffered picture move.w #$100,D6 ; viewing delay delay move.w #wvbl,-(SP) trap #xbios dbra D6,delay move.w #snext,-(SP) ; attempt to get next file trap #gemdos addq.l #$02,SP tst.w D0 beq.s next_file_loop bne.l first_file_loop ; otherwise start again no_files move.w #$06,-(SP) ; enable keyboard & midi ACIAs move.w #jenabint,-(SP) trap #xbios addq.l #$04,SP move.w #term,-(SP) ; terminate program trap #gemdos ; **************************************************************************** ; * ; * Fade in buffered picture ; * ; **************************************************************************** fade_in move.w #$7FFF,D6 fade_loop move.w #random,-(SP) ; request random number trap #xbios addq.l #$02,SP and.w #$7FFF,D0 move.l #scrn_bffr,A0 move.l #scrn_mmry,A1 move.w #$04,D1 update_loop move.b $00(A0,D0.w),$00(A1,D0.w) add.l #$50,D0 and.l #$7FFF,D0 dbra D1,update_loop dbra D6,fade_loop move.w #$7FF,D0 ; copy picture move.l #scrn_bffr,A0 move.l #scrn_mmry,A1 copy_loop move.l (A0)+,(A1)+ move.l (A0)+,(A1)+ move.l (A0)+,(A1)+ move.l (A0)+,(A1)+ dbra D0,copy_loop rts ; **************************************************************************** ; * ; * Clear the screen ; * ; **************************************************************************** clear_screen move.w #$7FF,D0 ; clear the screen move.l #scrn_mmry,A0 cls_loop clr.l (A0)+ clr.l (A0)+ clr.l (A0)+ clr.l (A0)+ dbra D0,cls_loop rts ; **************************************************************************** ; * ; * Variables ; * ; **************************************************************************** handle ds.w $01 file_name dc.b '*.PI1',$00 dta ds.b $2C ; **************************************************************************** ; * ; * The end ; * ; **************************************************************************** end `*O.|*m - ЭЭ// ?<?<JNA ?<?<NNX?<NNT9x/<z?<NA\?</<t?<NNAPJ@f?</<?<=NAP3r/</<}"?9r?<?NA ?9r?<>NAX?<%NNTa/<?<NN\a0<<?<%NNQ?<ONATJ@gf^?<?<NNX?<NA<<?<NNT@ |"|2<PQQ0< |"|""""QNu0< |BBBBQNu*.PI1H; **************************** ; * ST Star Scroller * ; * ------------------------ * ; * by Paul Lay, August 1986 * ; **************************** ; **************************************************************************** ; Equates. gemdos equ $01 ; gemdos trap vector super equ $20 ; supervisor entry keep_process equ $31 ; exit maintaining store xbios equ $0E ; xbios trap vector physbase equ $02 ; return screen RAM address getrez equ $04 ; return screen resolution random equ $11 ; return random number vblqueue equ $0456 ; VBI queue ; **************************************************************************** ; Initialise the stars and set up the VBI. start move.w #physbase,-(sp) ; find screen memory trap #xbios addq.l #$02,sp move.l D0,scrn_mem_pointer ; save pointer move.w #getrez,-(sp) ; find screen resolution trap #xbios addq.l #$02,sp asl.l #$01,D0 lea masks,A0 ; save initial position mask move.w $00(A0,D0.l),bit_mask lea sizes,A0 ; save scan line size (words) move.w $00(A0,D0.l),line_size lea alongs,A0 ; save course scroll step move.w $00(A0,D0.l),bytes_along lea star_x,A5 ; initial star positions move.w #$C8,D7 get_position move.w #random,-(sp) ; get random position trap #xbios addq.l #$02,sp and.w bit_mask,D0 ; mask appropriately cmp.w line_size,D0 ; and check range bcc get_position move.w D0,(A5)+ ; set position dbra D7,get_position bsr draw_stars ; draw the stars clr.l -(sp) ; enter supervisor mode move.w #super,-(sp) trap #gemdos addq.l #$06,sp move.l D0,-(sp) init_vbi move.l vblqueue,A0 ; search VBI queue move.w #$08,D0 test tst.l (A0)+ beq set_vbi ; check for free entry dbra D0,test bra exit_supervisor set_vbi move.l #my_vbi,-(A0) ; vector VBI routine exit_supervisor move.w #super,-(sp) ; return to user mode trap #gemdos addq.l #$06,sp move.w #$00,-(sp) ; terminate program move.l #$800,-(sp) ; of size $800 bytes move.w #keep_process,-(sp) ; exit program maintaining store trap #gemdos ; **************************************************************************** ; The star scrolling VBI. my_vbi bsr erase_stars ; remove stars bsr move_stars ; update positions bra draw_stars ; redraw stars ; **************************************************************************** ; Draw and erase the stars (exclusive_or). draw_stars erase_stars move.l scrn_mem_pointer,A0 ; locate screen memory move.l #star_x,A5 ; locate star positions move.w #$64,D0 move.w even_bits,D1 ; bit image for even stars move.w odd_bits,D2 ; bit image for odd stars draw_next move.w (A5)+,A1 ; locate star offset eor.w D1,$00(A0,A1.w) ; store even bit image add.l #$A0,A0 move.w (A5)+,A1 ; locate star offset eor.w D2,$00(A0,A1.w) ; store odd bit image add.l #$A0,A0 dbra D0,draw_next rts ; **************************************************************************** ; Move the stars. move_stars move.w even_bits,D0 ; test even bit image cmpi.w #%1000000000000000,D0 bne okay1 bsr course_even_scroll ; course scroll even stars okay1 rol.w #$01,D0 ; fine scroll even bit image move.w D0,even_bits move.w odd_bits,D0 ; test odd bit image cmpi.w #%0100000000000000,D0 bne okay2 bsr course_odd_scroll ; course scroll odd stars okay2 rol.w #$02,D0 ; fine scroll odd bit image move.w D0,odd_bits rts ; **************************************************************************** ; Course scroll the even stars (slow plane). course_even_scroll move.l #star_x,A5 ; set address of first even star bra all_scroll ; perform the scroll ; **************************************************************************** ; Course scroll the odd stars (fast plane). course_odd_scroll move.l #star_x+$02,A5 ; set address of first odd star ; **************************************************************************** ; Perform the scroll. all_scroll move.w #$64,D1 next_scroll move.w (A5),D2 ; get star offset bne okay3 ; check if zero move.w line_size,D2 ; reset position okay3 sub.w bytes_along,D2 ; move left (course) move.w D2,(A5) ; store new offset addq.l #$04,A5 ; move onto next star dbra D1,next_scroll rts ; **************************************************************************** ; Variables. even_bits ; even bit image dc.w %0000000000000001 odd_bits ; odd bit image dc.w %0000000000000001 masks ; masks for initial positions dc.w $F8,$FC,$7E sizes ; sizes of scan lines (words) dc.w $A0,$A0,$50 alongs ; course scroll steps dc.w $08,$04,$02 scrn_mem_pointer ; pointer to screen memory ds.l $01 bit_mask ; bit mask used ds.w $01 line_size ; line size used ds.w $01 bytes_along ; course scroll step used ds.w $01 star_x ; star positiions ds.w $C8 ; **************************************************************************** end `?<NNT#n?<NNTA\3rAb3tAh3vKx><?<NNTyrytd:QaNB?< NA\/ xV0<Jg Q`!<?< NA\?</<?<1NAa a@` yn*|x0<d29X49Z2]p2]pQNu09X @fa&X3X09Z @@faX3ZNu*|x`*|z2<d4f49tyv:XQNu~P 4* $ 10 rem ****************************************** 20 rem * ST Othello * 30 rem * by * 40 rem * Paul Lay, August 1986 * 50 rem * -------------------------------------- * 60 rem * runs in low resolution * 70 rem ****************************************** 80 gosub gemint: gosub init 90 gosub selectstart: gosub initboard: abort%=0: goes%=0 100 if start%=black% then 140 110 gotoxy 20,9: ? " Player's Go " 120 piece%=white%: gosub getsquare: if abort%=1 then 90 130 gosub putpiece: goes%=goes%+1: if goes%=60 then 170 140 gotoxy 20,9: ? "Computer's Go" 150 piece%=black%: gosub computermove: if abort%=1 then 260 160 goes%=goes%+1: if goes%<>60 then 110 170 piece%=white%: gosub countpieces: ps%=total% 180 piece%=black%: gosub countpieces: cs%=total% 190 color 2: gotoxy 22,5: ? "Game Over " 200 color 6: gotoxy 22,6: ? "Player ";ps% 210 gotoxy 21,7: ? "Computer ";cs% 220 color 7: gotoxy 20,9 230 if ps%cs% then ? " Player Wins!": goto 260 250 ? " Game Drawn!" 260 color 3: gotoxy 23,16: ? " Okay? " 270 gosub mouseselect 280 if mx%>207 and mx%<262 and my%>168 and my%<176 then gosub bleep: goto 90 290 gosub buzz: goto 270 300 rem --- initialise and display the board --- 310 initboard: 320 fullw 2: clearw 2: color 1,3,1,1,1: fill 0,0 330 poke gintin,3: gemsys(78) 340 for x%=0 to 8: linef 5+20*x%,3,5+20*x%,163 350 linef 5,3+20*x%,165,3+20*x%: next x% 360 linef 172,38,298,38: linef 298,38,298,100 370 linef 298,100,172,100: linef 172,100,172,38 380 color 1,0: fill 201,39: color 8,4: fill 0,0 390 gotoxy 22,5: ? "ST Othello" 400 gotoxy 26,6: ? "by" 410 gotoxy 23,7: ? "Paul Lay" 420 color 2: gotoxy 23,16: ? " Abort " 430 for y%=0 to 7: for x%=0 to 7: board%(x%,y%)=empty%: next x%,y% 440 piece%=white%: x%=3: y%=3: gosub putpiece 450 x%=4: y%=4: gosub putpiece 460 piece%=black%: y%=3: gosub putpiece 470 x%=3: y%=4: gosub putpiece: return 480 rem --- user square select --- 490 getsquare: 500 gosub mouseselect 510 if mx%>207 and mx%<262 and my%>168 and my%<176 then 560 520 if mx%<5 or mx%>165 or my%<26 or my%>186 then 570 530 x%=(mx%-5)/20: y%=(my%-26)/20 540 if board%(x%,y%)<>empty% then 570 550 gosub countchanges: if total%=0 then 570 else return 560 abort%=1: gosub bleep: return 570 gosub buzz: goto 500 580 rem --- put piece on board --- 590 putpiece: 600 gosub bleep: color 1,1,1,4,piece%-1: pellipse 15+20*x%,13+20*y%,9,9 610 board%(x%,y%)=piece%: gosub updateboard: return 620 rem --- update board --- 630 updateboard: 640 counting%=0 650 dx%=0: dy%=-1: gosub flip: dx%=1: gosub flip: dy%=0: gosub flip 660 dy%=1: gosub flip: dx%=0: gosub flip: dx%=-1: gosub flip 670 dy%=0: gosub flip: dy%=-1: gosub flip: return 680 rem --- flip a run of pieces --- 690 flip: 700 sx%=x%: sy%=y%: count%=0 710 sx%=sx%+dx%: sy%=sy%+dy% 720 if sx%<0 or sx%>7 or sy%<0 or sy%>7 then return 730 b%=board%(sx%,sy%): if b%=empty% then return 740 if b%<>piece% then count%=count%+1: goto 710 750 if counting%=1 then total%=total%+count%: return 760 sx%=x%: sy%=y% 770 while count%>0: sx%=sx%+dx%: sy%=sy%+dy% 780 for xr%=9 to 0 step -3: color 1,1,1,4,2-piece% 790 pellipse 15+20*sx%,13+20*sy%,9,xr%: if xr%=0 then 810 800 color 1,3,1,1,1: pellipse 15+20*sx%,13+20*sy%,9,xr% 810 next xr%: for xr%=0 to 9 step 3: color 1,1,1,4,piece%-1 820 pellipse 15+20*sx%,13+20*sy%,9,xr%: if xr%=9 then 840 830 color 1,3,1,1,1: pellipse 15+20*sx%,13+20*sy%,9,xr% 840 next xr%: board%(sx%,sy%)=piece%: count%=count%-1: wend: return 850 rem --- count changes made --- 860 countchanges: 870 counting%=1: total%=0: goto 650 880 rem --- decide computer's move --- 890 computermove: 900 best%=0: for y%=0 to 7: for x%=0 to 7 910 if board%(x%,y%)<>empty% then 960 920 gosub countchanges: if total%=0 then 960 930 if x%=0 or x%=7 then total%=total%+1 940 if y%=0 or y%=7 then total%=total%+1 950 if total%>=best% then best%=total%: bx%=x%: by%=y% 960 next x%,y%: if best%>0 then x%=bx%: y%=by%: gosub putpiece: return 970 gosub buzz: abort%=1 980 gotoxy 20,9: ? " Game Aborted" 990 gotoxy 20,10: ? "No Legal Move!": return 1000 rem --- count pieces --- 1010 countpieces: 1020 total%=0: for y%=0 to 7: for x%=0 to 7 1030 if board%(x%,y%)=piece% then total%=total%+1 1040 next x%,y%: return 1050 rem --- select start options --- 1060 selectstart: 1070 fullw 2: clearw 2 1080 poke gintin,0: gemsys(78) 1090 color 2,5,1,3,3: linef 100,25,220,25: linef 220,25,220,58 1100 linef 220,58,100,58: linef 100,58,100,25: fill 0,0 1110 gotoxy 13,3: ? "ST Othello" 1120 gotoxy 17,4: ? "by" 1130 gotoxy 14,5: ? "Paul Lay" 1140 color 4: gotoxy 10,10: ? " Player Starts " 1150 gotoxy 10,12: ? " Computer Starts " 1160 gosub mouseselect 1170 if mx%<90 or mx%>225 then 1200 1180 if my%>112 and my%<121 then start%=white%: goto 1210 1190 if my%>132 and my%<139 then start%=black%: goto 1210 1200 gosub buzz: goto 1160 1210 gosub bleep: return 1220 rem --- good bleep --- 1230 bleep: 1240 sound 1,12,7,5,8: sound 1,0,0,0,0: return 1250 rem --- bad buzz --- 1260 buzz: 1270 sound 1,12,7,1,8: sound 1,0,0,0,0: return 1280 rem --- wait for mouse select --- 1290 mouseselect: 1300 gemsys(79) 1310 if peek(gintout+6)=0 then 1300 1320 mx%=peek(gintout+2): my%=peek(gintout+4): return 1330 rem --- gem interface --- 1340 gemint: 1350 address#=gb: control=peek(address#): global=peek(address#+4) 1360 gintin=peek(address#+8): gintout=peek(address#+12) 1370 addrin=peek(address#+16): addrout=peek(address#+20): return 1380 rem --- initialise --- 1390 init: 1400 dim board%(8,8): empty%=0: white%=1: black%=2 1410 for cr%=0 to 8: read r%,g%,b% 1420 poke contrl,14: poke contrl+2,0: poke contrl+6,4 1430 poke intin,cr%: poke intin+2,143*r% 1440 poke intin+4,143*g%: poke intin+6,143*b% 1450 vdisys(1): next cr%: return 1460 data 7,7,7,0,0,0,7,0,0,0,7,0,0,0,7 1470 data 7,0,7,4,4,4,5,5,0,0,5,5 . id.. iDEMO1 C ieDEMO1 PRGii TLISTING1C iLISTING2C iDEMO PRG4iHDEMO4 C 8i&LISTING C IiLISTING PRGMi<. /* GEM demonstrations from the 'C' programming lanuage */ /* Written using the Metacomco Lattice C compiler */ /* By Steve Pedler for Page 6 Magazine, England */ /* Version 0.2 March 13 1987 */ /* Lattice include files */ #include "stdio.h" #include "osbind.h" /* ----------------- declarations, constants -------------------------*/ #define WORD short int #define SOLID 1 char resalert[]="[3][ Use only low resolution | when running this program ][ OK ]", hello_box[]="[1][ Demonstrations of GEM in 'C' | by Steve Pedler | for Page 6 Magazine 1987 ][ OK ]"; WORD contrl[ 12 ], intin[ 256 ], ptsin[ 256 ], intout[ 256 ], ptsout[ 256], work_handle, dum, temp_col, old_pal[ 16 ], new_pal[ 16 ], button, col_index[]={ 0, 2, 3, 6, 4, 7, 5, 8, 9, 10, 11, 14, 12, 15, 13, 1 }, demo1(); int finished; /* ------------------- program starts here ---------------------------*/ main() { WORD c; init_gem(); while( finished !=0 ){ c=demo1(); if( c==3 ) { finished=0; break; } } finish_gem(); } /* ------------------- initialisation ---------------------------------*/ init_gem() { int i; WORD resol; finished=1; appl_init(); /* initialise GEM */ work_handle=graf_handle( &dum, &dum, &dum, &dum ); /* get the device handle */ for( i=1; i<10; ++i ) intin[ i ]=1; intin[ 10 ]=2; v_opnvwk( intin, &work_handle, intout ); /* open workstation */ for( i=0; i<16; old_pal[ i ]=Setcolor( i++, -1 )); for( i=0; i<16; ++i ) new_pal[ i ]=old_pal[ i ]; resol=Getrez(); if( resol>0 ){ form_alert( 1, resalert ); finished=0; } else { form_alert( 1, hello_box ); } } /* --------------- demonstration #1 -----------------------------------*/ /* draw a circle in quadrants and animate by colour rotation */ WORD demo1() { int delay, count, step, i; WORD starta, stopa, a, c; Setpallete( new_pal ); v_hide_c( work_handle ); v_clrwk( work_handle ); vsf_interior( work_handle, SOLID ); starta=0; stopa=200; for( i=0; i<3; ++i ){ for( a=1; a<7; a++ ){ vsf_color( work_handle, col_index[ a ] ); v_pieslice( work_handle, 160, 100, 80, starta, stopa ); starta=starta+200; stopa=stopa+200; } } vst_height( work_handle, 6, &dum, &dum, &dum, &dum ); v_gtext( work_handle, 8, 185, "Demo 1 - Spinning disc" ); c=0; count=5000; step=100; while( c<2 ){ temp_col=new_pal[ 6 ]; for( a=5; a>0; a-- ){ new_pal[ a+1 ]=new_pal[ a ]; } new_pal[ 1 ]=temp_col; Setpallete( new_pal ); for( delay=1; delay30000 || count<300 ){ step=step * -1; count=count+step; } } if( button>1 ) c=button; } return( c ); } /* -------------- exit the GEM application ----------------------------*/ finish_gem() { WORD reset; reset=0; v_show_c( work_handle, reset); Setpallete( old_pal ); v_clsvwk( work_handle ); appl_exit(); } `Q&o#A.AB(HSB$H  g  g  f RSBj` g =g %gJ`Rpr A9nA0m/ПЁRSBk`Jg n <#E~`zRpr A9nA0m/ПЁRSBkT`JgN n <#DR`8C@`C@rRSBk$  g  g  gQp`JBkQB"+ҫ E~$9DRf $`nԀ n$<&ւֹE~// Bg?<JNAJg0<`6 .AE~#A#A#A"N8/ K,MNp??<LNA` /`NVa$JMgaF=@W@fBMNqalN^NuNVp#MN1AM////N7zO3Mp-@ . l @E0R`3EHyIHyMHyEN%O B l6 . @M .Rr//r//H N#O o0`B . l @M"@M0R`p/N#X=@J@oHyA2p/N4@PBM`HyAsp/N4@PN^NuNVHyMp/N#P09MH/N0X09MH/N%X09MHr//N/PBn=|B l=|0. @lh29MHH @A0H//N/vP09MH2.H4.H//vP/vd//</N(OnnRn`R`v09MHAM////r//N-bO09MHHyA/<r//N&OBn-|pd-@ nl3MM=|Jno,0.H/@R @M /"@M0Sn`3MMHyMp/N#Pp-@ .lR`AM/HyM//N8O09M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nu .N^NuB.p-@-@-@ .l n R@ f . g | S nPJ .R.-@A m/HyPJ n/(NzO -@갮gpN^NuJA*gpN^NuB`hJg:/.HyPJ n/(NzO -@갮gpN^NuJA*gpN^Nu .N^Nu .N^Nup#DVpN^NuNV/.a X-@JfpN^Nu n(JgpN^Nu/./. n/(NO -@JA*gp#DVpN^Nu f`JgZ nfN .S-@Jk4B/./.afO Jgp/Hn/.a\O JfS` .RN^Nu .N^NuNV/.aLX-@JfpN^NuB n/(NXJA*gp-@ nB .N^NuNV/.NXJA*gpN^NupN^NuNV/.aXN^NuNV/. /.NPN^NuNV .A"opN^Nu yA .ѹAA" N^NuNV/.aX-@JgN^Nu | N^NuNV 9AAѹA"#AA#Df#D^#Dj#Db N^NuNVa-@JfpN^Nu /./9C6azP n-@Jfp-@ . dN```4`L`XJ fDA"n"`(  f*A"n"`  fA"n"`A:"n"`  fA"n"`A"n"`  f. .r/@B///r/r/N#O #A*/.aXJA*WDHHLN^NuNV .r/@///r/rA/N#O#A*JWDHH N^NuNVJfB/./. /.aON^Nu"n QB/./. / NON^NuNVJfp//./. /.a`ON^Nu"n Qp//./. / NON^NuNVH Jf pLN^NuAJ$n"Rg pLN^Nup". /. n/(/. /p/pB/N#OLN^NuNVJgp@`p?r$.". v/A////./ n/(v//-@N#O-@Jj #A*pN^Nu .N^NuNVBp/N#P n pN^NuNVB .l& n HH/r/r/N#O R` .N^NuNVB .l& n HH/r/r/N#O R` .N^NuNVv . lS`p}@A r//r/r /N#Op /p/p/N#O .HHr-Ax-@| .|T".xl>6@w f| w .wf .xUDN^Nu .xU n wRx` .| }l n  .|RN^NuNVB .lP n @HH fp /p/p/N#O .HH/r/r/N#O R` .N^NuNVJg .`pN^NuNVB . l" @PJf @P N^NuR`pN^NuNV nBN^NuNV. am zn aAN^Nu. N^NuNV. HH/aX.HH/@aX/fp`pN^NuNVp-@p-@p-@-@ n JgR`B . nJg n@JgR =g ,f .S".f .N^Nu .R.HH n HH//-@a2PJfB. ,g =f p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22"o240(0HNuA81o">1o<1o:1o81o61o41o 21o01|1|Bh1|GN8`A8"o$22"o(240(0HNuA81o:1o81o61o41o 21o01|1|Bh1|HN8`A80(0HNuA81o">1o<1o:1o81o61o41o 21o01|1|Bh1|IN8`A80(0HNuA81o">1o<1o:1o81o61o41o 21o01|1|Bh1|JN8`A80(0HNuA81o61o41o 2!o01|1|1|1|KN8`A80(0HNuA81o41o21o 0!o01|1|1|1|LN8`A80(0HNuA8Bh1|Bh1|MN8`A8"o22"o24"o 26"o280(0HNuA8!o01o01|1|1|1|NN8`A80(0HNuA8Bh1|Bh1|ON8`A8"o22"o24"o 26"o280(0HNu"0<sNBNu"0<NBNu1.0188:<>8@8<:>[1][ Use only low resolution | when running this program ][ OK ][1][ Demonstrations of GEM in 'C' | by Steve Pedler | for Page 6 Magazine 1987 ][ OK ]   Demo 1 - Spinning discrwaaCan't open stdin file Can't open stdout file con:CON:prn:PRN:lst:LST:lpt:LPT:lpt1:LPT1:aux:AUX:com:COM:com1:COM1:rdr:RDR:pun:PUN:nul:NUL:null:NULL:CON:AXI:,AXO:,LST:,NIL:,CON:=*C ((((( H ((((( H B H*"  &     2($ &"  .$   .  "  (    P:$  :":V:l&$@j$&:P(J.z    ,$ , Xd`$  J $2 40 & 0  F H 4 T<@HF >@@@*<  "" *""J "F0 "(V V @ H H : ((h "< "" &"( """&*".""""(""""&" "  "   00 0**T*"".4L@LL66.*F/* ------------ LISTING 1 ----------------------------------------------*/ /* GEM demonstrations from the 'C' programming lanuage */ /* Written using the Metacomco Lattice C compiler version 3.04 */ /* For Page 6 Magazine, England */ /* This listing details the lines to be added to the first version ( 0.2 ) of this program, published in issue 28 of Page 6 Magazine */ /* ---------- new defines --------------------------------------------- */ #define CENTRED 1 #define SPACE 0x3920 /* ---------- new declarations ---------------------------------------- */ WORD demo2(), demo3(); /* NOTE: if you are using Lattice C version 3.04, you should: 1) delete the definitions of the global VDI arrays contrl[], intin[], intout[], ptsin[] and ptsout[] 2) add two definitions - WORD work_in[ 11 ], work_out[ 57 ]; 3) replace all references to intin[] and intout[] in the function init_gem() with work_in[] and work_out[] respectively */ /* ---------- new main() function ------------------------------------- */ main() { WORD c; init_gem(); while( finished !=0 ){ c=demo1(); if( c==3 ) { finished=0; break; } c=demo2(); /* ---- new lines ----*/ if( c==3 ) { finished=0; break; } c=demo3(); if( c==SPACE ) { finished=0; break; } } finish_gem(); } /* ------------ new finish_gem() function ----------------------------- */ finish_gem() { WORD reset; reset=0; v_clrwk( work_handle ); /* ---- new line ---- */ Setpallete( old_pal ); v_show_c( work_handle, reset); v_clsvwk( work_handle ); appl_exit(); } /* GEM demonstrations from C */ /* Current version: 0.2, 11/7/87 */ /* ------------------- LISTING 2 --------------------------------------- */ /* This listing contains the two new demos to be added to version 0.2 of the program once the changes contained in Listing 1 have been made. */ /* ------------------- demonstration #2 -------------------------------- */ /* create illusion of movement by drawing and redrawing circles */ WORD demo2() { int i; WORD c, x_incr, y_incr, last_x_incr, last_y_incr, centre_x, centre_y, last_x, last_y, color, radius; color=1; new_pal[ 0 ]=0; /* black background */ new_pal[ 15 ]=0x777; Setpallete( new_pal ); v_clrwk( work_handle ); vst_color( work_handle, 1 ); v_gtext( work_handle, 8, 196, "Demo 2 - Moving circles" ); vsf_color( work_handle, color ); vsf_interior( work_handle, 0 ); /* no fill */ vsf_perimeter( work_handle, 1 ); /* visible border */ x_incr=last_x_incr=7; y_incr=last_y_incr=5; radius=10; last_x=153; last_y=95; for( i=0, centre_x=160, centre_y=100; i<10; ++i, centre_x+=x_incr, centre_y+=y_incr ) { v_circle( work_handle, centre_x, centre_y, radius ); } button=0; while( button==0 ){ if( centre_x<14 || centre_x>306 ) { x_incr*=-1; color+=1; if( color>15 ) color=1; } if( centre_y<14 || centre_y>179 ) { y_incr*=-1; color+=1; if( color>15 ) color=1; } vsf_color( work_handle, color ); v_circle( work_handle, centre_x, centre_y, radius ); centre_x+=x_incr; centre_y+=y_incr; if( last_x<14 || last_x>306 ) last_x_incr*=-1; if( last_y<14 || last_y>179 ) last_y_incr*=-1; last_x+=last_x_incr; last_y+=last_y_incr; vsf_color(work_handle, 0 ); /* background colour */ v_circle( work_handle, last_x, last_y, radius ); vq_mouse( work_handle, &button, &dum, &dum ); } c=button; while( button!=0 ){ vq_mouse( work_handle, &button, &dum, &dum ); } return( c ); } /* -------------------- demonstration #3 --------------------------------*/ /* printing text on the screen */ WORD demo3() { WORD c, pxyarray[ 4 ]; char str[ 3 ]; str[ 0 ]=0x0e; /* the two haves of the Atari logo */ str[ 1 ]=0x0f; str[ 2 ]=0x00; /* null terminator */ v_clrwk( work_handle ); vst_color( work_handle, 1 ); v_gtext( work_handle, 8, 185, "Demo 3 - Text output" ); vst_height( work_handle, 50, &dum, &dum, &dum, &dum ); vst_color( work_handle, 2 ); v_gtext( work_handle, 25, 150, "ATARI ST" ); v_gtext( work_handle, 170, 150, str ); vst_effects( work_handle, 12 ); /* 12 = italic & underline */ vst_height( work_handle, 8, &dum, &dum, &dum, &dum ); v_gtext( work_handle, 25, 170, "Page 6 Magazine - England" ); vst_color( work_handle, 3 ); vst_effects( work_handle, 32 ); /* 32=shadowed text */ vst_height( work_handle, 13, &dum, &dum, &dum, &dum ); vst_alignment( work_handle, CENTRED, 0, &dum, &dum ); v_justified( work_handle, 165, 25, "stretched text", 280, 1, 1 ); vst_alignment( work_handle, 0, 0, &dum, &dum ); vst_effects( work_handle, 0 ); /* 0=standard text */ vst_color( work_handle, 4 ); vst_height( work_handle, 4, &dum, &dum, &dum, &dum ); v_gtext( work_handle, 50, 102, "very small text indeed!!" ); vst_height( work_handle, 8, &dum, &dum, &dum, &dum ); vst_color( work_handle, 5 ); v_gtext( work_handle, 100, 120, "normal.." ); vst_effects( work_handle, 2 ); /* 2=light text */ v_gtext( work_handle, 25, 120, "Light.." ); vst_effects( work_handle, 1 ); /* 1=bold text */ v_gtext( work_handle, 185, 120, "and bold." ); vst_rotation( work_handle, 2700 ); /* baseline rotation 2700 degrees */ vst_height( work_handle, 8, &dum, &dum, &dum, &dum ); vst_color( work_handle, 6 ); vst_effects( work_handle, 16 ); /* 16=outlined text */ v_gtext( work_handle, 5, 5, "OUTLINED TEXT" ); vsl_color( work_handle, 7 ); vst_color( work_handle, 7 ); vst_rotation( work_handle, 0 ); /* normal baseline */ vst_effects( work_handle, 0 ); vst_height( work_handle, 7, &dum, &dum, &dum, &dum ); vsl_width( work_handle, 1 ); pxyarray[ 0 ]=25; pxyarray[ 1 ]=40; pxyarray[ 2 ]=305; pxyarray[ 3 ]=80; v_rbox( work_handle, pxyarray ); v_gtext( work_handle, 30, 55, "Press any key to continue..." ); v_gtext( work_handle, 30, 75, "or space bar to exit program" ); vst_color( work_handle, 1 ); /* these 3 lines reset values */ new_pal[ 0 ]=0x777; /* needed by demo1() */ new_pal[ 15 ]=0; return( c=evnt_keybd() ); } `F"o#A*i,EB&J(JSB  g  g  f RSBj` gn =fa6 n <#0` %fa n <#/`Rpr A9nA0m/ПЁRSBkB`Jg:NuAA`AAhrRSBk$  gJ  gB  g:Qp`JBkQB$)ԩ 0Đ&9/f &`nր n&< Ѓй0// Bg?<JNAJfV.B#A0#A#A#A#AN->/ / Kh,MNfpJAg / yANXO??<LNA` /`NVabJFlgRa=@W@fBFl`>a =@W@fBFl`*a=@ @9 fBFl`a =@W@fBFlNqajN^NuNVp#FlN5AF&////N3O3F$p-@ . l @E0R`3EHyEHyF$HyEN1O B l6 . @F* .Rr//r//H N1(O o0`B . l @FJ"@F*0R`p/N1(X=@J@oHyAp/N5PBFl`HyBp/N5PN^NuNVHyFJp/N1(P09F$H/N4X09F$H/N2\X09F$Hr//N7PBn=|B l=|0. @lh29F$HH @Bh0H//N7P09F$H2.H4.H//vP/vd//</N8OnnRn`R`v09F$HAF&////r//N6xO09F$HHyB/<r//N88OBn-|pd-@ nl3FVF(=|Jno,0.H/@R @FJ /"@FJ0Sn`3F(FLHyFJp/N1(Pp-@ .lR`AF&/HyFj//N4O09FjS@f0 .Ѯ . u0n ,l .rN/Ѯ-@09Fj @o =@`0.N^NuNVBn09F$H/N2\XHyF*p/N1(P09F$H2.H//N4lP09F$H/N1XN5N^NuNV=|ByFJ3wFhHyFJp/N1(P09F$H/N2\X09F$Hr//N7P09F$HHyB/<r//N88O09F$H2.H//N7P09F$HB/N7P09F$Hr//N8Ppr=| =|=|_B=|=|d=@=@=A=A lB09F$H2.H4.H6.H////N2OR0.n0.n`ByFj09FjJ@f|0.H m 2o0.Rn=@ no=|0.H m o0.Rn=@ no=|09F$H2.H//N7P09F$H2.H4.H6.H////N2O0.n0.n0.H m 2o 0.=@0.H m o 0.=@0.n0.n09F$HB/N7P09F$H2.H4.H6.H////N2O09F$HAF&//HyFj/N4O`|=yFj09FjJ@g&09F$HAF&//HyFj/N4O`0.N^NuNV||B.09F$H/N2\X09F$Hr//N7P09F$HHyB/<r//N88O09F$HAF&////r2//N6xO09F$Hr//N7P09F$HHyB/<r//N88O09F$HHn/</</N88O09F$Hr //N70P09F$HAF&////r//N6xO09F$HHyB/<r//N88O09F$Hr//N7P09F$Hr //N70P09F$HAF&////r //N6xO09F$HAF&//Br//N7`O09F$Hr///<HyBr//</N3XO09F$HAF&//r///N7`O09F$HB/N70P09F$Hr//N7P09F$HAF&////r//N6xO09F$HHyBrf/r2//N88O09F$HAF&////r//N6xO09F$Hr//N7P09F$HHyCrx/rd//N88O09F$Hr//N70P09F$HHyC rx/r//N88O09F$Hr//N70P09F$HHyC(rx//</N88O09F$H/< /N6P09F$HAF&////r//N6xO09F$Hr//N7P09F$Hr//N70P09F$HHyC2r///N88O09F$Hr//N6HP09F$Hr//N7P09F$HB/N6P09F$HB/N70P09F$HAF&////r//N6xO09F$Hr//N6P=|=|(=|1=|P09F$HHn/N3P09F$HHyC@r7/r//N88O09F$HHyC]rK/r//N88O09F$Hr//N7P3wFJByFhN5N^NuNVH=|Bn=|p-@p2-@-|-|1HyF*p/N1(P09F$H/N2\X09F$HAF&////r//N6xO09F$Hr//N7P09F$HHyCz/<r//N88O09F$H2.H//N6HPp=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~чEH@EDH@NuH@HDz lH@HA0BAE mBD lPDH@J@fXD|C61FH@,龳F@LDH@HDNu mJElP` ElDDEME E9oN2B@H@HAEnE$ꩱtӂтH@@H@Nu$艱tӂтH@E @eNڹ@H@NuH<xr`H<xrJg8j8<D d:`fBHyAp=/N0O -@`BHyApfp//.BpB/N0O/.p/pF/N0O /. N#X/9AHy/9NO BNBXN^NuCPROGCan't open stdin file Can't open stdout file dNVp nR-@Jg/. /NPRfpN^NupN^NuNV n (g f//.NPN^Nu n (S!@Jk"PR .r` ./. /NP" N^Nu/NVB . lTrN/ @*^-H(f2 n(g& n  -@Jg//( /(N.O R`B .0l( @0Jg @0/(N-XR`/.N,XN^NudNV-n n (0JgpN^Nu n (VDHHAJf(fp!@ fN^Nu/. N#jXJg n pN^Nu n J.g (D!@` n !h n (S!@Jk"PR .r` ./. /a$P" N^Nu n (gx fpN^Nu .@J.g. f&p/Hy#^ n /(-@N&O -@`"p/Hn n /(-@N&O -@p-@`2 n (gpN^Nu n J.g^ gT (T!@ f""PR Jk /p/a>P n R"n QR .JjN^Nup-@ n  -@Jg(gpp/B/(N/*O -@J.gR .S-@JkDB/ n /(N/*O p/Hn n /(N-O JAf . gNq/. n /( /(N&O -@`B f n ` .g n J.g n (D!@` n !h"n i " . g2")S#AJk QRr` ./. /aP" n (0JgpN^Nu fpN^Nu .N^Nu dNV nJg(fpN^Nu/9CN$X n !@ Jfp #EpN^Nu n!yCp!@!@N^NuNV-np-@ nJg/N/XRѮR` opN^Nu ./-@N$X-@JfpN^Nu n#AB-H nJg "n"/N/XRѮRX` nBJFg yF/9F/N%P#F#AF .N^Nu=NV/.aXN^NuNVH..Jn pL8N^Nu l~ V.I/*TgZ -eLf(/ M L8N^Nu - e$" M$&B&'@(/ M L8N^Nu(M*U`/N,X*@g"J/f#/߹/ M L8N^NupL8N^NudLNV . //.-@aPN^NuNVH<.. Jn pL/N0P#AJjp #EpN^NupN^Nud?NVx . gJfp /N0X g . ~nS`p}@|Hn|p /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uA91o D1o8Bh.1|21|,N80(DHNuA91o D1o8Bh.1|21|,N80(DHNuA91o D1o8Bh.1|21|h,N80(DHNuA91oF1o D1o8r"oRJf1A2p"o/ ED4Q$_1|.1|,N8HNuA91oF1oD1oP1oF1o D1o81|.1|21|6BhHBhJBhLBhNBhR1| ,N8HNu"0<sNBNu"0<NBNu9,9D;D=D?D9,AD9D=D;D?DV1.04[1][ Use only low resolution | when running this program ][ OK ][1][ Demonstrations of GEM in 'C' | by Steve Pedler | for Page 6 Magazine 1987 ][ OK ]   Demo 1 - Spinning discDemo 2 - Moving circlesDemo 3 - Text outputATARI STPage 6 Magazine - Englandstretched textvery small text indeed!!normal..Light..and bold.OUTLINED TEXTPress any key to continue...or space bar to exit programDemo 4 - Globes ((((( H ((((( H  X 8 H*    &     2($ &"  ,&       H" t"n "    (                          >     >$ 64 :(    * L  " H  &, n &V*^tVN@,b"&& .        8>*: ~$. $:0  P4Xf,"20&"NR  B4 :0` 0 .  0@B *< @  H : (h 00"  $**&"&,"""("""J V/* Part 3 of demonstrations of the use of GEM from 'C' */ /* By Steve Pedler for Page 6 Magazine, England */ /* The following lines should be added to the source code published in the previous issues of Page 6 */ /* new global declarations */ WORD calc_num(), demo4(); /* new main() function - substitute this function for that found in the previous version, so that the fourth demo can be called */ main() { WORD c; init_gem(); while( finished !=0 ){ c=demo1(); if( c==3 ) { finished=0; break; } c=demo2(); if( c==3 ) { finished=0; break; } c=demo3(); if( c==SPACE ) { finished=0; break; } c=demo4(); /* new lines */ if( c==3 ) { finished=0; break; } } finish_gem(); } /* ----------------- demonstration #4 - draw a series of globes -------- */ WORD demo4() { WORD centre_x, centre_y, perm_radius, temp_radius, color, starta, stopa, clip[ 4 ], c; int max_color, max_rad, high_x, high_y; starta=0; stopa=3600; color=2; /* These 5 parameters may be changed for */ max_color=7; /* different effects */ max_rad=50; high_y=180; high_x=305; Setpallete( old_pal ); v_clrwk( work_handle ); vst_height( work_handle, 6, &dum, &dum, &dum, &dum ); vst_color( work_handle, 1 ); v_gtext( work_handle, 8, 198, "Demo 4 - Globes" ); vsl_color( work_handle, color ); clip[ 0 ]=1; clip[ 1 ]=1; clip[ 2 ]=318; clip[ 3 ]=190; /* set up a graphics clipping */ vs_clip( work_handle, 1, clip ); /* rectangle */ button=0; while( button==0 ) { perm_radius=calc_num( 10, max_rad ); /* calculate the */ centre_x=calc_num( 12, high_x ); /* 3 parameters needed */ centre_y=calc_num( 12, high_y ); /* for each globe */ vsf_color( work_handle, 0 ); v_ellipse( work_handle, centre_x, centre_y, perm_radius, perm_radius ); vsl_color( work_handle, color ); temp_radius=perm_radius-5; v_ellarc( work_handle, centre_x, centre_y, perm_radius, perm_radius, starta, stopa ); while( temp_radius>0 ){ v_ellarc( work_handle, centre_x, centre_y, perm_radius, temp_radius, starta, stopa ); v_ellarc( work_handle, centre_x, centre_y, temp_radius, perm_radius, starta, stopa ); temp_radius-=5; /* note: this is 'temp_radius=temp_radius-5' */ } color+=1; if( color>max_color ) color=2; vq_mouse( work_handle, &button, &dum, &dum ); } c=button; while( button !=0 ) { vq_mouse( work_handle, &button, &dum, &dum ); } vs_clip( work_handle, 0, clip ); /* disable clipping rectangle */ return (c); } /* calculate the centres and radius */ WORD calc_num( small, large ) int small, large; { double val_max, val_temp, ret_num; int random; val_max=2147483647.0; /* ******** NOTE: if your compiler uses 16-bit ints rather than the 32 bits used by Lattice C, the 'magic number' val_max should be changed to 32767.0 - this is very important! ********* */ random=rand(); /* C library function for random numbers */ val_temp=random/val_max; ret_num=( val_temp*large )+small; return (WORD)ret_num; } /* AES object demonstration, for Page 6 magazine, England */ /* Version 0.1, 1/1/88 */ /* By Steve Pedler */ /* include files - note these may have different names on your system, e.g. gemlib.h may be named gemdefs.h */ #include "gemlib.h" /* defines */ #define WORD short int #define SURNAME 2 #define FORENAME 3 #define AGE 4 #define MALE 6 #define FEMALE 7 #define AGAIN 9 #define QUIT 10 #define CREDIT 11 #define TITLE 12 #define NOT_STATED -1 #define TRUE 1 #define FALSE 0 #define ROOT 0 #define MAX_DEPTH 20 /* definitions for the object tree */ /* first the strings */ /* templates */ char sur_templt[]="Surname:_________________________"; /* 25 underscores */ char fore_templt[]="Forename(s):_____________________"; /* 21 underscores */ char age_templt[]="Age:___"; /* 3 underscores */ /* validation strings */ char sur_valid[]="AAAAAAAAAAAAAAAAAAAAAAAAA"; /* 25 letter A */ char fore_valid[]="aaaaaaaaaaaaaaaaaaaaa"; /* 21 letter a */ char age_valid[]="999"; /* other strings */ char credit[]="Page 6 Magazine, England"; char title[]="Sample dialog box"; char again[]="AGAIN"; char quit[]="QUIT"; char male_str[]="Male"; char female_str[]="Female"; /* tedinfo structure initialisation */ TEDINFO tedinf1={ 0L, 0L, 0L, 3, 0, 0, 0x1380, 0, 0, 26, 34 }; TEDINFO tedinf2={ 0L, 0L, 0L, 3, 0, 0, 0x1380, 0, 0, 22, 34 }; TEDINFO tedinf3={ 0L, 0L, 0L, 3, 0, 0, 0x1380, 0, 0, 4, 8 }; TEDINFO tedinf4={ 0L, 0L, 0L, 5, 0, 0, 0x1280, 0, 0, 25, 1 }; TEDINFO tedinf5={ 0L, 0L, 0L, 3, 0, 0, 0x1280, 0, 0, 18, 1 }; /* then the definitions for 13 objects */ OBJECT dial_tree[]={ -1, 1, 12, G_BOX, NONE, SHADOWED, 0x21193L, 2, 1, 46, 17, /* object 0 (root object) */ 8, 2, 5, G_BOX, NONE, OUTLINED, 0x21142L, 4, 3, 39, 9, /* object 1 */ 3, -1, -1, G_FTEXT, EDITABLE, NORMAL, 0L, 1, 1, 33, 1, /* object 2 */ 4, -1, -1, G_FTEXT, EDITABLE, NORMAL, 0L, 1, 3, 33, 1, /* object 3 */ 5, -1, -1, G_FTEXT, EDITABLE, NORMAL, 0L, 1, 5, 7, 1, /* object 4 */ 1, 6, 7, G_IBOX, NONE, NORMAL, 0x1100L, 1, 6, 37, 2, /* object 5 */ 7, -1, -1, G_BUTTON, SELECTABLE|RBUTTON, SHADOWED, 0L, 8, 1, 8, 1, /* object 6 */ 5, -1, -1, G_BUTTON, SELECTABLE|RBUTTON, SHADOWED, 0L, 21, 1, 8, 1, /* object 7 */ 11, 9, 10, G_IBOX, NONE, NORMAL, 0x1100L, 8, 12, 27, 3, /* object 8 */ 10, -1, -1, G_BUTTON, SELECTABLE|DEFAULT|EXIT, NORMAL, 0L, 5, 1, 8, 1, /* object 9 */ 8, -1, -1, G_BUTTON, SELECTABLE|EXIT, NORMAL, 0L, 18, 1, 8, 1, /* object 10 */ 12, -1, -1, G_TEXT, NONE, NORMAL, 0L, 3, 15, 18, 1, /* object 11 */ 0, -1, -1, G_TEXT, LASTOB, NORMAL, 0L, 14, 1, 17, 1 /* object 12 (last object) */ }; /* global variables */ WORD gl_charh, gl_charw, work_handle; char surname[50], forename[50], age[20]; /* program start */ main() { start(); interact(); end(); } /* initialise */ start() { int i; WORD dum, work_in[11], work_out[57], desk_handle; appl_init(); desk_handle=graf_handle(&gl_charw, &gl_charh, &dum, &dum); work_handle=desk_handle; for(i=0; i<10; i++) work_in[i]=0; work_in[10]=2; v_opnvwk(work_in, &work_handle, work_out); graf_mouse(ARROW, 0x0L); /* point the objects requiring TEDINFO structures to the relevant structure */ dial_tree[SURNAME].ob_spec=(long)&tedinf1; dial_tree[FORENAME].ob_spec=(long)&tedinf2; dial_tree[AGE].ob_spec=(long)&tedinf3; dial_tree[CREDIT].ob_spec=(long)&tedinf4; dial_tree[TITLE].ob_spec=(long)&tedinf5; /* initialise the three editable tedinfos to point to our input arrays */ tedinf1.te_ptext=(long)surname; tedinf2.te_ptext=(long)forename; tedinf3.te_ptext=(long)age; /* plug in the other string addresses where needed */ tedinf1.te_ptmplt=(long)sur_templt; tedinf1.te_pvalid=(long)sur_valid; tedinf2.te_ptmplt=(long)fore_templt; tedinf2.te_pvalid=(long)fore_valid; tedinf3.te_ptmplt=(long)age_templt; tedinf3.te_pvalid=(long)age_valid; tedinf4.te_ptext=(long)credit; tedinf5.te_ptext=(long)title; dial_tree[MALE].ob_spec=(long)male_str; dial_tree[FEMALE].ob_spec=(long)female_str; dial_tree[AGAIN].ob_spec=(long)again; dial_tree[QUIT].ob_spec=(long)quit; /* convert the x/y coordinates of each object into pixels from character coords to work in all resolutions */ for(i=0; i<13; i++) { dial_tree[i].ob_x*=gl_charw; dial_tree[i].ob_y*=gl_charh; dial_tree[i].ob_width*=gl_charw; dial_tree[i].ob_height*=gl_charh; } } /* interact with and maintain the dialog */ interact() { WORD button, cx, cy, cw, ch, bx, by, bw, bh; int male; form_center(dial_tree, &cx, &cy, &cw, &ch); /* centre the dialog box */ bx=cx+cw/2; /* find the points of origin for the grow/shrink box effect */ by=cy+ch/2; bw=0; bh=0; form_dial(FMD_START, 0, 0, 0, 0, cx, cy, cw, ch); /* reserve screen memory for the box */ form_dial(FMD_GROW, bx, by, bw, bh, cx, cy, cw, ch); /* optional grow box */ do { clear_strings(); objc_draw(dial_tree, ROOT, MAX_DEPTH, cx, cy, cw, ch); /* draw the dialog */ button=form_do(dial_tree, SURNAME); /* interact with it under AES control */ dial_tree[button].ob_state=NORMAL; /* reset the exit button */ if(dial_tree[MALE].ob_state & SELECTED) { male=TRUE; } else if(dial_tree[FEMALE].ob_state & SELECTED) { male=FALSE; } else male=NOT_STATED; } while(button==AGAIN); form_dial(FMD_SHRINK, bx, by, bw, bh, cx, cy, cw, ch); /* optional shrink box */ form_dial(FMD_FINISH, 0, 0, 0, 0, cx, cy, cw, ch); /* release the screen memory */ } /* clear the input strings so editable fields are empty when box drawn */ clear_strings() { surname[0]='\0'; forename[0]='\0'; age[0]='\0'; } /* clean up and exit */ end() { v_clsvwk(work_handle); appl_exit(); } /* end of program */ `,"o#(*i,EB&J(JSB  g  g  f RSBj` gn =fa6 n <#` %fa n <#"`Rpr A9nA0m/ПЁRSBkB`Jg:NuA'`A'rRSBk$  gJ  gB  g:Qp`JBkQB$)ԩ &9"f &`nր n&< Ѓй// Bg?<JNAJfV.B#'#'#'#'#(N/ / K,MNpJ(g / y(NXO??<LNA` /`a aa,NuNVPNA//Hy,^Hy,`NO3,bB=@p . l BvR`=|HnrHy,bHnNZO p//N:P#()#()#))#)0*|#)L*#,d(#,(#,)#((#(f(#(<(#()#(^)#()#()0#()L#(*#(*#(*L#(*dB . lrN @/H)h2(H49,`H /HN o1@ o)h0(H29,^H/HN o1@ o)h0(H/A"/HN o1@ o)h0(H"//HN o1@R`>N^NuNVHHnHnHnHnHy)hN"O0.H/@rN.2.HЁ4.H=@ /ArN.2.HЁv//////$x/////=@=C=CNO$0.H2.H4.H6.H8.H:.H<.H>.H////////~/NO$a"0.H2.H4.H6.H////x/BHy)hNzOp/Hy)hNzP=@ @)hBh 09*gp-@`09*gB`p-@ n gl0.H2.H4.H6.H8.H:.H<.H>.H////////~/NO$0.H2.H4.H6.H////x////x/NO$LN^Nup,d,,Nu09,bH/NXNNuNV#vp# lp nR"@*gR` nJgX 9R @ p nJgR"@*fR` nrR@JftNqJ*gp` <r#-@#p#4 .#0#R .#Np#p .#lp# .#9'JgR/Hy'p=/NO -@Jj Hy:Hy|N :Pp/N X/.BpF/NO p9'Jg >fBHy'p=/NO -@`BHy'pfp//.BpB/NO/.p/pF/NO /. NrX/9( Hy/9NO BN XN^NuCPROGCan't open stdin file Can't open stdout file dNVp nR-@Jg/. /N pPRfpN^NupN^NuNV n (g f//.N PN^Nu n (S!@Jk"PR .r` ./. /N P" N^Nu/NVB . lTrN @-H(f2 n(g& n  -@Jg//( /(NvO R`B .Fl( @JJg @J/(N*XR`/.N^XN^NudNV-n n (0JgpN^Nu n (VDHHAJf(fp!@ fN^Nu/. N XJg n pN^Nu n J.g (D!@` n !h n (S!@Jk"PR .r` ./. /a$P" N^Nu n (gx fpN^Nu .@J.g. f&p/Hy n /(-@NvO -@`"p/Hn n /(-@NvO -@p-@`2 n (gpN^Nu n J.g^ gT (T!@ f""PR Jk /p/a>P n R"n QR .JjN^Nup-@ n  -@Jg(gpp/B/(NO -@J.gR .S-@JkDB/ n /(NO p/Hn n /(NzO J(f . gNq/. n /( /(Nv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0HNu"0<sNBNu"0<NBNuv!#%v'#!%V1.04Surname:_________________________Forename(s):_____________________Age:___AAAAAAAAAAAAAAAAAAAAAAAAAaaaaaaaaaaaaaaaaaaaaa999Page 6 Magazine, EnglandSample dialog boxAGAINQUITMaleFemale""  .B' !!%        ((((( H ((((( H X 8 H*  * 0   2 4N4 f8  .        8>*: ~$. $:0  P4Xf,"20&"NR  B4 :0` 0 . @*< 0**T"0H". Zi.. ZiLIS1_1 BASiLIS2_1 BASi LIS3_1 S i LIS4_1 S i LIS5_1 S i<LIS6_1 C iASSEMBLR ЉiBASIC iC i10 REM ******************************************************************* 20 REM * ST Secrets series * 30 REM * by * 40 REM * COLM COX * 50 REM * --------------------------------------------------------------- * 60 REM * SOUND - ARTICLE ONE - LISTING ONE * 70 REM * (ST BASIC) * 80 REM * PAGE 6 MAGAZINE - ENGLAND * 90 REM ******************************************************************* 100 REM 110 REM +--------------------------------+ 120 REM | FIRST SET PITCH ON CHANNEL 1 | 130 REM +--------------------------------+ 140 REGISTER=0:VALUE=100:GOSUB SET.SOUND 150 REGISTER=1:VALUE=2:GOSUB SET.SOUND 160 REM +-------------------------------+ 170 REM | NOW SET VOLUME ON CHANNEL 1 | 180 REM +-------------------------------+ 190 REGISTER=8:VALUE=15:GOSUB SET.SOUND 200 REM +--------------------------------+ 210 REM | NOW ENABLE TONE ON CHANNEL 1 | 220 REM +--------------------------------+ 230 REGISTER=7:VALUE=&HFE:GOSUB SET.SOUND 240 REM +------------------+ 250 REM | WAIT FOR A BIT | 260 REM +------------------+ 270 FOR DELAY=1 TO 2000:NEXT DELAY 280 REM +---------------------------------+ 290 REM | NOW DISABLE TONE ON CHANNEL 1 | 300 REM +---------------------------------+ 310 REGISTER=7:VALUE=&HFF:GOSUB SET.SOUND 320 END 330 REM 340 REM ****************************************************************** 350 REM ** G.P ROUTINE TO PUT "VALUE" IN PSG REGISTER NUMBER "REGISTER" ** 360 REM ****************************************************************** 370 SET.SOUND:DEF SEG=&HFF8800:POKE 0,REGISTER:POKE 2,VALUE 380 DEF SEG=0:RETURN 10 REM ******************************************************************** 20 REM * ST Secrets series * 30 REM * by * 40 REM * COLM COX * 50 REM * ---------------------------------------------------------------- * 60 REM * SOUND - ARTICLE ONE - LISTING TWO * 70 REM * (ST BASIC) * 80 REM * PAGE 6 MAGAZINE - ENGLAND * 90 REM ******************************************************************** 100 REM 110 REM +---------------------------------+ 120 REM | FIRST SET VOLUME OF CHANNEL 1 | 130 REM +---------------------------------+ 140 REGISTER=8:VALUE=15:GOSUB SET.SOUND 150 REM +----------------------------------+ 160 REM | NOW SET PITCH OF NOISE CHANNEL | 170 REM +----------------------------------+ 180 N.P=31:GOSUB NOISE.PITCH 181 REM +----------------------------------+ 182 REM | ENABLE NOISE ONLY ON CHANNEL 1 | 183 REM +----------------------------------+ 184 REGISTER=7:VALUE=&HF7:GOSUB SET.SOUND 190 REM +-------------------+ 200 REM | DELAY FOR A BIT | 210 REM +-------------------+ 220 FOR DELAY=1 TO 2000:NEXT DELAY 230 REM +-------------------------------+ 240 REM | THEN INCREASE PITCH RAPIDLY | 250 REM +-------------------------------+ 260 FOR N.P=31 TO 0 STEP -1 270 GOSUB NOISE.PITCH 280 REM +---------------+ 290 REM | SMALL DELAY | 300 REM +---------------+ 310 FOR DELAY=1 TO 20:NEXT DELAY 320 NEXT N.P 330 REM +-------------+ 340 REM | REPEAT IT | 350 REM +-------------+ 360 GOTO 260 29997 REM ****************************************************************** 29998 REM ** G.P ROUTINE TO CHANGE PITCH OF NOISE CHANNEL TO N.P ** 29999 REM ****************************************************************** 30000 NOISE.PITCH:REGISTER=6:VALUE=N.P:GOSUB SET.SOUND:RETURN 30010 REM 39997 REM ****************************************************************** 39998 REM ** G.P ROUTINE TO PUT "VALUE" IN PSG REGISTER NUMBER "REGISTER" ** 39999 REM ****************************************************************** 40000 SET.SOUND:DEF SEG=&HFF8800:POKE 0,REGISTER:POKE 2,VALUE 40010 DEF SEG=0:RETURN ;**************************************************************************** ;* ST Secrets series * ;* by * ;* COLM COX * ;* ------------------------------------------------------------------------ * ;* SOUND - ARTICLE ONE - LISTING THREE * ;* (ASSEMBLY LANGUAGE) * ;* PAGE 6 MAGAZINE - ENGLAND * ;**************************************************************************** giaccess_opcode = 28 dosound_opcode = 32 xbios_number = 14 ; ; This code has to allow for the fact that Haba "C" treats all arguments as ; long words. The code given here takes account of that fact. Also the fact ; that Haba "C" only allows the use of D0 , D1 , A0 and A1 is taken into ; account. If you have a "normal" C then use the assembly language listing ; given in Listing 4. This code may work on other nonstandard "C"'s - if ; Listing 4 doesn't work then try this - it may be the answer. Usage of either ; routine is exactly the same. ; .text ; Text segement - for linkers use. .global _giaccess ; giaccess is global so that it may _giaccess ; be linked in with other routines. move.l a2,save_a2 ; Save A2 move.l a6,save_a6 ; '' A6 move.l d2,save_d2 ; '' D2 move.l sp,save_stack ; '' SP addq.l #4,sp ; Skip return address on SP move.l (sp)+,d0 ; Pop data move.l (sp)+,d1 ; Pop register# move.l #second_stack,a6 ; Set up a psuedo stack - A6 is s.pointer. move.w d1,-(a6) ; Push on register first move.w d0,-(a6) ; and then the data. move.w #giaccess_opcode,-(a6) ; Then the xbios opcode for giaccess. move.l a6,sp ; Make real SP = psuedo stack pointer. trap #xbios_number ; Call xbios. move.l save_stack,sp ; Restore real SP. move.l save_a6,a6 ; Restore A6 move.l save_a2,a2 ; '' A2 move.l save_d2,d2 ; '' D2 rts .global _dosound ; dosound is global so that it may be _dosound: ; used from other "C" routines when linked. move.l a2,save_a2 ; Save A2 ) Used by XBIOS so we must move.l d2,save_d2 ; '' D2 ) protect these. move.l (sp)+,save_return ; Pop return address from stack. move.w #dosound_opcode,-(sp) ; Push on XBIOS opcode for dosound. trap #xbios_number ; Call XBIOS. addq.l #2,sp ; "Pop" XBIOS opcode for dosound. move.l save_return,-(sp) ; Push return address. move.l save_a2,a2 ; Restore A2 move.l save_d2,d2 ; and D2 rts .bss ; Variable segement - for linker's use save_return .space 4 save_stack .space 4 save_a6 .space 4 save_a2 .space 4 save_d2 .space 4 .space 256 second_stack .space 256 ; **************************************************************************** ; * ST Secrets series * ; * by * ; * COLM COX * ; * ------------------------------------------------------------------------ * ; * SOUND - ARTICLE ONE - LISTING FOUR * ; * (ASSEMBLY LANGUAGE) * ; * PAGE 6 MAGAZINE - ENGLAND * ; **************************************************************************** giaccess_opcode = 28 dosound_opcode = 32 xbios_number = 14 ; ; This code provides the interface for the majority of "C"'s advailable for the ; ST. This code will not work with "HABA C" - see Listing 3 for the required ; code. If you are unsure as to which code to try, try this first - it is most ; likely to work - if this code doesn't work and you are sure that Listing 6 is ; correct then try Listing 3. If this doesn't work and you are sure you've got ; no typo's - then I can be contacted at the address at the end of the article. ; But please include a S.A.E! ; .text ; Text segement - for linkers use .global _giaccess ; giaccess can be accessed from _giaccess: ; other modules in linkage. move.w #giaccess_opcode,d0 ; Opcode for giaccess in D0. jsr call_xbios ; Call xbios. rts ; Return to main. .global _dosound ; dosound is global so that it can _dosound: ; be accessed from other modules. move.w #dosound_opcode,d0 ; Opcode for dosound in D0 jsr call_xbios ; Call xbios. rts ; Return to mainline. call_xbios ; G.P XBIOS caller - args on stack. ; Function # in D0. move.l (sp)+,save_caller_return ; Save caller return address. move.l (sp)+,save_main_return ; Save mainline return address. move.w d0,-(sp) ; Push XBIOS function # trap #xbios_number ; Call XBIOS for real. addq.l #2,sp ; "Pop" function # move.l save_main_return,-(sp) ; Push mainline return address. move.l save_caller_return,-(sp) ; Push caller return address. rts ; And return to caller. .bss ; Variable segement - for linker. save_main_return .space 4 ; 1 long = 4 bytes. save_caller_return .space 4 ; 1 long = 4 bytes. ;**************************************************************************** ;* ST Secrets series * ;* by * ;* COLM COX * ;* ------------------------------------------------------------------------ * ;* SOUND - ARTICLE ONE - LISTING FIVE * ;* (ASSEMBLY LANGUAGE) * ;* PAGE 6 MAGAZINE - ENGLAND * ;**************************************************************************** ; ; Sound demo, using XBIOS routines: GIACCESS and DOSOUND ; using GEMDOS routine: RAWCONIO ; ;**************************************************************************** ; EQUATES ;**************************************************************************** XBIOS = 14 ; Trap number for XBIOS calls GEMDOS = 1 ; Trap number for GEMDOS calls RAWCONIO_OPCODE = 6 ; GEMDOS opcode of RAWCONIO call GIACCESS_OPCODE = 28 ; XBIOS opcode of GIACCESS call DOSOUND_OPCODE = 32 ; XBIOS opcode of DOSOUND call KEY_PRESSED = $FF ; Sub opcode of RAWCONIO, meaning scan keyboard ;**************************************************************************** ; MAIN CODE ;**************************************************************************** .TEXT ; For linkers use - Program seg. MOVE.L #SET_UP,A0 ; Set up sound channel 1 for tone only JSR DOSOUND PITCH_UP MOVE.W #$FFF,PITCH ; Initalise pitch variable JSR SET_PITCH ; Store PITCH in hardware reg's UP_ONE JSR DELAY MOVE.W PITCH,D0 SUBQ.W #1,D0 ; Reduce pitch counter by one MOVE.W D0,PITCH CMP.W #0,D0 BEQ PITCH_DOWN ; Equal to zero? JSR SET_PITCH ; No - then update hardware pitch BRA UP_ONE ; And repeat until pitch=0 PITCH_DOWN ; PITCH=0 therefore ramp PITCH upwards JSR SET_PITCH ; But first update hardware reg's DOWN_ONE JSR DELAY ; Give us time to hear the note MOVE.W PITCH,D0 ADDQ.L #1,D0 ; Increment PITCH MOVE.W D0,PITCH CMP.W #$FFF,D0 ; Equal to $FFF BEQ PITCH_UP ; Yes then ramp PITCH downwards JSR SET_PITCH ; No - then update hardware reg's BRA DOWN_ONE ; And repeat until pitch=$FFF ;**************************************************************************** ; SUBROUTINES ;**************************************************************************** DELAY MOVE.W #$100,D6 COUNT_DOWN SUBQ.W #1,D6 CMP.W #0,D6 BNE COUNT_DOWN RTS ;**************************************************************************** ;* * ;* SET_PITCH:- Take a 12 bit value from variable PITCH and store in reg 0&1 * ;* * ;**************************************************************************** SET_PITCH MOVE.W PITCH,D3 ; Get PITCH as a whole in D3 CLR.W D1 ; Zero Word part of D1 MOVE.B D3,D1 ; Move low 8 bits of pitch into D1 MOVE.W #$80,D0 ; And write that value to reg 0 JSR GIACCESS ; of PSG. MOVE.W D3,D1 ; Get whole of pitch in D1 LSR.W #8,D1 ; Shift bits 15-8 into 7-0 - Leaving high MOVE.W #$81,D0 ; 4 bits in low 4 bits of D1, and then JSR GIACCESS ; write the result to reg 1 of PSG. TEST_KEYBOARD ; Keyboard testing routine - If any key MOVE.W #KEY_PRESSED,-(SP) ; is pressed, user wishes to exit. MOVE.W #RAWCONIO_OPCODE,-(SP) ; Uses GEMDOS call RAWCONIO TRAP #GEMDOS ADDQ.L #4,SP TST.L D0 ; Test result, Equal to Zero? BNE EXIT_PROGRAM ; No - then exit program RTS ; Yes - then return to main prog EXIT_PROGRAM ADDQ.L #4,SP ; Not equal to zero - pop unused return MOVE.L #SOUND_OFF,A0 ; address and then switch off sound JSR DOSOUND ; channel 1. RTS ; FINISHED! ;**************************************************************************** ;* * ;* GIACCESS:- D0 contains register number +$80 when operation=WRITE * ;* D1 contains new value when operation=WRITE * ;* D0 contains value returned when operation=READ * ;* * ;**************************************************************************** GIACCESS MOVE.W D0,-(SP) MOVE.W D1,-(SP) MOVE.W #GIACCESS_OPCODE,-(SP) TRAP #XBIOS ADDQ.L #6,SP RTS ;**************************************************************************** ;* * ;* DOSOUND:- A0 contains address of buffer holding sound commands * ;* * ;**************************************************************************** DOSOUND MOVE.L A0,-(SP) MOVE.W #DOSOUND_OPCODE,-(SP) TRAP #XBIOS ADDQ.L #6,SP RTS ;**************************************************************************** ; DATA ;**************************************************************************** .EVEN ; Align on next even address .DATA ; For linkers use - Data segement. SET_UP .BYTE 0,255,1,1,8,15,7,$FE,$82,0 ; Setup channel 1, volume 15, tone only ; storing 255 in reg 0,7 in reg 1 SOUND_OFF .BYTE 0,0,1,0,8,0,7,$FF,$82,0 ; Setup channel 1, volume 0, with no ; sound production and 0 in reg 0&1 ;**************************************************************************** ; VARIABLES ;**************************************************************************** .BSS ; For linkers use - Variable seg. PITCH .SPACE 4 /****************************************************************************/ /* ST Secrets series */ /* by */ /* COLM COX */ /* ------------------------------------------------------------------------ */ /* SOUND - ARTICLE ONE - LISTING SIX */ /* "C" */ /* PAGE 6 MAGAZINE - ENGLAND */ /****************************************************************************/ #define WRITE 0x80 #define READ 0 extern short dosound(),giaccess(); /* Extern and return short. */ char noise_only[]={6,31,7,0xF7,8,0,0x82,0}; /* See article for details */ char tone_only[]={0,1,1,0,7,0xFE,8,15,0x82,0}; /* of meanings of these */ char sound_off[]={7,0xFF,0x82,0}; /* strings of characters. */ main() { short flag; /* Flag to finish prog, 0 = */ flag=0; /* continue, 1 = finish. */ dosound(noise_only); /* Turn on noise channel */ lift_off(10); /* Make "lift off" sound */ pause(50); /* Wait for a bit */ shot(10); /* Gunshot sound */ shot(20); /* Long gunshot sound */ pause(50); /* Wait for a bit */ machine_gun(40); /* Fire 40 rounds on m.gun */ pause(50); /* Another pause! */ dosound(tone_only); /* Switch over to tone only */ while(flag==0) /* In the routine "laser" */ { /* a value of zero is */ flag=laser(); /* returned if no key is */ pause(40); /* pressed and one is retur-*/ } /* ned when a key is hit */ dosound(sound_off); /* Key hit - turn off sound */ } lift_off(length) short length; { short n_p,n_v,c; for(c=0,n_v=10,n_p=31;n_p>11;n_p--) /* Pitch rises from 31 to 11 */ { /* While volume rises from 10 */ giaccess(n_p,WRITE+6); /* 15 */ giaccess(n_v,WRITE+8); pause(length); c++; if(c==4) { c=0; n_v++; } } for(n_v=15;n_v>=0;n_v--) /* Then volume fades from 15 to */ { /* 0 */ giaccess(n_v,WRITE+8); pause(length*5); } } shot(length) { short n_p,n_v; for(n_p=10,n_v=15;n_v>=0;n_v--) /* Pitch is set at 10, while */ { /* volume falls from 15 to 0 */ giaccess(n_p,WRITE+6); giaccess(n_v,WRITE+8); pause(length); } } machine_gun(rounds) short rounds; { short a; for(a=0;a=0;a--) { giaccess(a,WRITE+8); pause(1); } } return(flag); } set_pitch(new_pitch) /* G.P routine to change pitch of channel 1 */ short new_pitch; { short high,low; low=new_pitch&0xFF; /* Divide pitch up into low and high bytes */ high=new_pitch>>8; giaccess(low,WRITE+0); /* Then change pitch reg's for channel 1 */ giaccess(high,WRITE+1); } pause(length) /* GP routine to pause for a length of time */ short length; { long d; /* d must be long as short*100 may > short */ for(d=0;d aF3=V=hpN^NuNV>a*pN^NuNV3=63 =8# =j> aN^NuNV3=63 =8# =j> aN^NuNV#=j> aN^NuNV#=j3 =63=8>aN^NuNV#=j3 =6>axN^NuNV>ahN^NuNV3=63 =83 =:>a@ n0=X n0=Z n0=\ n0=^B@09=VN^NuNV3=63 =83 =:3=<3=>>a n0=X n0=Z n0=\ n0=^B@09=VN^NuNV#=j>aN^NuNV3=63 =8>apN^NuNV3=63 =83 =:3=<3=>3=@3=B3=D3=F3=H3=J3=L3 =N3"=P#$=j3(=R3*=T>a n,0=X n00=Z n40=\ n80=^ n<0=` n@0=bB@09=VN^NuNV3=63 =8>atN^NuNV#=j3 =6>aTN^NuNV#=j3 =63=8>a,N^NuNV#=j3 =63=8> aN^NuNV#=j3 =63=8>!aN^NuNV#=j3 =6#=n>"aN^NuNV3=6# =j>#aN^NuNV#=j3 =63=8>(alN^NuNV#=j3 =6>)aLN^NuNV#=j3 =63=83=:3=<3=>3=@>*aN^NuNV#=j3 =63=83=:3=<>+aN^NuNV#=j3 =63=8>-aN^NuNV#=j3 =6>,a n0=X n0=ZB@09=VN^NuNV#=j3 =63=8 n3=:3=<>.a. n0=XB@09=VN^NuNV#=j3 =63=83=:3=<3=>3=@3=B3=D>/aN^NuNV#=j3 =6>2aN^NuNV3=63 =83 =:3=<3=>3=@3=B3=D3=F>3aLN^NuNV3=6# =j>4a,N^NuNV3=6>5aN^NuNV#=j>6a n 0=X n0=Z n0=\ n0=^B@09=VN^NuNV3=63 =83 =:3=<>Fa n0=X n0=ZB@09=VN^NuNV3=63 =83 =:3=<3=>3=@3=B3=D>Ga0 n0=X n0=ZB@09=VN^NuNV3=63 =83 =:3=<3=>3=@>HaN^NuNV3=63 =83 =:3=<3=>3=@3=B3=D>IaN^NuNV3=63 =83 =:3=<3=>3=@3=B3=D>Ja4N^NuNV#=j3 =83=:3=<>KaN^NuNV#=j3 =63=83=:>LaN^NuNV>Ma n0=X n 0=Z n0=\ n0=^B@09=VN^NuNV3=6# =j>NatN^NuNV>Oad n0=X n 0=Z n0=\ n0=^N^NuNV#=j>Pa$N^NuNV#=j>Qa N^NuNV#=j# =n>Za n0=XB@09=VN^NuNV3=63 =83 =:3=<3=>>daN^NuNV3=63 =83 =:3=<3=>>eajN^NuNV3=6>faRN^NuNV3=6>ga:N^NuNV3=63 =8>ha n 0=X n0=Z n0=\ n0=^B@09=VN^NuNV3=63 =83 =:3=<3=>3=@>iaN^NuNV3=63 =8>jaN^NuNV3=6>karN^NuNV3=63 =83 =:3=<3=>3=@>la2 n0=X n0=Z n0=\ n 0=^B@09=VN^NuNV#=j>naN^NuNV>oaN^NuNV3=63 =8>pa n =rB@09=VN^NuNV3=63 =8# =j>qaN^NuNV#=j3 =6>ra`N^NuNV#=j# =n>xa@N^NuNV3=63 =83 =:#=j#=n>yaN^NuNV#=j3 =6>zaN^NuNV#=j3 =6>{aN^NuNV#=j>|aN^NuNV#=j# =n>}aN^NuNV#<#< .мZ#<3#B#F3 3333N090Nu33333NNu"<pNBNu"<JpsNBNu,vvvv^vvvv3333Π2909 ||$|Р Nn09y3 @mZ yonN09y3 ymR ynF$|Р ?<?<NAX gtBgNADyx09yy3`Dy09yy3`0<@fNu*  $(        " "   (  $       $  $                    $          "  . i.. iLIS2_2 BASidLIS1_2 BASi10 REM ****************************************************************** 20 REM * ST Secrets series * 30 REM * by * 40 REM * COLM COX * 50 REM * -------------------------------------------------------------- * 60 REM * GRAPHICS part one - ARTICLE TWO - LISTING TWO * 70 REM * ST Basic * 80 REM * PAGE 6 MAGAZINE - ENGLAND * 90 REM ****************************************************************** 100 REM 110 REM This program uses the fact that numbers stored in an integer array 120 REM are stored sequentially. The integer arrays are used to store the 130 REM Sprite Definition Block and used as the buffer for the background. 140 REM The address of the arrays are then passed to the Line A code. You 150 REM even use this fact to store m/c programs, in an array! 160 REM 170 REM +------------------------------+ 180 REM | INITALISE EVERYTHING | 190 REM +------------------------------+ 200 MAX=2:DIM SPRITE%(37),BACKGROUND%(266*MAX),X(MAX),Y(MAX),XI(MAX),YI(MAX) 210 XI=3:YI=3:TOP=0:BOTTOM=383:LEFT=0:RIGHT=623:X=0:Y=0 220 LINEA=&H7FD00:INIT=0:DRAW=1:REMOVE=2 230 REM +-----------------------------------+ 240 REM | READ IN SPRITE DEFINITION | 250 REM +-----------------------------------+ 260 RESTORE 610:FOR A=0 TO 36:READ A$:SPRITE%(A)=VAL("&H"+A$):NEXT A 270 FOR A=0 TO MAX-1:X(A)=INT(RND(1)*RIGHT):Y(A)=INT(RND(1)*BOTTOM) 280 XI(A)=INT(RND(1)*14)-7:YI(A)=INT(RND(1)*14)-7:NEXT A 290 GOSUB 31000:CALL LINEA(INIT):GOSUB 690 300 REM +-------------------+ 310 REM | MAIN LOOP | 320 REM +-------------------+ 330 GOSUB DRAW.SPRITES:REM DRAW <-+ 340 GOSUB MOVE.SPRITES:REM MOVE | 350 GOSUB ERASE.SPRITES:GOTO 330:REM ERASE ---+ 360 REM +--------------------------------------------+ 370 REM | DRAW SPRITES IN ORDER: LOW TO HIGH | 380 REM +--------------------------------------------+ 390 DRAW.SPRITES:FOR A=0 TO MAX-1 400 SPADDR=VARPTR(SPRITE%(0)):BKADDR=VARPTR(BACKGROUND%(0)) 410 CALL LINEA(DRAW,X(A),Y(A),SPADDR,BKADDR+A*266) 420 NEXT A:RETURN 430 REM +---------------------------------------------+ 440 REM | ERASE SPRITES IN ORDER: HIGH TO LOW | 450 REM +---------------------------------------------+ 460 ERASE.SPRITES:FOR A=MAX-1 TO 0 STEP -1 470 SPADDR=VARPTR(SPRITE%(0)):BKADDR=VARPTR(BACKGROUND%(0)) 480 CALL LINEA(REMOVE,BKADDR+A*266) 490 NEXT A:RETURN 500 REM +----------------------------------------------------------------+ 510 REM | MOVE EACH SPRITE ACCORDING TO ITS XI AND YI INCREMENTS | 520 REM +----------------------------------------------------------------+ 530 MOVE.SPRITES:FOR A=0 TO MAX-1:X=X(A):Y=Y(A):XI=XI(A):YI=YI(A) 540 X=X+XI:IF XRIGHT THEN XI=-XI:X=X+XI+XI 550 Y=Y+YI:IF YBOTTOM THEN YI=-YI:Y=Y+YI+YI 560 X(A)=X:Y(A)=Y:XI(A)=XI:YI(A)=YI:NEXT A 570 RETURN 580 REM +---------------------------------+ 590 REM | SPRITE DEFINITION BLOCK | 600 REM +---------------------------------+ 610 DATA 0,0,0,0,1 620 DATA FFFF,FFFF,FFFF,8001,C003,8001,C003,8001 630 DATA C003,8001,C003,8001,C003,8001,C003,8001 640 DATA C003,8001,C003,8001,C003,8001,C003,8001 650 DATA C003,8001,C003,8001,FFFF,8001,FFFF,FFFF 660 REM +----------------------------------------------------------+ 670 REM | TRASH ON THE SCREEN FOR THE SPRITES TO MOVE OVER | 680 REM +----------------------------------------------------------+ 690 FULLW 2:CLEARW 2:GOTOXY 0,0 700 ?"As you can see, the sprites move in a" 710 ?"non destructive manner. Their speed is" 720 ?"slow for the simple reason that Basic" 730 ?"is slow!" 740 FOR X=0 TO 300 STEP 3:LINEF X,100,150,180:NEXT X 750 RETURN 30990 REM 30991 REM *************************************************************** 30992 REM * INSTALL CODE FOR LINE A SPRITES. CALLED BY: CALL (ARGS . .) * 30993 REM * ARG#1 - FUNCTION TO CARRY OUT: 0=INITALISE LINE A FOR USE. * 30994 REM * 1=DRAW SPRITE -> ARG#2=X POS, ARG#3=Y POS, ARG#4=ADDRESS OF * 30995 REM * S.D.B, ARG#5=ADDRESS OF BUFFER FOR BACKGROUND. 3=ERASE * 30996 REM * SPRITE - ARG#2=ADDRESS OF BUFFER FOR BACKGROUND. NO RANGE * 30997 REM * CHECKING IS CARRIED OUT SO ANY OUT OF RANGE VALUES CAN AND * 30998 REM * MOST LIKELY WILL CAUSE THE SYSTEM TO CRASH! * 30999 REM *************************************************************** 31000 RESTORE 31003:DEF SEG=523520:ZZZZ=0 31001 READ D:IF D<>-1 THEN POKE ZZZZ,D:ZZZZ=ZZZZ+1:GOTO 31001 31002 RETURN 31003 DATA 78,86,0,0,72,231,255,254,34 31004 DATA 110,0,10,34,17,12,129,0,0 31005 DATA 0,0,103,0,0,30,12,129,0 31006 DATA 0,0,1,103,0,0,30,12,129 31007 DATA 0,0,0,2,103,0,0,46,76 31008 DATA 223,127,255,78,94,78,117,160,0 31009 DATA 76,223,127,255,78,94,78,117,32 31010 DATA 41,0,4,34,41,0,8,32,105 31011 DATA 0,12,36,105,0,16,160,13,76 31012 DATA 223,127,255,78,94,78,117,36,105 31013 DATA 0,4,160,12,76,223,127,255,78 31014 DATA 94,78,117,192,0,0,5,95,77 31015 DATA 65,73,78,0,128,0,5,133,128 31016 DATA 0,3,229,128,0,3,69,0,0 31017 DATA -1 10 REM ******************************************************************* 20 REM * ST Secrets series * 30 REM * by * 40 REM * COLM COX * 50 REM * --------------------------------------------------------------- * 60 REM * GRAPHICS part one - ARTICLE TWO - LISTING ONE * 70 REM * ST Basic * 80 REM * PAGE 6 MAGAZINE - ENGLAND * 90 REM ******************************************************************* 100 REM 110 REM Demo of page flipping routine. Two pages are used, addresses: 120 REM $50000 and $78000. Text is written in both and then the two screens 130 REM can be flipped around at the press of a key. 140 REM 150 REM +-------------------------------+ 160 REM | GET SCREEN RESOLUTION | 170 REM +-------------------------------+ 175 REM 180 RESOLUTION=PEEK(&H44C) 190 IF RESOLUTION=&H000 THEN CX=160:CY=100:MR=60 200 IF RESOLUTION=&H100 THEN CX=320:CY=100:MR=60 210 IF RESOLUTION=&H200 THEN CX=320:CY=200:MR=120 220 NORMAL=PEEK(&H44E)*65536+PEEK(&H450):REM **** SCREEN BASE ADDRESS **** 230 REM +----------------------------+ 240 REM | CLEAR BOTH SCREENS | 250 REM +----------------------------+ 260 SCREEN=1:GOSUB SHOWSCREEN:REM *** PHYSICAL SCREEN = 1 *** 270 POKE CONTRL,3:VDISYS(1):REM ***** LOGICAL SCREEN = 2 **** 280 SCREEN=2:GOSUB SHOWSCREEN:REM *** PHYSICAL SCREEN = 2 *** 290 POKE CONTRL,3:VDISYS(1):REM ***** LOGICAL SCREEN = 1 **** 300 REM +---------------------------------+ 310 REM | INITIALISE BOTH SCREENS | 320 REM +---------------------------------+ 330 SCREEN=1:GOSUB SHOWSCREEN:FULLW 2:CLEARW 2:GOTOXY 0,0 340 PRINT "This is one of the two screens" 350 PRINT "It contains both text and graphics" 360 PRINT "And is displayed in an instant." 370 PRINT "Press 'A' to exit":PRINT"Anything else flips screen" 380 COLOR 1,1,1,4,2:PCIRCLE CX,CY,MR 390 REM 400 SCREEN=2:GOSUB SHOWSCREEN:FULLW 2:CLEARW 2:GOTOXY 0,0 410 PRINT "This is the other screen, and" 420 PRINT "Like the first, also contains text" 430 PRINT "And graphics.":INDEX=0 440 PRINT "Press 'A' to exit":PRINT"Anything else flips screen" 450 FOR R=MR TO 0 STEP -(MR/8) 460 COLOR 1,1,1,INDEX,2:PCIRCLE CX,CY,R:INDEX=INDEX+1:NEXT R 470 REM +------------------------------------------------+ 480 REM | NOW SHOW THE SCREENS ONE AFTER THE OTHER | 490 REM +------------------------------------------------+ 500 SCREEN=1:GOSUB SHOWSCREEN:I=INP(2):IF I=65 OR I=97 THEN GOTO 530 510 SCREEN=2:GOSUB SHOWSCREEN:I=INP(2):IF I=65 OR I=97 THEN GOTO 530 520 GOTO 500 530 REM +----------------------------------------------------+ 540 REM | "A" PRESSED - RESTORE EVERYTHING TO NORMAL | 550 REM +----------------------------------------------------+ 560 P=NORMAL:L=NORMAL:GOSUB 30110:END 30093 REM ******************************************************************* 30094 REM * THIS ROUTINE'S FUNCTION IS TO FLIP BETWEEN THE TWO SCREENS. THE * 30095 REM * LOGICAL SCREEN BASE IS SET TO ONE SCREEN, WHILE THE PHYSICAL * 30096 REM * SCREEN BASE IS SET TO POINT TO THE OTHER SCREEN. IN THIS WAY IT * 30097 REM * IS POSSIBLE TO DRAW ON ONE SCREEN, WHILE DISPLAYING THE OTHER * 30098 REM * AND THEN REVERSE THE SITUATION, DISPLAYING THE OTHER SCREEN. * 30099 REM ******************************************************************* 30100 SHOWSCREEN: IF SCREEN=1 THEN P=NORMAL:L=&H50000 ELSE P=&H50000:L=NORMAL 30110 PH=INT(P/65536):LH=INT(L/65536):PI=P-65536*PH:LI=L-65536*LH 30120 PM=INT(PI/256):DEF SEG=0:POKE &H44E,LH:POKE &H450,LI 30130 DEF SEG=&HFF8200:POKE 1,PH:POKE 3,PM:DEF SEG=0:RETURN . i.. iLIS6_2 C iLIS6_2 PRGiz/****************************************************************************/ /* ST Secrets series */ /* by */ /* COLM COX */ /* ------------------------------------------------------------------------ */ /* GRAPHICS part one - ARTICLE TWO - LISTING SIX */ /* "C" */ /* PAGE 6 MAGAZINE - ENGLAND */ /****************************************************************************/ #define SPRITES 9 /* Number of sprites */ #define TOP 0 /* Y co-ordinates defining max + min Y value - */ #define BOTTOM 383 /* Adjust to suit resolution you're working in */ #define LEFT 0 /* Same for X co-ordinates */ #define RIGHT 623 unsigned short sprite[]={0,0,0,0,1, /* Sprite */ 0xFFFF,0xFFFF,0xFFFF,0x8001,0xFFFF,0x8001,0xFFFF,0x8001, /* Definition */ 0xFFFF,0x8551,0xFFFF,0x8AA1,0xFFFF,0x8551,0xFFFF,0x8AA1, /* Block - */ 0xFFFF,0x8551,0xFFFF,0x8AA1,0xFFFF,0x8551,0xFFFF,0x8AA1, /* alter if you */ 0xFFFF,0x8001,0xFFFF,0x8001,0xFFFF,0x8001,0xFFFF,0xFFFF}; /* wish */ short xi[]={1,0,1,1,0,2,2,0,3}; /* X increments for the 9 sprites */ short yi[]={1,1,0,2,2,0,1,3,0}; /* Y '' ' ' ' '' */ char background[SPRITES][266]; /* Reserve memory to save backgrounds */ short x[SPRITES],y[SPRITES]; /* Co-ordinates of sprites */ short i; extern short init_linea(),draw_sprite(),erase_sprite(); /* Externals */ main() { short c; c=0; init_linea(); /* Initalise Line-A for usage - MUST DO */ for(i=0;iRIGHT || x[i]BOTTOM || y[i]=0;i--) /* reverse order - see what happens */ erase_sprite(&background[i][0]);/* if they are erased in the same */ } /* same order as they were drawn. */ /****************************************************************************/ /* THAT'S ALL FOLKS! */ /****************************************************************************/ `3nA j*o - ЭЭм// ??<JNA NB/<NA"/0<NBNuN aF3=V=hpN^NuNV>a*pN^NuNV3=63 =8# =j> aN^NuNV3=63 =8# =j> aN^NuNV#=j> aN^NuNV#=j3 =63=8>aN^NuNV#=j3 =6>axN^NuNV>ahN^NuNV3=63 =83 =:>a@ n0=X n0=Z n0=\ n0=^B@09=VN^NuNV3=63 =83 =:3=<3=>>a n0=X n0=Z n0=\ n0=^B@09=VN^NuNV#=j>aN^NuNV3=63 =8>apN^NuNV3=63 =83 =:3=<3=>3=@3=B3=D3=F3=H3=J3=L3 =N3"=P#$=j3(=R3*=T>a n,0=X n00=Z n40=\ n80=^ n<0=` n@0=bB@09=VN^NuNV3=63 =8>atN^NuNV#=j3 =6>aTN^NuNV#=j3 =63=8>a,N^NuNV#=j3 =63=8> aN^NuNV#=j3 =63=8>!aN^NuNV#=j3 =6#=n>"aN^NuNV3=6# =j>#aN^NuNV#=j3 =63=8>(alN^NuNV#=j3 =6>)aLN^NuNV#=j3 =63=83=:3=<3=>3=@>*aN^NuNV#=j3 =63=83=:3=<>+aN^NuNV#=j3 =63=8>-aN^NuNV#=j3 =6>,a n0=X n0=ZB@09=VN^NuNV#=j3 =63=8 n3=:3=<>.a. n0=XB@09=VN^NuNV#=j3 =63=83=:3=<3=>3=@3=B3=D>/aN^NuNV#=j3 =6>2aN^NuNV3=63 =83 =:3=<3=>3=@3=B3=D3=F>3aLN^NuNV3=6# =j>4a,N^NuNV3=6>5aN^NuNV#=j>6a n 0=X n0=Z n0=\ n0=^B@09=VN^NuNV3=63 =83 =:3=<>Fa n0=X n0=ZB@09=VN^NuNV3=63 =83 =:3=<3=>3=@3=B3=D>Ga0 n0=X n0=ZB@09=VN^NuNV3=63 =83 =:3=<3=>3=@>HaN^NuNV3=63 =83 =:3=<3=>3=@3=B3=D>IaN^NuN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$&`LN^Nu ^C readwritezero bytes written ==> disk full? file system i/o error: write fault read fault write protected insufficient space number = r`"r`r`r`r`r`r` rW`r`r |@#CNu0/NuNV .p#C @g . ` .N^NuNV .H#C @g . ` .N^Nu /bp`pNuNVH<z .lDD&". lDD( lB@H@40H@0H@`6 l$//N"PlS JlDLNAXNuNV/./. ?. ?<?NA N^NuNV/./. ?. ?<@NA N^Nu //?<ANA\NuNV?.?./.?<BNA N^NuNV?.?./.?<CNA N^Nu / o?/?<GNAPNu //?<HNA\Nu //?<INA\Nu / o//Bg?<JNA NuNV/././. ?. ?<KNAN^Nu /??<LNAXNu?<MNATNu / o?/?<NNAPNu?<ONATNu / o//Bg?<VNANuNV?.?./.?<WNA N^Nu //?<NM\Nu /??<NMXNu /??<NMXNu / o???<NM\NuNV?.?.?./. ?. ?<NMN^Nu / o/??<NMPNu?<NMTNu /??<NMXNu /??<NMXNu?< NMTNu?< NMTNu?< NMTNu?<NNTNuNVH Hn /./9&/<(N)F$LN^NuNVH Hn/. Hn/>??DD@ B 4 4DH/  qĊoߵ J Jxx??3``}PP @PAnǻEGDQ N@H??EE}@   888Q}eXe\DdD j{!!PPATTEEEQQUDT+Ep2_͠͠   s=yyQQM MDLGO>p@C#**AA$APPEQEEpEMD QG~0ρ@G<88 ((LAA$%o@t@TT888 %J''>0@D88!MM^.ѡ@@@o`@@QQ_ D N8 D߻|nx>0@@ p+  0 0B@@_QQP xDGŐD/@Y{DEEQ,JJ @0B  _^ ~TW| >x*DMMAu B׀)) lD(.>ׄS{D0t@B@ @ __DD8 Q x 8(OOtVV{@  ``ttX$8(oopvvBB@À<< mP4p8(ff//CCBB À<%$p8(vvXAip8(@@@^^;5//p\|~~` BB\\3̠Xp\|~~d 0 @@||;@HHp\|~~` @@A@@}}AMHp\|??`z@@ ?B̽x\|@S ?x\|OO@R``@@ @  x\|//Icc@@`  =xePX@}A!!=ggxe @|z`A`A@"y8džxe `6 ?  JJq<Î|e@ӹ,F,F@@@@((Y|goog]"@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ΐ n2"2""?";jHѻFL@@⧿@@f_GGw8 ̆O? !2""""3QFl'X\gg߻0 7_@M6ހN!2""?D .l7Y];;:0 ̶{2In2""?".Bn-!!/IMggw8 Ͷ{2O?" """"? lwYYgg0 6o &@_2 lwXX|d d;0 ̶]M>x 9?1 'F_?9??Ͷ_3}@?>x00<<@?0/XXfo gVߠ8?6y7Ȑ9?>x008<~~????@Ͷ?&080x 08<~~>??op Ͷ6680xx? 0>~~>??||? [771Z11s2@7o|&&x88xx>>??c|~??||>>̶O=>??8>>??~~~?@>>Ͷ_!<?????|~~?~||>>>?|"`@D3"EfG0Ww???  ??~|c?yxxO|O|``@@??EEP@P@``44 yySxSxUUUU@@ xQQ@@``YY@@ ???MMO|O|``@@?00?q<?@<?||}}<<``99N N <?@PP@A@A@@``EEQ Q 8???xAxALL}T}T_ _ x?8@A@ADD``E4E4Q Q x=>_<|C|C<<``EE<<p=>~ ?p=?p?=?=<88<<``|||;?wpQQEE@@``AAAQQQ;<oxx||88yyyJJJ{|???DD``AAADDD8{xEExx``}}}8{{x8{~xx??xp{|{9<<·xxO|O|`n`n811D ??~{|P?@@EEP@P@`n`nDAe>?gx{a=<@@yyPxPxjj|AU08?8H @@QQ@@`d`dDAM8?x0<<MMO|O|`n`nDD 8?9??8?~x3_<<8?~?`px?#_w `  ??q-`PP<88zDž??@_Ǡ?<88 >p>|[??<?88__?((?8}9?PP ?}@?<????+<:_8oW<````??~T@@ P?||TTH ?`__ 0000@@@@@@@? **W?f?P P PW??W__898@UG@ ??<<(x( W?PBP++TT ??<WW_? @@@@}BEtO@ @C<?**??8?/PP@AAc?ivx_x ?}`EE|88 O0*/*  ??9ppp/8?0 _?;?q~}  ????`/@0@?  s @@<  ;?3qa??PPPp???? ?>==?3? < `o? ??0xƀ89>@p@ ?p|8? 8?8 ?# |~y ?? |x a~?x@|g| 8G???> ?8< _ ~@@|?? ?! |?? ?? ' | ?|?:? ?!>? @@@@CCC?@@@@@@@@p0??_@??<?@@@@@` |s??  qqq1>:  > ?00????8??`` p````???pp???|??````?pp````~??8888??~C<?<8888p>``8~8~8~8~<8888>>8?8888?8888????~~?!3?~~??8p~~?? "q"q"q"q??8"""""""""""""""""""""""""""""""""""" """"?!"""""""""""""""""""""""""""""""""""" "!"!"!"!?`    " " " " (((( ssssππππ ? ??3>>>>όόόό(((CCC<<< ?( ( ( ( (((BBB@ASSSSCCCϼϼϼ?C? """"    hhhBBBpp?""""'''{{{覀~>~"q"q"q"q"""    ((( >>>>*** """"( ( ( ( ***""" """"όόόό))) ''''pppp""""hhhh<<<<ȀȀȀȀxxxx((((     ((((    pppp@@@yyyyȌȌȌȌ;;;(((( |||////    XXX**** }}}ɜyyyyȌȌȌȌ ccc  ??`?? Welcome to the 1st PAGE 6 ST disk which contains the listings from PAGE 6 from Issue 25 to Issue 35. There is insufficient room on the disk to put all the documentation and you may need copies of the relevant issue for such things as the GEM series and ST SECRETS. Some programs such as FADER may need to be transferred out of their folders. Pride of place goes to MAD, just plug in a joystick and play! Function keys start you at different levels and the ESC key will get you out of impossible situations. Collect all of the diamonds and the exit will appear. It's not easy! Thanks to Paul Lay for so many great programs from the early days of the Atari up to the present. ~~~~fffffffffffff