Переходим на Би
2025-04-18 10:57![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Переписал некоторые функции рантайм библиотеки с ассемблера на Би. К примеру, было:
Стало:writeb: ,name, 12 ,base,* c c Append one byte to output buffer. c b/output:lc,block, w_count, b_shift, buffer(22) c flush: ,subp, ,aax, =377 ,aex, =12 . compare to linefeed ,uza, flush ,aex, =12 c ,utc, w_count ,xts, ,aex, =26 . 22 words ,u1a, putchar ,ita, 13 ,its, ,call, flush ,sti, ,ati, 13 c putchar: ,bss, . append byte to buffer ,sti, 11 ,vtm, b/output 11 ,wtc, 1 . b_shift ,asn, 64-40 . shift left 11 ,wtc, 0 . w_count 11 ,aox, 2 . read word from buffer 11 ,wtc, 0 . w_count 11 ,atx, 2 . write word to buffer c 11 ,xta, 1 . b_shift ,aex, =50 ,uza, next_w ,aex, =50 ,arx, =10 . increase shift 11 ,atx, 1 . b_shift 13 ,uj, c next_w: ,bss, . advance to next word 11 ,atx, 1 . clear b_shift 11 ,xta, 0 . w_count ,arx, =1 . increment word count 11 ,atx, 0 . w_count 13 ,uj, ,end,
Так ведь понятнее выходит, правда?/* * Append one byte to output buffer. */ writeb(b) { extrn out_cnt, out_shft, out_buff; auto p; b = b & 0377; if (b == '*n') { flush(); return; } if (out_cnt == 22) { flush(); } p = &out_buff[out_cnt]; *p = *p | (b << (40 - out_shft)); if (out_shft == 40) { /* next word */ out_shft = 0; ++out_cnt; } else { /* next byte */ out_shft = out_shft + 8; } } out_cnt; out_shft; out_buff[22];
no subject
Date: 2025-04-18 19:36 (UTC)no subject
Date: 2025-04-18 19:43 (UTC)no subject
Date: 2025-04-18 19:47 (UTC)Сначала им не нравится ассемблер, потом Би, потом Си, а потом разврат, содомия, Джава и 32Г памяти - это только что-б система нормально стартанула. :))
no subject
Date: 2025-04-18 23:34 (UTC)no subject
Date: 2025-04-19 13:42 (UTC)no subject
Date: 2025-04-19 04:47 (UTC)no subject
Date: 2025-04-19 05:26 (UTC)Мониторка вся построена вокруг динамического загрузчика.
Ни в CP/M, ни в других местах такого отродясь не водилось.
no subject
Date: 2025-04-19 05:42 (UTC)