summaryrefslogtreecommitdiff
path: root/bootblocks/com_bcc.s
diff options
context:
space:
mode:
authorRobert de Bath <rdebath@poboxes.com>1996-11-03 22:33:35 +0100
committerLubomir Rintel <lkundrak@v3.sk>2013-10-23 23:33:35 +0200
commitc218c617b5be443b7968308506969ad2b726d73c (patch)
tree0051f396af56133d24fcf2ab757fabc78c1a09bf /bootblocks/com_bcc.s
parent0936b9aeab611665645a4e6bafaded7ca76dd189 (diff)
parent0d2fbe9b1bd284ce2cad55be17e8f2c896031a25 (diff)
downloaddev86-c218c617b5be443b7968308506969ad2b726d73c.tar.gz
Import Dev86src-0.0.8.tar.gzv0.0.8
Diffstat (limited to 'bootblocks/com_bcc.s')
-rw-r--r--bootblocks/com_bcc.s65
1 files changed, 65 insertions, 0 deletions
diff --git a/bootblocks/com_bcc.s b/bootblocks/com_bcc.s
new file mode 100644
index 0000000..26daff3
--- /dev/null
+++ b/bootblocks/com_bcc.s
@@ -0,0 +1,65 @@
+
+! This header assumes only that we're loaded at a 16 byte boundry
+
+ENDOFF=4 ! If you add code adjust this till it stops failing.
+
+org 0
+entry start
+public start
+start:
+ call chk ! This chunk allows this code to exist at _any_ click
+chk:
+ pop ax
+ mov cl,#4
+ shr ax,cl
+ mov bx,cs
+ add ax,bx
+ push ax
+ mov bx,#going
+ push bx
+ retf
+going:
+ mov ds,ax
+
+ add ax,#ENDOFF+2 ! New CS
+ mov bx,ax ! Saved
+ mov dx,[a_entry] ! Save the entry - zero
+ mov ax,[btype]
+ and ax,#$20 ! Split I/D ?
+ jz impure
+ mov cl,#4
+ mov ax,[a_text]
+ shr ax,cl
+impure: ! ax is now offset 'tween CS&DS
+ add ax,bx ! ax = DS
+ mov ss,ax
+ mov sp,[a_total] ! SS:SP is now ready for prog.
+ mov ds,ax
+ xor cx,cx ! argc, argv and envp = 0
+ push cx
+ push cx
+ push cx
+ push bx ! CS
+ push dx ! Entry address
+ retf ! Gone.
+
+! Check for overlap
+end_of_code:
+ if end_of_code>hitme
+ fail
+ endif
+
+.org ((ENDOFF)<<4)-1
+hitme:
+.byte 0xFF ! Marker
+
+magic: .space 2 ! A.out header
+btype: .space 2
+headerlen: .space 4
+a_text: .space 4
+a_data: .space 4
+a_bss: .space 4
+a_entry: .space 4
+a_total: .space 4
+a_syms: .space 4
+.org (ENDOFF+2)<<4 ! Code start.