spinix-hive/vga512/exit.spin

35 lines
1.1 KiB
Plaintext

obj
sys : "sysdefs"
dat
run_prog
long $a0bc65f0, $08bc6e32, $80fc6404, $08bc7032, $80fc6404, $08bc6032
long $80fc6404, $08bc6232, $80fc63ff, $28fc6209, $08fc6600, $00fc6804
long $083c6029, $083c5c2a, $083c582b, $08bc642b, $863c642c, $5c68000f
long $80fc6001, $80fc5d00, $80fc5d00, $e4fc620c, $087c6600, $007c6804
long $04fc6a08, $04fc6c0a, $a0bc6236, $84bc6235, $28fc6202, $083c5a35
long $80fc6a04, $e4fc621d, $083c5a36, $80fc6c04, $083c6e36, $80fc6c04
long $083c7036, $0cfc6401, $60fc6407, $68bc5e32, $0c7c5e02, $00007fd8
long $00007fdc, $00007fd4, $00000072, $00000000, $00000000, $0007c010
arg_list long 0[4]
pub exit(retval) | i, cogspi
cogspi := long[sys#SPI_engine_cog] - 1
arg_list[2] := long[sys#shell_sector]
arg_list[3] := long[sys#shell_size]
long[sys#return_value] := retval
' Stop all the cogs except this one and the SD SPI cog
repeat i from 0 to 7
if (i <> cogid and i <> cogspi)
cogstop(i)
' Clear and return all the locks
repeat i from 0 to 7
lockclr(i)
lockret(i)
' Start run_prog in this cog
coginit(cogid, @run_prog, @arg_list)