При проектировании 80286 разработчики процессоров Intel решили добавить две инструкции для поддержки отображения.
Вот микрокод внутри процессора:
; ENTER Locals, LexLevel
push bp ;Save dynamic link.
mov tempreg, sp ;Save for later.
cmp LexLevel, 0 ;Done if this is lex level zero.
je Lex0
lp:
dec LexLevel
jz Done ;Quit if at last lex level.
sub bp, 2 ;Index into display in prev act rec
push [bp] ; and push each element there.
jmp lp ;Repeat for each entry.
Done:
push tempreg ;Add entry for current lex level.
Lex0:
mov bp, tempreg ;Ptr to current act rec.
sub sp, Locals ;Allocate local storage
Альтернативой ENTER будет:
; введите n, 0; 14 циклов на 486
push bp ;1 cycle on the 486
sub sp, n ;1 cycle on the 486
; введите n, 1; 17 циклов на 486
push bp ;1 cycle on the 486
push [bp-2] ;4 cycles on the 486
mov bp, sp ;1 cycle on the 486
add bp, 2 ;1 cycle on the 486
sub sp, n ;1 cycle on the 486
; введите n, 3; 23 цикла на 486
push bp ;1 cycle on the 486
push [bp-2] ;4 cycles on the 486
push [bp-4] ;4 cycles on the 486
push [bp-6] ;4 cycles on the 486
mov bp, sp ;1 cycle on the 486
add bp, 6 ;1 cycle on the 486
sub sp, n ;1 cycle on the 486
ЭСТ. Долгий путь может увеличить размер файла, но он намного быстрее.
в последней заметке, программист больше не использует отображение, поскольку это было очень медленной работой, что теперь делает ENTER довольно бесполезным.
Источник: https://courses.engr.illinois.edu/ece390/books/artofasm/CH12/CH12-3.html