rdos/lisp/cons.asm

33 lines
491 B
NASM
Raw Normal View History

; 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