Substring/Top and tail: Difference between revisions

(→‎{{header|Picat}}: Added subsections)
Line 1,207:
his thin
</pre>
 
=={{header|MIPS Assembly}}==
Thanks to [https://www.chibialiens.com/mips/ Chibialiens] for the header/footer, font, and print routines.
<lang mips>.include "\SrcAll\Header.asm"
.include "\SrcAll\BasicMacros.asm"
.include "\SrcALL\AdvancedMacros.asm"
.include "\SrcALL\MemoryMap.asm"
 
; .definelabel UserRam,0xA0010000 (this is defined in the header)
 
CursorX equ 0x100 ;offset from label UserRam
CursorY equ 0x101 ;offset from label UserRam
 
main:
jal Cls
nop
la a0,MyString
la a1,UserRam+0x1000
push a0
push a1
jal strcpy
addiu a0,1 ;branch delay slot - increment base address prior to branching
pop a0 ;deliberately pop in the "wrong order"
pop a1 ;because printString uses $a0
jal PrintString
nop
jal NewLine
nop
la a0,MyString
la a1,UserRam+0x1000
push a0
push a1
jal strcpy
nop ;branch delay slot
;after a strcpy, a0/a1 both point to the null terminator
subiu a1,1
move t0,zero
sb t0,(a1)
.ifdef buildPSX
nop ;load delay slot
.endif
pop a0
pop a1
jal PrintString
nop
jal NewLine
nop
la a0,MyString
la a1,UserRam+0x1000
push a0
push a1
jal strcpy
addiu a0,1 ;branch delay slot
;after a strcpy, a0/a1 both point to the null terminator
subiu a1,1
move t0,zero
sb t0,(a1)
.ifdef buildPSX
nop ;load delay slot
.endif
pop a0
pop a1
jal PrintString
nop
jal NewLine
nop
halt:
nop
j halt
nop
MyString:
.ascii "Hello World"
.byte 0
.align 4
MyFont:
 
.ifdef buildn64
.incbin "\ResN64\ChibiAkumas.fnt"
.endif
.ifdef buildPSX
.incbin "\ResPSX\ChibiAkumas.fnt"
.endif
 
.include "\SrcALL\graphics.asm"
.include "\SrcAll\monitor.asm"
.include "\SrcALL\Multiplatform_Math_Integer.asm"
.include "\SrcALL\BasicFunctions_v2.asm"
.include "\SrcN64\Footer.asm"</lang>
{{out}}
<pre>ello World
Hello Worl
ello Worl</pre>
[https://ibb.co/CHwTrMb Screenshot of PlayStation 1 Emulator]
 
=={{header|Neko}}==
1,489

edits