Jump to content
IGNORED

A minikernel that displays two sqinty little 4 digit hexadecimal numbers


bogax

Recommended Posts

A minikernel that displays two sqinty
little 4 digit hexadecimal numbers
(3 x 5 font)

The numbers are in score with aux1 as
the fourth byte/most significant byte

Uses all the temp registers except temp7
all the score pointers and all the aux variables
(but only aux1 needs to be persitent)

Takes about 380 bytes

It's not quite perfected I haven't managed
to get the horizontal postioning to work
so there's a bit of a gap in the middle
of each of the four digits.

I doubt it's much of any real use but it
could be used to display memory addresses and such
(or decimal numbers)

 

fire will scroll the digits

 

I've only tried it in Stella don't know if it would work

on the real hardware.

 

Ok, with SpiceWare's help I've fixed the gap

I'd say 'now it's perfect' except I had to
kludge it so much to get the timing right.
The code is not as pretty and there's more
asm (I was trying to keep that to an
absolute minimum)

Besides, I prefer the extra color clock gap
between the bytes for hex.

 

 

hex_minikernel_4.bas

hex_minikernel_4.bin

hex_minikernel_4_2.bas

hex_minikernel_4_2.bin

Edited by bogax
  • Like 2
Link to comment
Share on other sites

Looks fine on real hardware.

 

There's 2 problems with your horizontal alignment. First problem is HMOVE is getting hit at the wrong time. I used Stella and did a trap on HMOVE to see when HMOVE was hit:

post-3056-0-05110800-1410707981_thumb.png

 

You hit HMOVE at cycle 63. It needs to be hit at the start of a scanline, right after WSYNC. If you don't then the values in HMP0 and HMP1 will not give you the expected adjustment.

 

The second problem is the HMPx values go in the upper nybble (the left hex digit), you have them in the lower nybble(the right hex digit) of the byte.

 

I'm not familiar with doing a minikernel, but I took a look at your code and think if you change this:

  WSYNC = $00
  GRP0 = $00 : GRP1 = $00
  REFP0 = $00 : REFP1 = $00
  NUSIZ0 = $02 : NUSIZ1 = $02
  callmacro delay
  VDELP0 = $00 : VDELP1 = $00 : RESP1 = $00 : RESP0 = $00
  HMP1 = $0B : HMP0 = $08
  COLUP0 = $06 : COLUP1 = $06 : HMOVE = $06
  p3lhi = lthi : p2lhi = lthi

  WSYNC = $00

to this:

  WSYNC = $00
  GRP0 = $00 : GRP1 = $00
  REFP0 = $00 : REFP1 = $00
  NUSIZ0 = $02 : NUSIZ1 = $02
  callmacro delay
  VDELP0 = $00 : VDELP1 = $00 : RESP1 = $00 : RESP0 = $00
  HMP1 = $xx : HMP0 = $xx
  COLUP0 = $06 : COLUP1 = $06
  p3lhi = lthi : p2lhi = lthi

  WSYNC = $00 : HMOVE = $00
your problems will be fixed. I put $xx for the HMPx values as you'll have to experiment with the values to see what's right. I use these constants in my assembly code when I'm updating the HMPx registers:

HMOVE_L7          =  $70
HMOVE_L6          =  $60
HMOVE_L5          =  $50
HMOVE_L4          =  $40
HMOVE_L3          =  $30
HMOVE_L2          =  $20
HMOVE_L1          =  $10
HMOVE_0           =  $00
HMOVE_R1          =  $F0
HMOVE_R2          =  $E0
HMOVE_R3          =  $D0
HMOVE_R4          =  $C0
HMOVE_R5          =  $B0
HMOVE_R6          =  $A0
HMOVE_R7          =  $90
HMOVE_R8          =  $80
From here it looks like you can use those if you put <spaces>const in front of them:

   const HMOVE_L7          =  $70
   const HMOVE_L6          =  $60
   const HMOVE_L5          =  $50
   const HMOVE_L4          =  $40
   const HMOVE_L3          =  $30
   const HMOVE_L2          =  $20
   const HMOVE_L1          =  $10
   const HMOVE_0           =  $00
   const HMOVE_R1          =  $F0
   const HMOVE_R2          =  $E0
   const HMOVE_R3          =  $D0
   const HMOVE_R4          =  $C0
   const HMOVE_R5          =  $B0
   const HMOVE_R6          =  $A0
   const HMOVE_R7          =  $90
   const HMOVE_R8          =  $80
