Skip to content

Commit 367572b

Browse files
committed
Save one byte
1 parent caecfc9 commit 367572b

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ Git or GitHub's web interface. This disparity is handled by two Python scripts:
192192

193193
## Free bytes
194194

195-
At this moment, not counting the `55 AA` signature at the end, **445** bytes are used,
196-
leaving 1 byte for any potential improvements.
195+
At this moment, not counting the `55 AA` signature at the end, **444** bytes are used,
196+
leaving 2 bytes for any potential improvements.
197197

198198
Byte saving leaderboard:
199199
- Ilya Kurdyukov saved 24 bytes. Thanks!

boot.s

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
; SP = parameter stack pointer (grows downwards from 0x7c00 - just before the entrypoint)
33
; DI = return stack pointer (grows upwards from 0xc00)
44
; SI = execution pointer
5-
; BX = top of stack
5+
; BX = value at the top of the parameter stack (which is not saved in memory when executing
6+
; threaded code)
67
;
78
; Dictionary structure:
89
; link: dw
@@ -163,17 +164,16 @@ LATEST equ $+1
163164
or si, si
164165
jnz short .find
165166

166-
; It's a number. Push its value - we'll pop it later if it turns out we need to compile
167-
; it instead.
168-
push bx
167+
; It's a number. Which mode are we in?
168+
169169
; At this point, AH is zero, since it contains the higher half of the pointer
170170
; to the next word, which we know is NULL.
171171
cmp byte[byte bp-BP_POS+STATE], ah
172-
jnz short InterpreterLoop
172+
jnz short InterpreterLoopSaveBX
173173
; Otherwise, compile the literal.
174174
mov ax, LIT
175175
call COMMA
176-
pop ax
176+
xchg ax, bx
177177
.compile:
178178
call COMMA
179179
jmp short InterpreterLoop

0 commit comments

Comments
 (0)