diff --git a/README.markdown b/README.markdown index 3682d07..1d8a63a 100644 --- a/README.markdown +++ b/README.markdown @@ -119,5 +119,5 @@ TODO * comments in any spaces; forget the eol thing * `outputs` on externals * Routine is a kind of StorageLocation? (Location)? -* remove DELTA -> ADD +* remove DELTA -> ADD/SUB (requires carry be notated on ADD and SUB though) * Poisoning the highbyte or lowbyte of a word should poison the word diff --git a/doc/Analyzing.markdown b/doc/Analyzing.markdown index 14d4afc..7f9d2f7 100644 --- a/doc/Analyzing.markdown +++ b/doc/Analyzing.markdown @@ -98,3 +98,32 @@ modifying score, as an "output" of the routine. = update_score ([NamedLocation Nothing "score"]) = A: UpdatedWith (Immediate 8) = NamedLocation (Just Byte) "score": UpdatedWith A + +Routines can name registers as outputs. + + | reserve byte score + | routine update_score + | { + | lda #8 + | } + | routine main { + | jsr update_score + | sta score + | } + ? routine does not preserve 'A' + + | reserve byte score + | routine update_score outputs (.a) + | { + | lda #8 + | } + | routine main { + | jsr update_score + | sta score + | } + = main ([]) + = A: UpdatedWith (Immediate 8) + = NamedLocation (Just Byte) "score": UpdatedWith A + = + = update_score ([A]) + = A: UpdatedWith (Immediate 8)