To use them you'd do something like this:

  HMP1 = HMOVE_0 : HMP0 = HMOVE_R1
  • Like 2
Link to comment
Share on other sites

This is 'bout it 'bout it! Straightaway I'm thinking of changing those numerals into words for an RPG menu! Hmmmn.. one of the nice things about the standard score_graphics.asm is that, if needs be, it's easy to edit the score directly from the source.

 

Is there a way the data tables could use a style like this?

 

.byte %01111110
.byte %01111110
.byte %01100110
.byte %01100110
.byte %01100110
.byte %01100110
.byte %01111110
.byte %01111110

Link to comment
Share on other sites

This is 'bout it 'bout it! Straightaway I'm thinking of changing those numerals into words for an RPG menu! Hmmmn.. one of the nice things about the standard score_graphics.asm is that, if needs be, it's easy to edit the score directly from the source.

 

Is there a way the data tables could use a style like this?

 

.byte %01111110

.byte %01111110

.byte %01100110

.byte %01100110

.byte %01100110

.byte %01100110

.byte %01111110

.byte %01111110

 

Like lots (most?) problems in programming

it's going to come down to trading off

speed for memory. (and I was trying to fit

as much as possible into bB with a minimum

of asm)

In this case speed is paramount so you're

going to be throwing lots of memory at it.

If you want the displayed text to be

changeable that means RAM.

 

So it's going to depend on exactly what you

want and how many resources you want to

devote to it.

 

For the program as it stands the gap is

built in. And it's limited to 16 characters.

 

To change either would mean major restructuring

and more memory (though not necessarily more

RAM particularly if you don't need it to be so

arbitrary/changeable, you probably won't be

scrolling through long strings of text, but

you could probably select among several fixed

strings)

 

What it boils down to is you could do a lot

better than this but if you can live with the

gap and 16 characters there's no reason you can't

change the font to something else. (and it would

probably not be to much trouble or use to much

RAM to make the font selectable but the font uses

160 bytes)

 

What exactly do you want?

 

 

As for using binary just change the font tables

hxr, hxl to binary instead of hex.

 

 

 

Link to comment
Share on other sites

Maybe I mis-read (as usual). I thought the font was stored here:

 

data hxr
$07, $02, $06, $07, $01, $07, $03, $07, $07, $07, $02, $06, $03, $06, $07, $07
$05, $06, $01, $01, $03, $04, $04, $01, $05, $05, $05, $05, $04, $05, $04, $04
$05, $02, $02, $07, $05, $06, $07, $02, $07, $07, $07, $06, $04, $05, $06, $06
$05, $02, $04, $01, $07, $01, $05, $04, $05, $01, $05, $05, $04, $05, $04, $04
$07, $07, $07, $07, $01, $06, $07, $04, $07, $06, $05, $06, $03, $06, $07, $04
end

asm
if (<*) > (<(*+$50))
repeat ($100-<*)
.byte 0
repend
endif
end

data hxl
$70, $20, $60, $70, $10, $70, $30, $70, $70, $70, $20, $60, $30, $60, $70, $70
$50, $60, $10, $10, $30, $40, $40, $10, $50, $50, $50, $50, $40, $50, $40, $40
$50, $20, $20, $70, $50, $60, $70, $20, $70, $70, $70, $60, $40, $50, $60, $60
$50, $20, $40, $10, $70, $10, $50, $40, $50, $10, $50, $50, $40, $50, $40, $40
$70, $70, $70, $70, $10, $60, $70, $40, $70, $60, $50, $60, $30, $60, $70, $40
end

 

I was hoping to edit that font 0-F to instead have 16 letters of my choosing. Static of course. Wouldn't want to change them on the fly.

 

So, instead of

 

data hxl
$70, $20, blah

 

it would look like

 

data hxl
%11100000,

%00100000,

blah

 

That's assuming you stored the font in those data statements. That's a big assumption on my part.

Link to comment
Share on other sites

Maybe I mis-read (as usual). I thought the font was stored here:

 

data hxr

