wlog
e = &b00000101 ' decimal 5
f = &b10000001 ' decimal 129
wlog bin$(e), bin$(f) ' output: 101 10000001
wlog e, f ' output: 5 129
wlog
wlog str$(e, "%3.0f") ' output: 5
wlog str$(f, "%3.0f") ' output: 129
wlog str$(e, "%08x") ' output: 00000000
end
' How do I get the output for e: 00000101 ?
' Can the binary value also be integrated in the str$( ) function e.g. str$(e, "%08b") ?
How simple an 8 bit output?
- cicciocb
- Site Admin
- Posts: 1966
- Joined: Mon Feb 03, 2020 1:15 pm
- Location: Toulouse
- Has thanked: 422 times
- Been thanked: 1311 times
- Contact:
Re: How simple an 8 bit output?
You can simply do
Code: [Local Link Removed for Guests]
e = &b00000101 ' decimal 5
wlog right$("00000000" + bin$(e), 8)
Re: How simple an 8 bit output?
Thank you Cicciocb for your quick response
I didn't know Annex32 Basic was so flexible.
This example was immediately included in my own translated manual in Dutch at bin$ and right$.
Tested and it works perfectly.
I started a long time ago with a ZX81 and a Commodore64 and then with Bascom AVR and also Arduino c which is too complicated for me. Then Annex32 Basic is the solution.
I didn't know Annex32 Basic was so flexible.
This example was immediately included in my own translated manual in Dutch at bin$ and right$.
Tested and it works perfectly.
I started a long time ago with a ZX81 and a Commodore64 and then with Bascom AVR and also Arduino c which is too complicated for me. Then Annex32 Basic is the solution.
- cicciocb
- Site Admin
- Posts: 1966
- Joined: Mon Feb 03, 2020 1:15 pm
- Location: Toulouse
- Has thanked: 422 times
- Been thanked: 1311 times
- Contact:
Re: How simple an 8 bit output?
Interesting, maybe if other people are interested, you could share the doc translated with other Dutch users.