;Program written by Stephen Grigg ;comments, suggestions to grigg@juno.com ; very much thanks to Jimmy Mardell for showing me how to display contents of d0 ;I know that this can be optimized. I am working on optimizing it. If you have any ideas on ;the optimation, please mail me suggestions at the above address. ;Because the Esc Key is used to exit the program, the key value is not shown. It is 264 @program prog_code,prog_name include macros.h ;************** Start of Fargo program ************** prog_code: clr.l d0 ;makes sure d0 is empty jsr flib[clr_scr] ;duh! SetFont #1 WriteStr #6,#30,#4,text WriteStr #83,#10,#4,prog_name loop: jsr flib[idle_loop] cmp #264,d0 ;Esc pushed? beq done ;if so, go to done and exit. cmp #0,d0 ;if a key is not pressed, beq loop ;goto loop. move.l d0,d6 ;copies d0 to d6 to avoid the value being lost WriteStr #110,#60,#4,blank ;as writestring uses d0 move.l d6,d0 ;restores the value of d0 lea tmpstrend(PC),a0 ; A0 must point at the end of the string now bsr ConvStr ; Convert it! move.w #4,-(a7) ; Col move.l a0,-(a7) ; The address to the beginning of the string move.w #60,-(a7) ; Y move.w #110,-(a7) ; X jsr romlib[puttext] ; Display it lea 10(a7),a7 ; Restore the stack pointer clr.l d0 ;makes sure that d0 is clear. bra loop after finished, goto loop and begin all over... ConvStr: clr.b -(a0) ;this part, written by Jimmy Mardell, converts RepConv: ;value stored in d0 to a string so that it divu #10,d0 ;can be displayed on the screen. move.l d0,d2 swap d2 add.b #48,d2 move.b d2,-(a0) and.l #$FFFF,d0 bne RepConv rts done: rts prog_name: dc.b "GetKey Values",0 blank dc.b " ",0 ;blanks out number when next key is pressed ;this way, when after 12345 is displayed and ;13 is pressed the value 13345 is not shown... text dc.b "Made by Stephen Grigg [grigg@juno.com]",0 tmpstr ds.b 8 ; 8 =3D max 7 digits tmpstrend ;************** End of Fargo program **************** reloc_open add_library flib add_library romlib reloc_close end