100 doors/8086 Assembly: Difference between revisions

m
Fixed syntax highlighting.
(two less instructions)
m (Fixed syntax highlighting.)
 
Line 4:
 
This example is 51 bytes big when assembled, it is fully commented, and it isn't optimized. The doors are represented in RAM by 100 bytes, which can have value 00 if the door is closed, FF is the door is opened. This example is designed to be run on any 8086 based computer, and it requires to be loaded in RAM, with 100 bytes available to it after the code, to be used for door storing. See the program comments for further explaining.
<langsyntaxhighlight lang="asm">; ** Initialize
; Open all the doors.
; The first pass in toggling the doors starts
Line 88:
doors: ; Pointer to the end of the program,
;where the RAM space is free to keep the
;100 doors bytes.</langsyntaxhighlight>
'''optimized'''
 
This example is 42 bytes big when assembled, it is fully commented, and it is optimized. See the unoptimized program's notes and the program comments for further explaining.
<langsyntaxhighlight lang="asm">; ** Initialize
; Close all the doors.
 
Line 167:
doors: ; Pointer to the end of the program,
;where the RAM space is free to keep the
;100 doors bytes.</langsyntaxhighlight>
The program could be written scrapping the init code and adding the initialized bytes directly in the source code, after the "doors" pointer, but the initialization code takes less space than 100 $FF bytes.
9,476

edits