grom >8000 b inputstring b display b strlen b initstack b push b pop b loadstdchars b displaycstring b fillram b createbutton b showfield b hchar b cis b actionfield b topascalstring b tocstring b csi b formatstring b righttrim b createedit b displaygstring b showmenu b createcombobox b random b open b close b read b write b clear b mcmode b mcclear b cif b clock b seconds b graphicsmode b save b load b cishex b scanrepeat b print b scroll copy "libdefs.gpl" edterr stri 'Minimum: %, Maximum: %' libram equ >fe00 dsbuf equ libram screp equ dsbuf+256 sccurs equ screp+1 free equ sccurs+1 inputstring *********** * w arg -> buffer * b arg+2 -> max. length * b arg+3 -> x * b arg+4 -> y dst >1b,@pushn call push dst @arg,@buffer clr @lmax st @arg+2,@lmax+1 ddec @lmax st @arg+3,@x st @arg+4,@y buffer equ >8300 lmax equ >8302 x equ >8304 y equ >8305 notused equ >8306 dcurs equ >8307 c equ >8308 curs equ >8309 x1 equ >830a y1 equ >830b right equ >830c ins equ >830d index equ >830e i equ >8310 i2 equ >8312 ok equ >8314 pts equ >8315 ptd equ >8317 l equ >8319 st @x,@x1 st @y,@y1 clr @right clr @ins dclr @index clr @ok dst @buffer,@arg call strlen clr @l dst @arg,@l+1 * enter pressed? loop cz @ok br akb11 * scan call scanrepeat st @arg+2,@dcurs st @arg+3,@curs st @arg,@c cz @arg+1 bs akb5 * character? ch >0f,@c br akb6 * insert mode cz @ins bs akb27 dst @l,@i dceq @l,@lmax br akb30 ddec @i b akb29 akb30 dinc @l akb29 dst @buffer,@ptd dadd @i,@ptd dst @ptd,@pts ddec @pts akb9 dch @index,@i br akb8 st @0(@pts),@0(@ptd) ddec @i ddec @pts ddec @ptd b akb9 akb8 call akb19 b akb7 * new character akb27 dceq @index,@l br akb7 dinc @l akb7 dst @buffer,@ptd dadd @index,@ptd st @c,@0(@ptd) st 1,@right call akb20 b akb10 * enter akb6 ceq >0d,@c br akb12 st 1,@ok st 1,@curs st 100,@timer b akb10 * left akb12 ceq >08,@c br akb13 clr @ins call akb20 dcz @index bs akb10 ddec @index dec @x cge 0,@x bs akb10 st 31,@x dec @y * right akb13 ceq >09,@c br akb14 st 1,@right clr @ins b akb10 * insert akb14 ceq >04,@c br akb15 st 1,@ins b akb10 * delete akb15 ceq >03,@c br akb16 dst @index,@i dst @buffer,@ptd dadd @index,@ptd dst @l,@i2 cz @0(@ptd) bs akb28 ddec @l akb28 dst @ptd,@pts dinc @pts akb18 dche @i2,@i bs akb17 st @0(@pts),@0(@ptd) dinc @pts dinc @ptd dinc @i b akb18 akb17 dinc @l call akb19 ddec @l b akb10 * clear akb16 ceq >07,@c br akb10 st @x1,@x st @y1,@y dclr @index clr @ins dst @buffer,@arg clr @arg+2 st @lmax+1,@arg+3 call fillram dst @buffer,@ptd dst @lmax,@l call akb19 dclr @l * move cursor right akb10 cz @right bs akb5 clr @right call akb20 dst @lmax,@i ddec @i dche @i,@index bs akb5 dst @buffer,@ptd dadd @index,@ptd cz @0(@ptd) br akb26 st ' ',@0(@ptd) dinc @l akb26 dinc @index inc @x che 32,@x br akb5 clr @x inc @y * display cursor akb5 cz @curs bs akb23 call akb20 b loop akb23 cz @dcurs bs loop st @x,@xpt st @y,@ypt st >1e,@ccha b loop * enter pressed akb11 dst >1b,@popn call pop rtn * display after cursor akb19 dst @buffer,@arg dadd @index,@arg dst @l,@i dsub @index,@i st @i+1,@arg+2 st @x,@arg+3 st @y,@arg+4 call display rtn * display at cursor akb20 st @x,@xpt st @y,@ypt dst @buffer,@pts dadd @index,@pts st @0(@pts),@ccha rtn display ******* * w arg -> string * b arg+2 -> string length * b arg+3 -> x * b arg+4 -> y st @arg+2,@fac+1 clr @fac st @arg+3,@arg+7 clr @arg+6 clr @arg+3 dsll 5,@arg+3 dadd @arg+3,@arg+6 move @fac,@0(@arg),v*arg+6 rtn displaycstring ************** * w arg -> c string * b arg+2 -> x * b arg+3 -> y dst @arg,@arg+6 st @arg+3,@arg+4 st @arg+2,@arg+3 call strlen st @arg,@arg+2 dst @arg+6,@arg call display rtn strlen ****** * w arg -> c string * b length -> arg clr @arg+2 sl2 cz @0(@arg) bs sl1 dinc @arg inc @arg+2 b sl2 sl1 st @arg+2,@arg rtn initstack ********* stack equ >fff0 stkpos equ >fff8 dclr @stkpos rtn push **** pushs equ >fff4 clr @pushs dsub @pushn,@stkpos dst @stkpos,@fac push1 st *pushs,@stack(@fac) inc @pushs dinc @fac ddec @pushn br push1 rtn pop *** popd equ >fff4 clr @popd dst @stkpos,@fac dadd @popn,@stkpos pop1 st @stack(@fac),*popd inc @popd dinc @fac ddec @popn br pop1 rtn cursor data >007c,>7c7c,>7c7c,>7c7c underl data >0000,>fe00,>0000,>0000 tick data >0002,>060c,>5870,>2000 space data >0000,>0000,>0000,>0000 loadstdchars ************ dst >0900,@fac call locase dst >0b00,@fac call upcase move 8,g@cursor,v@>1e*8+>800 move 8,g@underl,v@>1d*8+>800 move 8,g@tick,v@>1c*8+>800 move 8,g@space,v@>00*8+>800 clr @arg move 1,@arg,#0 st >f0,@arg move 1,@arg,#2 st >0e,@arg move 1,@arg,#3 st >01,@arg move 1,@arg,#4 rtn fillram ******** * w arg -> ram to clear * b arg+2 -> byte * b arg+3 -> bytes count clr1 st @arg+2,@0(@arg) dinc @arg dec @arg+3 br clr1 rtn displaygstring ************** * w arg -> pascal string in grom * b arg+2 -> x * b arg+3 -> y * w arg+4 -> buffer in ram dst @arg+4,@arg+6 st @arg+3,@arg+4 st @arg+2,@arg+3 st @arg+4,@arg+2 move 1,g@0(@arg),@arg+5 clr @arg+4 dadd 1,@arg move @arg+4,g@0(@arg),@0(@arg+6) dst @arg+6,@arg st @arg+2,@arg+4 st @arg+5,@arg+2 call display rtn createfield *********** * w arg -> field dst @fieldtext(@arg),@arg+2 move 1,g@0(@arg+2),@arg+2 st @fieldx(@arg),@arg+4 add @arg+2,@arg+4 st @arg+4,@fieldvaluex(@arg) rtn createbutton ************ * w arg -> button dst showfieldtext,@fieldshow(@arg) rtn showfieldtext ************* * w arg -> field dst 7,@pushn call push sft1 equ >8300 sft2 equ >8302 sftx equ >8304 sfty equ >8305 sftl equ >8306 dst @arg,@sft1 dst @fieldtext(@sft1),@arg move 1,g@0(@arg),@sftl st @fieldx(@sft1),@arg+2 st @arg+2,@sftx st @fieldy(@sft1),@arg+3 st @arg+3,@sfty inc @sfty dst dsbuf,@arg+4 call displaygstring st ' ',@arg st @sfty,@arg+1 st @sftx,@arg+2 clr @arg+3 st @sftl,@arg+4 call hchar st @sfty,@sft2+1 clr @sft2 dsll 5,@sft2 st @sftx,@sfty clr @sftx dadd @sftx,@sft2 st @fieldkeyindex(@sft1),@sfty dec @sfty dadd @sftx,@sft2 st >1d,v*sft2 dst 7,@popn call pop rtn showfield ********* * w arg -> field inct @substk dst sfd1,*substk inct @substk dst @fieldshow(@arg),*substk rtn sfd1 rtn hchar ***** * b arg -> char * b arg+1 -> y * b arg+2 -> x * w arg+3 -> count dcz @arg+3 bs hc2 st @arg+1,@arg+6 clr @arg+5 dsll 5,@arg+5 st @arg+2,@fac+1 clr @fac dadd @fac,@arg+5 hc1 st @arg,v*arg+5 dinc @arg+5 ddec @arg+3 br hc1 hc2 rtn cis *** * w arg -> number * pascal string -> arg+0..7 dst 4,@pushn call push cis5 equ >8300 cis6 equ >8302 dclr @arg+4 clr @arg+6 dcge 0,@arg bs cis1 dneg @arg st 1,@arg+6 cis1 dst @arg,@arg+2 cis2 dclr @arg ddiv 10,@arg add >30,@arg+3 st @arg+3,@fac(@arg+4) dinc @arg+4 dst @arg,@arg+2 dcz @arg+2 br cis2 cz @arg+6 bs cis3 st '-',@fac(@arg+4) dinc @arg+4 cis3 st @arg+5,@arg dst @arg+4,@cis5 ddec @cis5 dclr @cis6 cis4 st @fac(@cis5),@arg+1(@cis6) dinc @cis6 ddec @cis5 dcge 0,@cis5 bs cis4 dst 4,@popn call pop rtn actionfield *********** * w arg -> field ceq @key,@fieldkey(@arg) br af1 inct @substk dst @fieldaction(@arg),*substk rtn af1 rtn tocstring *********** * w arg -> pascal string * w arg+2 -> destination clr @arg+4 st @0(@arg),@arg+5 move @arg+4,@1(@arg),@0(@arg+2) clr @arg+4(@arg+2) rtn topascalstring ************** * w arg -> c string * w arg+2 -> destination dst @arg,@arg+4 dst @arg+2,@arg+6 call strlen st @arg,@0(@arg+6) st @arg,@arg+1 clr @arg move @arg,@0(@arg+4),@1(@arg+6) rtn csi *** * arg+0..7 -> pascal string * number -> w fac * b err -> arg (1=not a number,2=overflow) call righttrim clr @fac st @arg,@fac+1 move @fac,@arg+1,v@editvram dst editvram,@arg dadd @fac,@arg st 0,v*arg dst editvram,@>8356 xml csn dceq @>8356,@arg bs csi3 st 1,@arg rtn csi3 clr @>8354 xml cfi cz @>8354 bs csi1 st 2,@arg cz @>8375 bs csi2 dst -32768,@fac b csi4 csi2 dst 32767,@fac b csi4 csi1 clr @arg csi4 rtn formatstring ************ * w arg -> source string in grom * w arg+2 -> dest. string in ram * fac+0..6 -> 0..4 words (%) dst @fac,@arg+4 dst 20,@pushn call push dst @arg+4,@fac fptd equ >8300 fpts equ >8302 fpi equ >8304 fd equ >8306 fsl equ >8308 fdl equ >8309 fs5 equ >830a faccpy equ >830b move 8,@fac,@faccpy dst @arg+2,@fd dst faccpy,@fpi dst @arg,@fpts dst @fd,@fptd move 1,g@0(@fpts),@fsl dinc @fpts dinc @fptd clr @fdl fs4 move 1,g@0(@fpts),@0(@fptd) dinc @fpts ceq '%',@0(@fptd) br fs1 dst @0(@fpi),@arg dinct @fpi call cis dclr @fs5 fs2 st @arg+1(@fs5),@0(@fptd) dinc @fptd dinc @fs5 inc @fdl dec @arg br fs2 b fs3 fs1 dinc @fptd inc @fdl fs3 dec @fsl br fs4 st @fdl,@0(@fd) dst 20,@popn call pop rtn righttrim ********* * arg+0..7 -> pascal string * trimmed string -> arg+0..7 clr @fac st @arg,@fac+1 rt2 ceq ' ',@arg(@fac) br rt1 ddec @fac dec @arg br rt2 rt1 rtn createedit ********** * w arg -> edit dst @arg,@arg+6 dst @editbuffer(@arg),@arg clr @arg+2 st @editbuflen(@arg+6),@arg+3 call fillram dst @arg+6,@arg dst showedit,@fieldshow(@arg) dst editaction,@fieldaction(@arg) call createfield rtn showedit ******** * w arg -> edit dst 5,@pushn call push se1 equ >8300 sx equ >8302 sy equ >8303 sel equ >8304 dst @arg,@se1 call showfieldtext st @editbuflen(@se1),@sel cz @editnumeric(@se1) bs se2 dst @editbuffer(@se1),@arg clr @arg+2 st @sel,@arg+3 call fillram dst @editvalue(@se1),@arg call cis move 8,@arg,@fac dst fac,@arg dst @editbuffer(@se1),@arg+2 call tocstring se2 dst @editbuffer(@se1),@arg st @fieldvaluex(@se1),@arg+2 st @arg+2,@sx st @fieldy(@se1),@arg+3 st @arg+3,@sy call displaycstring dst @editbuffer(@se1),@arg call strlen add @arg,@sx sub @arg,@sel st @arg,@arg+2 st ' ',@arg st @sy,@arg+1 st @sx,@arg+2 clr @arg+3 st @sel,@arg+4 call hchar dst 5,@popn call pop rtn editaction ********** * w arg -> edit dst 5,@pushn call push ea1 equ >8300 ea2 equ >8302 eaerr equ >8304 dst @arg,@ea1 call accton ea7 dst @editbuffer(@ea1),@arg st @editbuflen(@ea1),@arg+2 st @fieldvaluex(@ea1),@arg+3 st @fieldy(@ea1),@arg+4 call inputstring cz @editnumeric(@ea1) bs ea3 dst @editbuffer(@ea1),@arg dst fac,@arg+2 call topascalstring st @fac,@ea2+1 clr @ea2 dinc @ea2 move @ea2,@fac,@arg call csi clr @eaerr ceq 1,@arg bs ea4 dst @fac,@editvalue(@ea1) dst @editmax(@ea1),@arg dst @editmin(@ea1),@arg+2 dcgt @arg,@fac bs ea6 dcgt @fac,@arg+2 bs ea6 b ea5 ea6 dst @arg+2,@fac dst @arg,@fac+2 dst edterr,@arg dst dsbuf,@arg+2 call formatstring st ' ',@arg st 23,@arg+1 clr @arg+2 dst 32,@arg+3 call hchar dst dsbuf+1,@arg st @dsbuf,@arg+2 st 2,@arg+3 st 23,@arg+4 call display ea4 st 1,@eaerr call badton ea5 dst @ea1,@arg call showedit cz @eaerr br ea7 ea3 dst 5,@popn call pop rtn showmenu ******** * w arg -> menu dst 13,@pushn call push sm3 equ >8300 sm4 equ >8302 smx equ >8304 smy equ >8305 sml1 equ >8306 sml2 equ >8307 smc equ >8308 smi equ >8309 smrx equ >830a smry equ >830b smrw equ >830c st @menuitemscount(@arg),@arg+2 st @arg+2,@smc dst @arg,@arg+3 dadd menuitems,@arg+3 clr @arg+7 sm2 dst @menuitemtext(@arg+3),@arg+5 move 1,g@0(@arg+5),@arg+5 cgt @arg+7,@arg+5 br sm1 st @arg+5,@arg+7 sm1 dadd menuitemlength,@arg+3 dec @arg+2 br sm2 st @arg+7,@sml1 dst @arg,@sm3 dst @arg,@sm4 st @menuy(@arg),@smy st @menux(@arg),@smx st @smy,@smry st @smx,@smrx st @sml1,@smrw inc @smrw st @smry,@arg st @smrx,@arg+1 st @smrw,@arg+2 st @smc,@arg+3 call clearrectangle inc @smx st @smc,@smi dadd menuitems,@sm4 sm5 dst @menuitemtext(@sm4),@arg move 1,g@0(@arg),@sml2 st @smx,@arg+2 st @smy,@arg+3 dst dsbuf,@arg+4 call displaygstring st ' ',@arg st @smy,@arg+1 st @smx,@arg+2 add @sml2,@arg+2 st @sml1,@arg+4 sub @sml2,@arg+4 clr @arg+3 call hchar inc @smy dadd menuitemlength,@sm4 dec @smi br sm5 dst @sm3,@arg call showmenuselection dst @sm3,@arg call itemindex st @arg,@smi dst @sm3,@sm4 dadd menuitems,@sm4 sm6 scan br sm6 ceq 'X',@key bs sm7 ceq 10,@key bs sm7 ceq 'E',@key bs sm8 ceq 11,@key bs sm8 ceq >0d,@key bs sm9 b sm6 sm7 inc @smi ceq @smi,@smc br sm10 clr @smi b sm10 sm8 dec @smi cge 0,@smi bs sm10 st @smc,@smi dec @smi sm10 dst @sm4,@arg clr @arg+2 st @smi,@arg+3 dsll 2,@arg+2 dadd @arg+2,@arg dst @menuitemvalue(@arg),@menuvalue(@sm3) dst @sm3,@arg call showmenuselection b sm6 sm9 st @smry,@arg st @smrx,@arg+1 st @smrw,@arg+2 st @smc,@arg+3 call clearrectangle dst 13,@popn call pop rtn itemindex ********* * w arg -> menu * b index -> arg st @menuitemscount(@arg),@arg+2 dst @menuvalue(@arg),@arg+3 dadd menuitems,@arg dadd menuitemvalue,@arg clr @arg+7 ii2 dst @0(@arg),@arg+5 dceq @arg+5,@arg+3 bs ii1 dadd menuitemlength,@arg inc @arg+7 ceq @arg+7,@arg+2 bs ii1 b ii2 ii1 st @arg+7,@arg rtn showmenuselection ***************** * w arg -> menu dst 2,@pushn call push sms1 equ >8300 dst @arg,@sms1 call itemindex st @menuitemscount(@sms1),@arg+1 clr @arg+2 st @menuy(@sms1),@arg+3 dsll 5,@arg+2 st @menux(@sms1),@arg+5 clr @arg+4 dadd @arg+4,@arg+2 clr @arg+4 sms4 ceq @arg+4,@arg bs sms2 st ' ',v*arg+2 b sms3 sms2 st >1c,v*arg+2 sms3 inc @arg+4 dadd 32,@arg+2 ceq @arg+1,@arg+4 br sms4 dst 2,@popn call pop rtn clearrectangle ************** * b arg -> y * b arg+1 -> x * b arg+2 -> width * b arg+3 -> height dst 4,@pushn call push move 4,@arg,@>8300 st @arg+3,@arg+7 cr1 clr @arg+3 st @arg+2,@arg+4 st @arg+1,@arg+2 st @arg,@arg+1 st ' ',@arg call hchar inc @>8300 move 4,@>8300,@arg dec @arg+7 br cr1 dst 4,@popn call pop rtn createcombobox ************** * w arg -> combo box dst 2,@pushn call push cc1 equ >8300 dst @arg,@cc1 call createfield st @fieldvaluex(@cc1),@comboboxmenu+menux(@cc1) st @fieldy(@cc1),@comboboxmenu+menuy(@cc1) dst showcombobox,@fieldshow(@cc1) dst comboboxaction,@fieldaction(@cc1) dst 2,@popn call pop rtn showcombobox ************ * w arg -> combo box dst 2,@pushn call push sc1 equ >8300 dst @arg,@sc1 call showfieldtext dst @sc1,@arg dadd comboboxmenu,@arg dst @arg,@sc1 call itemindex st @arg,@arg+1 clr @arg dsll 2,@arg dst @sc1,@arg+2 dadd menuitems,@arg+2 dadd @arg+2,@arg dst @0(@arg),@arg dst @menuxy(@sc1),@arg+2 dst dsbuf,@arg+4 call displaygstring dst 2,@popn call pop rtn comboboxaction ************** * w arg -> combo box dst 2,@pushn call push cba1 equ >8300 dst @arg,@cba1 dadd comboboxmenu,@arg call showmenu dst @cba1,@arg call showcombobox dst 2,@popn call pop rtn clear ***** dst >2020,@arg dclr @arg+2 cl1 dst @arg,v*arg+2 dinct @arg+2 dcgt 32*24,@arg+2 br cl1 rtn random ****** * b arg -> n * b 0..n-1 -> arg dst @>83c0,@arg+1 dmul >6fe5,@arg+1 dadd >7ab9,@arg+3 dst @arg+3,@>83c0 dst @arg+3,@arg+1 st @arg+2,@arg+3 st @arg+1,@arg+4 dclr @arg+1 clr @arg+5 st @arg,@arg+6 ddiv @arg+5,@arg+1 st @arg+4,@arg rtn fileoperation ************* * w arg -> pab address * b arg+2 -> operation * b error number + 1 -> arg+2 st @arg+2,@pabopcode(@arg) st @pabflags(@arg),@arg+2 and >1f,@arg+2 st @arg+2,@pabflags(@arg) move pablength,@0(@arg),v@>3b02 dst >3b02+9,@dsrnam call link byte 8 bs fo2 move pablength,v@>3b02,@0(@arg) st @pabflags(@arg),@arg+2 srl 5,@arg+2 ceq 5,@arg+2 br fo1 clr @arg+2 b fo3 fo1 cz @arg+2 bs fo3 inc @arg+2 b fo3 fo2 st 1,@arg+2 fo3 st @pabopcode(@arg),@arg+3 ceq 1,@arg+3 bs fo4 cz @arg+2 bs fo4 st @arg+2,@arg+7 call close st @arg+7,@arg+2 fo4 rtn open **** * w arg -> pab address * b arg+2 -> mode * b error -> arg+2 or >10,@arg+2 st @arg+2,@pabflags(@arg) dst >3b80,@pabbuffer(@arg) st 80,@pabreclen(@arg) clr @arg+2 call fileoperation rtn close ***** * w arg -> pab address * b error -> arg+2 st 1,@arg+2 call fileoperation rtn read **** * w arg -> pab address * w arg+2 -> buffer address * b error -> arg+2 dst @arg+2,@arg+6 st 2,@arg+2 call fileoperation st @pabcharcount(@arg),@arg+4 clr @arg+3 move @arg+3,v@>3b80,@0(@arg+6) rtn write ***** * w arg -> pab address * w arg+2 -> buffer address * b arg+4 -> character count * b error -> arg+2 st @arg+4,@arg+5 clr @arg+4 move @arg+4,@0(@arg+2),v@>3b80 st @arg+5,@pabcharcount(@arg) st 3,@arg+2 call fileoperation rtn mcmode ****** st >e8,@arg move 1,@arg,#1 st 2,@flags clr @arg clr @arg+1 dclr @arg+2 mc1 dclr @arg+4 mc3 st @arg,@dsbuf(@arg+4) dinc @arg+4 inc @arg dche >20,@arg+4 br mc3 clr @arg+6 mc2 move >20,@dsbuf,v*arg+2 dadd >20,@arg+2 inc @arg+6 che 4,@arg+6 br mc2 inc @arg+1 che 6,@arg+1 br mc1 rtn mcclear ******* dst >800,@arg mcc1 dclr v*arg dinct @arg dche >e00,@arg br mcc1 rtn cif *** * w fac -> integer * b arg -> 1=signed, 0=unsigned * radix 100 -> fac+0..7 dcz @fac bs ci5 st @arg,@arg+6 cz @arg bs ci2 dcge 0,@fac bs ci4 dneg @fac b ci2 ci4 clr @arg+6 ci2 dst @fac,@arg+2 dclr @arg dclr @arg+4 ci1 ddiv 100,@arg st @arg+3,@fac+5(@arg+4) dst @arg,@arg+2 dclr @arg dinc @arg+4 dcz @arg+2 br ci1 ddec @arg+4 st @arg+5,@fac add >40,@fac dclr @fac+2 dst 1,@arg ci3 st @fac+5(@arg+4),@fac(@arg) dinc @arg ddec @arg+4 dcge 0,@arg+4 bs ci3 dclr @fac+4 dclr @fac+6 cz @arg+6 bs ci5 dneg @fac ci5 rtn clock ***** * w arg -> pab * b day of week -> arg (0=no clock) * b month -> arg+1 * b day -> arg+2 * b year -> arg+3 * b hours -> arg+4 * b minutes -> arg+5 * b seconds -> arg+6 clkbuf equ >8300 clkret equ >8300+19 b clk1 clk2 stri 'CLOCK' clk1 dst 26,@pushn call push move 6,g@clk2,@pabname(@arg) st update,@arg+2 call open cz @arg+2 br clk3 dst clkbuf,@arg+2 call read call close st 1,@arg st @clkbuf,@arg+1 call csi st @fac+1,@clkret st 2,@arg dst @clkbuf+2,@arg+1 call csi st @fac+1,@clkret+1 st 2,@arg dst @clkbuf+5,@arg+1 call csi st @fac+1,@clkret+2 st 2,@arg dst @clkbuf+8,@arg+1 call csi st @fac+1,@clkret+3 st 2,@arg dst @clkbuf+11,@arg+1 call csi st @fac+1,@clkret+4 st 2,@arg dst @clkbuf+14,@arg+1 call csi st @fac+1,@clkret+5 st 2,@arg dst @clkbuf+17,@arg+1 call csi st @fac+1,@clkret+6 move 7,@clkret,@arg b clk4 clk3 clr @arg clk4 dst 26,@popn call pop rtn seconds ******* * b arg -> start minutes * b arg+1 -> start seconds * b arg+2 -> end minutes * b arg+3 -> end seconds * w duration seconds -> arg st @arg,@arg+4 mul 60,@arg+4 clr @arg dadd @arg+4,@arg st @arg+2,@arg+4 mul 60,@arg+4 clr @arg+2 dadd @arg+4,@arg+2 dsub @arg,@arg+2 gt bs sec1 dadd 3600,@arg+2 sec1 dst @arg+2,@arg rtn graphicsmode ************ st >e0,@arg move 1,@arg,#1 clr @flags all ' ' call loadstdchars rtn save **** * w arg -> pab address * w arg+2 -> source address in vdp * w arg+4 -> length * b error -> arg+2 dst @arg+2,@pabbuffer(@arg) dst @arg+4,@pabrecnumber(@arg) st 6,@arg+2 call fileoperation rtn load **** * w arg -> pab address * w arg+2 -> destination address in vdp * w arg+4 -> length * b error -> arg+2 dst @arg+2,@pabbuffer(@arg) dst @arg+4,@pabrecnumber(@arg) st 5,@arg+2 call fileoperation rtn cishex ****** * w arg -> number * pascal string -> arg+0..7 dst 4,@pushn call push cish5 equ >8300 cish6 equ >8302 dclr @arg+4 dst @arg,@arg+2 cish2 dclr @arg ddiv 16,@arg add >30,@arg+3 cgt >39,@arg+3 br cish7 add 'A'->30-10,@arg+3 cish7 st @arg+3,@fac(@arg+4) dinc @arg+4 dst @arg,@arg+2 dcz @arg+2 br cish2 st @arg+5,@arg dst @arg+4,@cish5 ddec @cish5 dclr @cish6 cish4 st @fac(@cish5),@arg+1(@cish6) dinc @cish6 ddec @cish5 dcge 0,@cish5 bs cish4 dst 4,@popn call pop rtn scanrepeat ********** * b arg -> character * b arg+1 -> 1=character ready * b arg+2 -> 1=clear cursor * b arg+3 -> 1=draw cursor clr @arg+1 clr @arg+2 clr @arg+3 cz @sccurs bs sr6 che 20,@timer br sr5 clr @sccurs st 1,@arg+3 clr @timer ceq 1,@screp br sr5 st 2,@screp b sr5 sr6 che 15,@timer br sr5 st 1,@sccurs st 1,@arg+2 clr @timer sr5 scan st @key,@arg br sr1 st 1,@arg+1 b sr2 * repeat ? sr1 ceq >ff,@key br sr3 clr @screp b sr2 sr3 cz @screp br sr2 st 1,@screp st @key,@c clr @timer clr @sccurs * repeat sr2 ceq 2,@screp br sr4 ch 5,@timer br sr4 st 1,@arg+1 sr4 cz @arg+1 bs sr10 st 100,@timer clr @sccurs sr10 rtn print ***** * w arg -> pascal string in ram call scroll dst 32*23,@arg+2 move 1,@0(@arg),@arg+4 dinc @arg pr2 st @0(@arg),v*arg+2 dinc @arg dinc @arg+2 dceq 24*32,@arg+2 br pr1 dst 23*32,@arg+2 call scroll b pr1 st @arg+3,@arg+5 and >1f,@arg+5 cz @arg+5 br pr1 call scroll pr1 dec @arg+4 cz @arg+4 br pr2 rtn scroll ****** dst 32,@fac dclr @fac+2 move 23*32,v@0(@fac),v@0(@fac+2) dst 23*32,@fac scr1 dst >2020,v*fac dinct @fac dceq 24*32,@fac br scr1 rtn end