Browse Source

Refine comments and .type directives

Hikaru Ikuta 3 years ago
parent
commit
97531f6cb7
1 changed files with 12 additions and 10 deletions
  1. 12 10
      sectorlisp.S

+ 12 - 10
sectorlisp.S

@@ -28,10 +28,10 @@ _start:	.asciz	"NIL"				# dec %si ; dec %cx ; dec %sp
 kT:	.asciz	"T"				# add %dl,(%si) boot A:\ DL=0
 kT:	.asciz	"T"				# add %dl,(%si) boot A:\ DL=0
 start:	ljmp	$0x7c00>>4,$begin		# cs = 0x7c00 is boot address
 start:	ljmp	$0x7c00>>4,$begin		# cs = 0x7c00 is boot address
 	.asciz	""				# interned strings
 	.asciz	""				# interned strings
-kRead:	.asciz	"READ"				# builtin for eval
-kPrint:	.asciz	"PRINT"				# builtin for eval
 kQuote:	.asciz	"QUOTE"				# builtin for eval
 kQuote:	.asciz	"QUOTE"				# builtin for eval
 kCond:	.asciz	"COND"				# builtin for eval
 kCond:	.asciz	"COND"				# builtin for eval
+kRead:	.asciz	"READ"				# builtin to apply
+kPrint:	.asciz	"PRINT"				# builtin to apply
 kCar:	.asciz	"CAR"				# builtin to apply
 kCar:	.asciz	"CAR"				# builtin to apply
 kCdr:	.asciz	"CDR"				# ordering matters
 kCdr:	.asciz	"CDR"				# ordering matters
 kCons:	.asciz	"CONS"				# must be 3rd last
 kCons:	.asciz	"CONS"				# must be 3rd last
@@ -54,7 +54,7 @@ begin:	mov	$0x8000,%sp			# uses higher address as stack
 	mov	$2,%bx
 	mov	$2,%bx
 main:	mov	%sp,%cx
 main:	mov	%sp,%cx
 	mov	$'\r',%al
 	mov	$'\r',%al
-	call	PutChar
+	call	PutChar				# call first to initialize %dx
 	call	Read
 	call	Read
 	call	Eval
 	call	Eval
 	xchg	%si,%ax
 	xchg	%si,%ax
@@ -94,9 +94,9 @@ GetToken:					# GetToken():al, dl is g_look
 4:	mov	$')',%al
 4:	mov	$')',%al
 	jmp	PutChar
 	jmp	PutChar
 
 
-Print:	xchg	%di,%si
+Print:	xchg	%di,%si				# Print(x:si)
 	test	%di,%di
 	test	%di,%di
-	jnz	PrintObject
+	jnz	PrintObject			# print newline for empty args
 	mov	$'\r',%al
 	mov	$'\r',%al
 .PutObject:					# .PutObject(c:al,x:si)
 .PutObject:					# .PutObject(c:al,x:si)
 .PrintString:					# nul-terminated in si
 .PrintString:					# nul-terminated in si
@@ -110,8 +110,10 @@ PrintObject:					# PrintObject(x:si)
 	jnz	.PrintString			# -> ret
 	jnz	.PrintString			# -> ret
 	ret
 	ret
 
 
-Read:	mov	%bp,%dx				# Get cached character
+Read:	mov	%bp,%dx				# get cached character
 	call	GetToken
 	call	GetToken
+#	jmp	GetObject
+
 GetObject:					# called just after GetToken
 GetObject:					# called just after GetToken
 	cmp	$'(',%al
 	cmp	$'(',%al
 	je	GetList
 	je	GetList
@@ -141,7 +143,7 @@ Intern:	push	%cx				# Intern(cx,di): ax
 
 
 GetChar:xor	%ax,%ax				# GetChar→al:dl
 GetChar:xor	%ax,%ax				# GetChar→al:dl
 	int	$0x16				# get keystroke
 	int	$0x16				# get keystroke
-	mov	%ax,%bp				# Used for READ
+	mov	%ax,%bp				# used for READ
 PutChar:mov	$0x0e,%ah			# prints CP-437
 PutChar:mov	$0x0e,%ah			# prints CP-437
 	int	$0x10				# vidya service
 	int	$0x10				# vidya service
 	cmp	$'\r',%al			# don't clobber
 	cmp	$'\r',%al			# don't clobber
@@ -245,7 +247,7 @@ Assoc:	mov	%dx,%si				# Assoc(x:ax,y:dx):ax
 	mov	(%bx,%si),%si
 	mov	(%bx,%si),%si
 	scasw
 	scasw
 	jne	1b
 	jne	1b
-	.byte	0xA9				# shifted ip;  read as test, cmp
+	.byte	0xA9				# shifted ip; reads as test, cmp
 Cadr:	mov	(%bx,%di),%di			# contents of decrement register
 Cadr:	mov	(%bx,%di),%di			# contents of decrement register
 	.byte	0x3C				# cmp §scasw,%al (nop next byte)
 	.byte	0x3C				# cmp §scasw,%al (nop next byte)
 Cdr:	scasw					# increments our data index by 2
 Cdr:	scasw					# increments our data index by 2
@@ -297,10 +299,10 @@ Eval:	test	%ax,%ax				# Eval(e:ax,a:dx):ax
 1:	.ascii	" SECTORLISP v2 "
 1:	.ascii	" SECTORLISP v2 "
 	.word	0xAA55
 	.word	0xAA55
 2:	.type	.sig,@object
 2:	.type	.sig,@object
-	.type	kRead,@object
-	.type	kPrint,@object
 	.type	kQuote,@object
 	.type	kQuote,@object
 	.type	kCond,@object
 	.type	kCond,@object
+	.type	kRead,@object
+	.type	kPrint,@object
 	.type	kAtom,@object
 	.type	kAtom,@object
 	.type	kCar,@object
 	.type	kCar,@object
 	.type	kCdr,@object
 	.type	kCdr,@object