From c73127a6341da1cb9074c0c3573033a94fb8ab09 Mon Sep 17 00:00:00 2001 From: Hexa Dust Date: Thu, 23 Oct 2025 21:59:33 +0100 Subject: [PATCH] output binary for file output --- README.md | 2 +- compute.obm | Bin 0 -> 512 bytes cpm.obm | Bin 0 -> 512 bytes oled-to-hex | 15 +++++++++++---- toghxd.obm | Bin 0 -> 512 bytes toghxdgr.obm | Bin 0 -> 512 bytes zilog.obm | Bin 0 -> 512 bytes 7 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 compute.obm create mode 100644 cpm.obm create mode 100644 toghxd.obm create mode 100644 toghxdgr.obm create mode 100644 zilog.obm diff --git a/README.md b/README.md index 5bfc2d4..8007eef 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # RC2014 - Quazar OLED board -This project provides MACRO-80 assembler code for `oled` program to drive OLED display for RC2014 by Quazar. It provides a Rust "script" to convert 128x32 black and white image to hex output suitable for the `oled` program. +This project provides MACRO-80 assembler code for `oled` program for CP/M to drive OLED display for RC2014 by Quazar. It provides a Rust "script" to convert 128x32 black and white image to hex output suitable for the `oled` program. ## Compiling diff --git a/compute.obm b/compute.obm new file mode 100644 index 0000000000000000000000000000000000000000..ca0b99fe077d63e19781876605537e88900a26c2 GIT binary patch literal 512 zcmaJ-ze~eV5I(EL(nXhyr6sFF|AiDQZ#0EG;-KVTaB&lI#6=?LzwmfdxPm%5iHkVe zf+1tmwNnK{9MV2tv`+nTACH6Y-gn>KDYYEwpk={d{O2t&pc+(zj>%0{VcYB~x$_SE z2c_Y+y>@et?XpA72T8!fM%{p&MTau&Lr?2FV2Rm$*=_|hFTSTO0K`%aV1r%bA{Ik* z=uDhPv*#k>5wA3_$8wC#)|I2@I@eXld@iI~(xQ63GY8;pvxYiqWn$!faY>y7>==14q*U literal 0 HcmV?d00001 diff --git a/cpm.obm b/cpm.obm new file mode 100644 index 0000000000000000000000000000000000000000..57aacbbb5092ebc514a2646a043eec07affffc44 GIT binary patch literal 512 zcmZusF>b;@5IjK<2MT{7a)V?f^Mm9oCtqO%QofKAO;%2EUm&4~vqfn0ggoOg4Y)`_ zwX!V8o_&x+%IHQrvmR^iK#K^(FKQiu)(f!qKtv5SO~dnG?J|ObRfn3WuBkqhpNk&n zEqkJmplD|s(L#Xj!Y-TVh=Bhvh+`NGBFG0l$a~C11b95P2>U|o<@1wSPmBo@z;1oo zZ#Mh=)| Result<(), Box> { @@ -23,11 +24,11 @@ fn main() -> Result<(), Box> { ErrorKind::NotFound, "expected PNG 128x32 file path", ))?; - println!("Loading {}", file); + eprintln!("Loading {}", file); let img = ImageReader::open(file)?.decode()?; let (w, h) = img.dimensions(); - println!("Loaded file {}x{}", w, h); + eprintln!("Loaded file {}x{}", w, h); if w != 128 && h != 32 { return Err(Into::into(IoError::new( ErrorKind::InvalidData, @@ -35,6 +36,8 @@ fn main() -> Result<(), Box> { ))); } + let out_hex = atty::is(atty::Stream::Stdout); + for row in 0..4 { for column in 0..128 { let mut byte = 0u8; @@ -48,7 +51,11 @@ fn main() -> Result<(), Box> { byte = byte | 128; } } - print!("{:02X}", byte); + if out_hex { + print!("{:02X}", byte); + } else { + stdout().write(&[byte]).unwrap(); + } } } diff --git a/toghxd.obm b/toghxd.obm new file mode 100644 index 0000000000000000000000000000000000000000..3dd4d72562aee57a12cce9ba61209242522219af GIT binary patch literal 512 zcmZ8d!41S945Q+~uN{F=veIpkj&@QPsniATNmT^rB$RUJ2X*YkG*tRW1(+xbh*(O1 zAE|5R+^6PPG0@u`40Vawq>=?rpsZB#;2$j#*t9^IoZC~*MZ3#yXsaZ_S+-Kh$L4)l zh?d~}c0f==l2h7|9D2|_AwpVFMf@Oh1Y7r--uNPiUjV4(Xsr7Mrt`<3W~NsV4-3((>7YS*ZXx76M*2LxJ& literal 0 HcmV?d00001 diff --git a/toghxdgr.obm b/toghxdgr.obm new file mode 100644 index 0000000000000000000000000000000000000000..5953728ba7a24c703536e7308f9f5d576f873bf6 GIT binary patch literal 512 zcmZ`$v1-FG5LK%|qX`|d$3vlC(IFvUAa3+ebhn^G4H^6o?j{fZglh1RHG{}%+9hPF zp$0=~)hEkwlA$^tdUr^AcTZaC5cW95)@qrdnxV3_?>4gw1(VpnTamzqi{9TxTt>8}6zb@{;K6LO?ob>%I zuM7AWO6WK3=a-tPx@nsy^x{tle#bc%5orH-Zeh~*F8Fg{_QcbJ)tJ4oN9WR9KBOph z#uodReFZwr5AKMsIpFoR_hI*eJE{9_O+D%}^uv^CP>*i@(WeSAdM~{X73Pd-6THVC m#3bk*h>4%)N6snue@kM`C0p@1UqSb@3o#c1;J}5p@8S=b#p3$_ literal 0 HcmV?d00001 diff --git a/zilog.obm b/zilog.obm new file mode 100644 index 0000000000000000000000000000000000000000..67fc6acde397039531c8bd6122a637011039b4b6 GIT binary patch literal 512 zcmZ`#L2AP=5Zu%)dnu?7Fx{V2fxe-C$su4FH}se%_$gKBA>T0M0~>TPL|7f!4smHa z0?9KwJG+>O$oZ~Q?fdQHJ(Xqbd)3Z66lS3Q#~B@2CtBzF)jht>1IsS3(Y4e%zeaBy zQmUBigV$KusOsy2C8ZQ~io7dkG|d-qIt3tAl@+3J2^XR_xYKREMo`1owg4tZaEI5d z<&cb~$So_2Br9SJ9}oTJTr(RH$*P$mHO681Y}@_*18ABWa1%U2F?gImOL*F>;tx*P z37B?@yWKhWo