rdos/lisp/cons.asm
2019-03-23 20:13:05 +00:00

33 lines
491 B
NASM
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

; All ptrs in ds segment, pointing to a node as returned by malloc
; in ax ptr car
; bx ptr cdr
; out di ptr con
cons:
push cx ; length for malloc
push dx
mov cx,4
mov dl,0x01 ; type for cons
call malloc
pop dx
pop cx
mov word [di+0x04],ax
mov word [di+0x06],bx
ret
; in ax ptr con
; out di ptr car
car:
mov si,ax
; TODO: type check
mov di,[si+0x04]
ret
; in ax ptr con
; out di ptr cdr
cdr:
mov si,ax
; TODO: type check
mov di,[si+0x06]
ret