Skip to main content

bf core Contentswtf?introgoalspecificationsrccompilationsorryNavigation menu

BrainfuckLanguagesCell-basedImplementedLow-level2016


brainfuckbrainfuckTotal Vacuum2016brainfuckbrainfuck










bf core



From Esolang



Jump to: navigation, search

















bf core
Paradigm(s)imperative
Designed byTotal Vacuum
Appeared in2016
Memory systemcell-based
Computational classTuring complete
Major implementationsbf core[1]
File extension(s).b




Contents



  • 1 wtf?


  • 2 intro


  • 3 goal


  • 4 specification


  • 5 src


  • 6 compilation


  • 7 sorry



wtf?


brainfuck!


intro


bf core is extremely optimized by size (69 bytes) brainfuck core implementation written in x86 asm. Coded by Total Vacuum in 2016.


goal


The goal is to create as compact as possible brainfuck core implementation for simple brainfuck to dos/winxp executable .com file compiler. Output file format:


  • core (69 bytes for current version)

  • code (passed through comment and whitespace remover)

  • space (ascii 0x20, 1 byte)

You can freely use this core in your brainfuck compiler to produce dos/winxp executable .com files, or you can generate .com file even without compiler using


copy bfcore.com+src.b dest.com 

where bfcore.com is previously compiled bf core, src.b is brainfuck source (strip comments and whitespaces first!), dest.com is destination .com file.


The next goal is to trim core size to 64 bytes. Is it possible? All ideas on core size trimming are welcome! :)


specification


  • 8-bit cells

  • 510 memory cells (+2 bytes for 30000 cells)

  • max code size is 32K

  • the only available characters are [ ] < > + - , .

  • one extra terminating space character (ascii 0x20) required (for correct program termination)

  • no newline character conversions on i/o

  • incorrect i/o when redirecting from/to file (+3 bytes to fix)

  • up to 255 nested [ ] blocks

src


 | .model tiny  ;
| .code  ;
| .startup  ;
BE 45 01 | lea si,@src  ;
D1 EF | shr di,1  ;
F3 AB | rep stosw  ;
4F | dec di  ;
2B F8 | @move: sub di,ax  ; </>
3D | db 3Dh  ;
28 05 | @add: sub [di],al  ; +/-
AC | @next: lodsb  ;
98 | cbw  ;
2C 5B | sub al,'['  ;
E3 07 | jcxz @true  ;
7C F8 | jl @next  ;
48 | @inccx: dec ax  ; [/]
2A C8 | sub cl,al  ;
EB F3 | jmp @next  ;
7C 0C | @true: jl @ptr  ;
7F 06 | jg @end  ;
3A 05 | cmp al,[di]  ; [
74 F3 | je @inccx  ;
56 | push si  ;
3D | db 3Dh  ;
5E | @end: pop si  ; ]
4E | dec si  ;
EB E5 | jmp @next  ;
2C E1 | @ptr: sub al,'<'-'['  ;
48 | dec ax  ;
73 DB | jnc @move  ;
2C EE | @last: sub al,'+'-'<'-1  ; +/,/-/.
3C 03 | cmp al,3  ;
74 08 | je @putc  ;
73 0A | jnc @exit  ;
48 | dec ax  ;
75 D3 | jnz @add  ;
B4 08 | @getc: mov ah,8  ; ,
3D | db 3Dh  ;
B4 02 | @putc: mov ah,2  ; .
8A 15 | mov dl,[di]  ;
CD 21 | @exit: int 21h  ;
88 05 | mov [di],al  ;
EB C8 | jmp @next  ;
| @src:  ;db "++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++. ";Hello World!
| end  ;

compilation


Compile with:


tasm.exe /m9
tlink.exe /t /x

sorry


Sorry for my English :)







Retrieved from "https://esolangs.org/w/index.php?title=Bf_core&oldid=62157"





Navigation menu






















(window.RLQ=window.RLQ||[]).push(function()mw.config.set("wgPageParseReport":"limitreport":"cputime":"0.028","walltime":"0.031","ppvisitednodes":"value":94,"limit":1000000,"ppgeneratednodes":"value":471,"limit":1000000,"postexpandincludesize":"value":1552,"limit":2097152,"templateargumentsize":"value":327,"limit":2097152,"expansiondepth":"value":4,"limit":40,"expensivefunctioncount":"value":0,"limit":100,"timingprofile":["100.00% 9.365 1 -total"," 54.09% 5.066 1 Template:Infobox_proglang"," 44.15% 4.135 1 Template:Lowercase"],"cachereport":"timestamp":"20190803220205","ttl":86400,"transientcontent":false););(window.RLQ=window.RLQ||[]).push(function()mw.config.set("wgBackendResponseTime":111););

Popular posts from this blog

Sahara Skak | Bilen | Luke uk diar | NawigatsjuunCommonskategorii: SaharaWikivoyage raisfeerer: Sahara26° N, 13° O

The fall designs the understood secretary. Looking glass Science Shock Discovery Hot Everybody Loves Raymond Smile 곳 서비스 성실하다 Defas Kaloolon Definition: To combine or impregnate with sulphur or any of its compounds as to sulphurize caoutchouc in vulcanizing Flame colored Reason Useful Thin Help 갖다 유명하다 낙엽 장례식 Country Iron Definition: A fencer a gladiator one who exhibits his skill in the use of the sword Definition: The American black throated bunting Spiza Americana Nostalgic Needy Method to my madness 시키다 평가되다 전부 소설가 우아하다 Argument Tin Feeling Representative Gym Music Gaur Chicken 일쑤 코치 편 학생증 The harbor values the sugar. Vasagle Yammoe Enstatite Definition: Capable of being limited Road Neighborly Five Refer Built Kangaroo 비비다 Degree Release Bargain Horse 하루 형님 유교 석 동부 괴롭히다 경제력

19. јануар Садржај Догађаји Рођења Смрти Празници и дани сећања Види још Референце Мени за навигацијуу