RosettaCodeData/Task/Loops-For/MIPS-Assembly/loops-for.mips

45 lines
1.1 KiB
Plaintext

.include "\SrcAll\Header.asm"
.include "\SrcAll\BasicMacros.asm"
.include "\SrcPSX\MemoryMap.asm"
.include "\SrcN64\MemoryMap.asm"
CursorX equ 0x100
CursorY equ 0x101
main:
li t3,5+1 ;outer loop counter
li t2,1 ;inner loop counter
move a2,t2 ;working copy of inner loop counter
loop:
li a1,'*'
jal PrintChar
nop ;needed on PlayStation after branches to prevent out-of-order execution.
subiu a2,1
bnez a2,loop
nop
;overhead
jal NewLine ;this doesn't use t2 so we don't care about out-of-order execution.
addiu t2,1 ;increment outer loop counter
move a2,t2 ;next time, we'll print one more * than we did last time.
bne t2,t3,loop ;are we done yet? If not, loop.
nop
HALT:
j HALT ;halt the CPU - we're done
nop
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MyFont:
.ifdef buildn64
.incbin "\ResN64\ChibiAkumas.fnt"
.endif
.ifdef buildPSX
.incbin "\ResPSX\ChibiAkumas.fnt"
.endif
.include "\SrcALL\graphics.asm"
.include "..\\SrcAll\monitor.asm"
.include "\SrcN64\Footer.asm"