10 rem decimal to hex byte converter 20 rem need some data, use basicmem 30 begin=4096 40 finish=4128 50 for i=begin to finish 60 v=peek(i) 65 rem numbers start at 48=0 70 hi=int(v/16):lo=v and 15 75 rem numbers start at 48=0 80 lo$=chr$(48+lo) 90 hi$=chr$(48+hi) 100 rem chars start at 65=a 110 if lo>9 then lo$=chr$(55+lo) 120 if hi>9 then hi$=chr$(55+hi) 130 print hi$lo$+" "; 140 cols=cols+1 150 if cols=8 then gosub 200 160 next 170 goto 230 200 print ";" 210 cols=0 220 return 230 rem end
Here's the stylings:
div.commodore { border: 60px solid #0088ff; color: #0088ff; background-color: #0000aa; text-transform: uppercase; font-family: "Courier", "Courier New"; }
To tell the truth, I've already written a bunch of tiny practice programs.
- One that takes in input lines and writes them to file,
- Read lines from file
- change the cursor, border and background color - in machine language, put into memory. That was the image in the last post.
- one that tests the hires mode. Things get interesting there
and a few others. However, today I wrote something potentially useful - a bit of code that dumps an area from memory to the screen in hex. Doing that is probably going to be useful, once I get into more machine language stuff, especially as I cannot pretend to own a TASM cartridge or something.
Well.
What I wrote is a START, as, since it being a basic program, it's slow, AND unless I combine it with an interface to edit memory, it doesn't do that much - I can do poke-run loops, but that seems remarkably tedious.
An alternate way would be to translate this to ASM, then load it to an area in memory, and then activate it via SYS calls.
Still, the output looks cool.
The program dumped is, naturally, the screen-color altering one from my previous post.
A9 is a single-byte LDA, 8D is STA followed by a 2-byte little endian address, 60 is RTS.
I suppose a sys calls is basically just a JSR, then.
Still, the output looks cool.
The program dumped is, naturally, the screen-color altering one from my previous post.
A9 is a single-byte LDA, 8D is STA followed by a 2-byte little endian address, 60 is RTS.
I suppose a sys calls is basically just a JSR, then.
No comments:
Post a Comment