#separator:tab
#html:true
#notetype:Basic
#tags column:3
#deck:cracked.guide::TAOCP Vol 1::1.4.1 Subroutines
#columns:Front	Back	Tags
TAOCP §1.4.1 Subroutines: what does it cover?	How to package code as a subroutine in MIX: linkage, passing parameters, returning, and the trade-offs between in-line code and calls. MIX has no stack or call instruction in the modern sense, so you see the mechanics explicitly.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.4.1 cracked.guide::kind::about
TAOCP §1.4.1: why does it matter?	Calling conventions are still the glue of every compiled program. Seeing them built by hand makes stack frames, return addresses and ABIs make sense, and connects back to the call frames you built in clox.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.4.1 cracked.guide::kind::why
TAOCP §1.4.1, a common trap: “Self-modifying return jumps are normal in MIX.” What's the catch?	Do not let that surprise you; it is a product of the era.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.4.1 cracked.guide::kind::trap
TAOCP §1.4.1, exercise 1 (rated 10): what is it asking?	Write out the interface description for one of the text's subroutines.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.4.1 cracked.guide::kind::exercise
TAOCP §1.4.1, exercise 2 (rated 10): what is it asking?	Replace a JSJ-based calling sequence with ordinary jumps.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.4.1 cracked.guide::kind::exercise
TAOCP §1.4.1, exercise 4 (rated 21, recommended): what is it asking?	Generalize the max subroutine to a strided range with extra parameters.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.4.1 cracked.guide::kind::exercise
TAOCP §1.4.1, exercise 5 (rated 21): what is it asking?	Invent subroutine linkage for a MIX without rJ.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.4.1 cracked.guide::kind::exercise
TAOCP §1.4.1, exercise 6 (rated 26, recommended): what is it asking?	Write a subroutine that mimics the MOVE instruction, with its parameters stored right after the call.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.4.1 cracked.guide::kind::exercise
TAOCP §1.4.1, exercise 7 (rated 20, recommended): what is it asking?	Explain why self-modifying code fell out of favor.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.4.1 cracked.guide::kind::exercise
TAOCP §1.4.1: how many exercises, and how are they rated?	7 exercises, rated 10 to 26.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.4.1 cracked.guide::kind::exercises
TAOCP §1.4.1: what should you be comfortable with first?	<ul><li>1.3.2 The MIX Assembly Language</li></ul>	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.4.1 cracked.guide::kind::prereqs
TAOCP §1.4.1: how should you work through it?	Write a MIX subroutine and call it from two places. Then compare the linkage mechanism to how clox pushes CallFrames.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.4.1 cracked.guide::kind::approach
