% -*- fundamental -*- % % @@PLEAC@@_NAME MASD % @@PLEAC@@_WEB http://www.??? % @@PLEAC@@_INTRO % @@SKIP@@ The syntax is MASD and kasm compliant. % @@SKIP@@ It tries to be 39/40/48/49 compliant, but has only been tested on 48. % @@SKIP@@ I use masd_mod on emacs to edit, kasm to cross-assemble, sx to send, the 'saturn' UNIX emulator to test. % @@PLEAC@@_1.0 CODE % returns "\n" % two characters, \ and an n SAVE LC 00004 RES.STR LC 6E5C DAT0=C.4 A=R0.A LOAD GOVLNG PUSHA % $03A86 ENDCODE CODE % returns "Jon 'Maddog' Orwant" % literal single quotes SAVE LC 00026 RES.STR C=PC GOINA "STRING" A+C.A D1=A C=DAT1.16 DAT0=C.16 D0+16 D1+16 C=DAT1.16 DAT0=C.16 D0+16 D1+16 C=DAT1.6 DAT0=C.6 A=R0.A LOAD GOVLNG PUSHA % $03A86 *STRING $A4F6E60272D4164646F6767202F4277716E64755 % Jon 'Maddog' Orwant ENDCODE CODE % returns a newline character SAVE LC 00002 RES.STR LC 0A DAT0=C.2 A=R0.A LOAD GOVLNG PUSHA % $03A86 ENDCODE CODE % returns 'Jon "Maddog" Orwant' % literal double quotes SAVE LC 00026 RES.STR C=PC GOINA "STRING" A+C.A D1=A C=DAT1.16 DAT0=C.16 D0+16 D1+16 C=DAT1.16 DAT0=C.16 D0+16 D1+16 C=DAT1.6 DAT0=C.6 A=R0.A LOAD GOVLNG PUSHA % $03A86 *STRING $A4F6E60222D4164646F6762202F4277716E647 % Jon "Maddog" Orwant ENDCODE % @@PLEAC@@_1.1 CODE % level 2 : string % level 1 : offset (binary integer) % level 1 : count (binary integer) % returns the substring. % WARNING : no check done. SAVE GOSUB "VALUES" %(count) R1=C.A D1+5 GOSUB "VALUES" %(offset) D1+5 A=DAT1.A %(string) A+10.A A+C.A R2=A.A %@ where write C=R1.A RES.STR CD0EX D1=C C=R2.A D0=C C=R1.A GOSBVL MOVEDOWN %$0670C LOAD A=R0.A GOVLNG PUSHA % $03A86 *VALUES C=DAT1.A C=C+5.A D0=C A=DAT0.A A=A-6.A %length-1 LC 00005 ?A<C.A SKIPYES { LC 4 } % C=max(A,00004) P=C.0 D0+5 C=DAT0.WP % get datas P=0 C+C.A RTN ENDCODE