macos: don't use a NASM label named loop, don't use syntax for strings with C-style escapes

This commit is contained in:
Georges Dupéron 2018-07-11 19:10:57 +02:00
parent 79fd39e7cb
commit 229e259fe4

View File

@ -1,9 +1,9 @@
[BITS 16] [BITS 16]
[ORG 0x7c00] [ORG 0x7c00]
db `#!/usr/bin/env sh\n` db "#!/usr/bin/env sh", 0x0a
db `: <<'EOF'\n` db ": <<'EOF'", 0x0a
db `GOTO msdos\n` db "GOTO msdos", 0x0a
;;; The #!… above is interpreted as … jnz short 0x7c78 in x86 assembly. ;;; The #!… above is interpreted as … jnz short 0x7c78 in x86 assembly.
times 0x7c78-0x7c00-($-$$) db 0 times 0x7c78-0x7c00-($-$$) db 0
@ -23,25 +23,25 @@ xor bl, bl
xor di,di xor di,di
;;; Store pixels, display something flashy. ;;; Store pixels, display something flashy.
loop: pixel_loop:
mov byte [fs:di], bl mov byte [fs:di], bl
inc bl inc bl
inc di inc di
cmp bl, 255 cmp bl, 255
je endline je endline
jmp loop jmp pixel_loop
endline: endline:
add di, 65 add di, 65
xor bl, bl xor bl, bl
mov ax, di mov ax, di
cmp ax, (320*200) cmp ax, (320*200)
je end je infinite_loop
jmp loop jmp pixel_loop
;;; Infinite loop ;;; For now, hang until the computer is rebooted.
end: infinite_loop:
jmp end jmp infinite_loop
;;; Fill the remaining bytes with 0 and write a partition table ;;; Fill the remaining bytes with 0 and write a partition table
times 0x1b8-($-$$) db 0 times 0x1b8-($-$$) db 0
@ -67,23 +67,23 @@ db 0x55, 0xaa ;; 0x1fe End the bootsector with 55 AA, which is the MBR signatur
times (34*512)-($-$$) db 0 times (34*512)-($-$$) db 0
;;; After the bootsector, close the sh here-document skipped via : <<'EOF' ;;; After the bootsector, close the sh here-document skipped via : <<'EOF'
db `\n` db 0x0a
db `EOF\n` db "EOF", 0x0a
db `echo Hello world by the OS, from sh!\n` db "echo Hello world by the OS, from sh!", 0x0a
db `while sleep 10; do :; done\n` db "while sleep 10; do :; done", 0x0a
db `exit\n` db "exit", 0x0a
;;; for good measure: go into an infinite loop if the exit did not happen. ;;; for good measure: go into an infinite loop if the exit did not happen.
db `while :; do sleep 1; done\n` db "while :; do sleep 1; done", 0x0a
;;; end of the SH section, everything until this point is skipped by MS-DOS batch due to the GOTO' ;;; end of the SH section, everything until this point is skipped by MS-DOS batch due to the GOTO'
db `:msdos\n` db ":msdos", 0x0a
db `@cls\n` db "@cls", 0x0a
db `@echo Hello world by the OS, from MS-DOS!\n` db "@echo Hello world by the OS, from MS-DOS!", 0x0a
db `command.com\n` db "command.com", 0x0a
db `exit\n` db "exit", 0x0a
;;; for good measure: go into an infinite loop if the exit did not happen. ;;; for good measure: go into an infinite loop if the exit did not happen.
db `:loop\n` db ":loop", 0x0a
db `GOTO loop\n` db "GOTO loop", 0x0a
;;; Fill up to 32k with 0. This constitutes the reserved first 32k at the beginning of an ISO9660 image. ;;; Fill up to 32k with 0. This constitutes the reserved first 32k at the beginning of an ISO9660 image.
times (32*1024)-($-$$) db 0 times (32*1024)-($-$$) db 0