$07, $02, $06, $07, $01, $07, $03, $07, $07, $07, $02, $06, $03, $06, $07, $07

$05, $06, $01, $01, $03, $04, $04, $01, $05, $05, $05, $05, $04, $05, $04, $04

$05, $02, $02, $07, $05, $06, $07, $02, $07, $07, $07, $06, $04, $05, $06, $06

$05, $02, $04, $01, $07, $01, $05, $04, $05, $01, $05, $05, $04, $05, $04, $04

$07, $07, $07, $07, $01, $06, $07, $04, $07, $06, $05, $06, $03, $06, $07, $04

end

 

asm

if (<*) > (<(*+$50))

repeat ($100-<*)

.byte 0

repend

endif

end

 

data hxl

$70, $20, $60, $70, $10, $70, $30, $70, $70, $70, $20, $60, $30, $60, $70, $70

$50, $60, $10, $10, $30, $40, $40, $10, $50, $50, $50, $50, $40, $50, $40, $40

$50, $20, $20, $70, $50, $60, $70, $20, $70, $70, $70, $60, $40, $50, $60, $60

$50, $20, $40, $10, $70, $10, $50, $40, $50, $10, $50, $50, $40, $50, $40, $40

$70, $70, $70, $70, $10, $60, $70, $40, $70, $60, $50, $60, $30, $60, $70, $40

end

 

I was hoping to edit that font 0-F to instead have 16 letters of my choosing. Static of course. Wouldn't want to change them on the fly.

 

So, instead of

 

data hxl

$70, $20, blah

 

it would look like

 

data hxl

%11100000,

%00100000,

blah

 

That's assuming you stored the font in those data statements. That's a big assumption on my part.

Ah, I see, they are arranged like that

 

sort of

 

each column is a character

 

 

 

binary_font_tables.txt

Edited by bogax
  • Like 1
Link to comment
Share on other sites

This is easier to see

just use search and replace to change

the underscores to 0 and the hash marks to 1

 

I use jEdit when I'm coding and recently added a new rule to my assembly-6502 mode file that does special syntax coloration on binary numbers. It makes it super easy to see the graphics in the binary values:

post-3056-0-57831000-1410978346_thumb.png

 

A while back I did a bB mode file, if anybody's using it I'll see about updating it with the new binary coloration rule.

Link to comment
Share on other sites

Please do!

I tried a bit adding this and couldn't make it work.

Done.

post-3056-0-74248400-1411056015_thumb.png

 

Since the mode file's from 2006 I'm going to review the bB commands before I post the update as I know some new ones have been added. As an example, when I set that up only PLAYER0: thru PLAYER5: were supported (and it looks like I accidentally listed those twice!) while now it can go thru PLAYER9:

post-3056-0-64961300-1411056023_thumb.png

Link to comment
Share on other sites

  • 2 weeks later...

Where is the XML file?

 

 

1) there are way more bB commands to review than I was expecting.

 

2) Last weekend I got sidetracked trying to figure out how to get some of the colorization rules to be case-sensitive. The 6507 opcodes can be anything, LDA is just as good as lda, but the TIA registers like GRP0 and COLUP0 must be all caps. Basically I wanted to make it so that GRP0 would get colorized but not grp0. Didn't have any luck, as far as I can tell the case-senstive setting is global, meaning all or nothing.

 

3) new computer - I'm still migrating my programs and data over, don't even have jEdit installed on it yet. I did get StarCraft 2 migrated over and damn, does it look sweet! My 2008 MacBook Pro had to have all the settings at minimum, when SC2 realized it was on new hardware it changed them all to the max.

 

4) iOS training courses - I bought the iOS 8 course when I saw it on a preorder special for $79 back on the 8th. It included the iOS 7 course for free as the iOS 8 course wasn't out yet (being a preorder and all). Today they offered up their game course for free if you tweeted about it - so yeah, I ended up with $1497 in courses for $79 + a Tweet! I'm about 25% done with the iOS 7 course, haven't started the other two yet.

 

I plan to get jEdit installed this weekend and will back out the failed case-sensitive attempt. I've decided to skip the bB command review, and just rely on feedback for missing commands from actual bB coders like yourself, so I can get it posted quicker.

Edited by SpiceWare
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...