Skip to content

Instantly share code, notes, and snippets.

@letoh
Created April 19, 2013 14:30
Show Gist options
  • Select an option

  • Save letoh/5420718 to your computer and use it in GitHub Desktop.

Select an option

Save letoh/5420718 to your computer and use it in GitHub Desktop.
;;
;; ( f -- ) _if <then_label>
;; do something
;; then_label:
;;
%macro _if 1
cell _0branch
dd %1-%%_offset
%%_offset:
%endmacro
;;
;; begin_label:
;; do something
;; _again <begin_label>
;;
%macro _again 1
cell _branch
dd %1-%%_offset
%%_offset:
%endmacro
;;
;; begin_label:
;; do something
;; ( f -- ) _until <begin_label>
;;
%macro _until 1
cell _0branch
dd %1-%%_offset
%%_offset:
%endmacro
;;
;; _if <else_label>
;; do something
;; _else <then_label>
;; else_label
;; do something
;; then_label:
;;
%macro _else 1
cell _branch
dd %1-%%_offset
%%_offset:
%endmacro
colon _refill ; REFILL ( -- f )
cell _true
cell _dup, _source_id, _equals
_if .else
cell _invert
_else .then
.else:
; tib inbufmax accept ( -- n )
cell _tib
lit inbufmax
cell _accept
; #tib !
cell _number_tib, _store
; >in off
cell _to_in, _off
.then:
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment