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: 749
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
Alakran_64
Iapetus/Algar../Cosine
Mason/Unicess
tw1l1ght
hedning/G★P
GuyGavin/HF
void256
JEZ
iceout/Avatar/HF
CA$H/TRiAD
theK/ATL
Guests online: 136
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Codeboys & Endians  (9.7)
4 Mojo  (9.6)
5 Coma Light 13  (9.6)
6 Edge of Disgrace  (9.6)
7 Signal Carnival  (9.6)
8 Wonderland XIV  (9.5)
9 Uncensored  (9.5)
10 Comaland 100%  (9.5)
Top onefile Demos
1 Nine  (9.7)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.5)
6 Scan and Spin  (9.5)
7 Onscreen 5k  (9.5)
8 Grey  (9.5)
9 Dawnfall V1.1  (9.5)
10 Rainbow Connection  (9.5)
Top Groups
1 Artline Designs  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Performers  (9.3)
5 Censor Design  (9.3)
Top Logo Graphicians
1 t0m3000  (10)
2 Sander  (9.8)
3 Shine  (9.5)
4 Mermaid  (9.5)
5 Pal  (9.4)

Home - Disclaimer
Copyright © No Name 2001-2025
Page generated in: 0.156 sec.