; ---
begin:
; get a command from the user
; do what it says
; is it an exit command?
cmp al, 'X'
je exit
jmp begin
exit:
; print "press any key to reboot"?
int 19h
You can include macros to give you stuff like "for", but the underlying instructions are "jmp", unconditional, and conditional jumps collectively known as "jcc". There's "je", jump if equal, "jne", jump if not equal, jg, jump if greater... like that.
If it's going to "act like an OS", it has to do a bit more than get commands from the user, of course, but that's the idea. When you get to the end, go back and do it again... or whatever you want it to do until it's turned off.
Best,
Frank