Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > decimal to hex convert and REL format
2010-12-04 19:02
Erhan

Registered: Feb 2005
Posts: 17
decimal to hex convert and REL format

Hi,
i have two questions for coding here..

1) in memory, two bytes exists in this format: e.g. 04 and 50 repeatedly, but equals to 450 in decimal format and i need to convert them to 2 byte hexadecimal,
result will be $01C2 what is the shortest way? (i think @codebase, no similar examples)

2) in a diskfile, an existing data file's length is $20 bytes for example, i need to write $08 bytes to specific location in that file. (file format should be REL?)
and i need save routine for this,

Thanks
 
... 10 posts hidden. Click here to view all posts....
 
2010-12-06 18:31
Fungus

Registered: Sep 2002
Posts: 686
The drive is going to have to do a block read and block write anyways, so you may as well just use a prg or seq or even a usr file to do it. it won't be any faster or be less code to handle it with a rel file.

If you want to, you can just use the disk buffer and b-p command if you only need to read/write specific bytes at a specific offset in the block, ie, there is only ONE high score per level.

Of course it depends on how many levels you have, and how many records you need.

If it is how I think it is, you just need to use a few dos commands in order to handle it. listen, second, unlsn for writing the bytes to the buffer, and talk, tksa, and untalk for reading them. as well as acptr/getin, ciout/chrout for the actual data transferring... but you probly know how to do all that so I'm just being long winded now...
Previous - 1 | 2 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
t0m3000/hf^boom!^ibx
iAN CooG/HVSC
tlr
iceout/Avatar/HF
Alakran_64
Peacemaker/CENSOR/Hi..
The Syndrom/TIA/Pret..
MWR/Visdom
Mike
wil
Acidchild/Padua
Darkflight
tokra/Akronyme Analo..
Guests online: 122
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Censor Design  (9.3)
5 Triad  (9.3)
Top Diskmag Editors
1 Magic  (9.8)
2 hedning  (9.6)
3 Jazzcat  (9.5)
4 Elwix  (9.1)
5 Remix  (9.1)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.031 sec.