1 # pcboot - bootable PC demo/game kernel
2 # Copyright (C) 2018-2019 John Tsiombikas <nuclear@member.fsf.org>
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <https://www.gnu.org/licenses/>.
18 .section .startup,"ax"
28 # move the stack to the top of the conventional memory
31 # push a 0 ret-addr to terminate gdb backtraces
34 # zero the BSS section
45 # pcboot_main never returns
50 # this is called once after memory init, to move the protected mode
51 # stack to the top of usable memory, to avoid interference from 16bit
52 # programs (as much as possible)
55 # calculate the currently used lowest address of the stack (rounded
56 # down to 4-byte alignment), to see where to start copying
59 # calculate the size we need to copy
62 # load the destination address to edi
68 # change esp to the new stack
118 # calc src scanline address -> ebx
124 mov (%ebp, %ebx), %cl
139 # calc src x offset -> eax
145 mov (%ebp, %eax), %cl
156 mov (%ebx, %esi), %al
173 # check for escape keypress