Hires Graphics

Basic and Machine Language

Moderator: Moderators

User avatar
darkatx
Vic 20 Afficionado
Posts: 471
Joined: Wed Feb 04, 2009 2:17 pm
Location: Canada

Post by darkatx »

Welp, in short - its a line drawing routine for my 3D program that I'm working on. I did one a few years ago on the C-64 based on a C routine from a 3D game programming book...coupled with Mr. Butterfield's pixel plotter routine found in a Compute's Gazette mag.
The one I'm working on now - should be much faster using tables and the line drawing routine is already worked out in ML - just have to type it all in and get the bugs out... :D
Learning all the time... :)
lordbubsy
Vic 20 Amateur
Posts: 45
Joined: Fri Nov 18, 2011 12:31 pm

Post by lordbubsy »

Hi Mike,
first of all my deep respect for your programs and BASIC scripts! :)
I’ve read this thread and I’d love to have commented sources of MINIGRAFIK! Especially the @CLR, @RETURN, @LOAD and @SAVE parts (@ON was described in this thread earlier).
I’m asking for learning purposes and eventually using that graphic mode and knowledge in a game.
8-bit assimilation
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

Hi, lordbubsy,

it's rather strange to see this thread revived after nearly 4 years. :)
lordbubsy wrote:I’ve read this thread and I’d love to have commented sources of MINIGRAFIK! Especially the @CLR, @RETURN, @LOAD and @SAVE parts ([...])
@RETURN is rather easy, it just calls $E518 to reset the VIC registers and initialise the screen editor.

@CLR is also quite simple, the bitmap is cleared with a loop and the colour RAM is initialised with the value in $0286:

Code: Select all

.Clr
 LDA #$11     ; put start of bitmap ($1100) into pointer in ZP
 STA $FC
 LDA #$00
 STA $FB
 TAY
 LDX #$0F     ; clear 15 pages
.Clr_00
 STA ($FB),Y
 INY
 BNE Clr_00
 INC $FC
 DEX
 BNE Clr_00
 LDA $0286    ; load foreground colour
.Clr_01
 STA $9400,Y  ; init the first page of colour RAM
 INY          ; (actually, clearing just 240 bytes would be
 BNE Clr_01   ;  enough, but no harm doing 256.)
 RTS
The subroutines of @LOAD and @SAVE call a routine in the BASIC interpreter to fetch the filename and device number from the running BASIC program, which makes it difficult to use them unaltered in the context of another ML program. I can provide stand-alone versions of these two, but even MINIPAINT takes a simpler route: the editor code just drops to BASIC and then executes @LOAD and @SAVE from there. ;)

Greetings,

Michael
lordbubsy
Vic 20 Amateur
Posts: 45
Joined: Fri Nov 18, 2011 12:31 pm

Post by lordbubsy »

Mike wrote:it's rather strange to see this thread revived after nearly 4 years. :)
Well I read a lot of the old threads using the forum search. Let me know if it’s better for the forum to make new threads.

I’m interested in BASIC extensions and one of my ongoing projects for the C64 and now also for the VIC-20, is to collect (and try to understand) sources of BASIC commands like DEL, AUTO, FIND, RENUM, LIN, MERGE, OLD, HELP, MEM, KILL, CLS, CURSOR, BSAVE, BLOAD, DUMP, PAUSE etc.
I use them as little utilities, for instance at $33C or in a custom BASIC extension.
@RETURN is rather easy, it just calls $E518 to reset the VIC registers and initialise the screen editor.
So essentially

Code: Select all

JSR $E518
JMP $C474	;restart basic, print ready, set direct mode
@CLR is also quite simple, the bitmap is cleared with a loop and the colour RAM is initialised with the value in $0286:
OK, that’s 100% clear.
@LOAD and @SAVE use a lot of calls into the BASIC interpreter and in their current form it would be difficult to incorporate them into another program
I guess because of setting up the complete file structure.
If you're interested I can provide stand-alone versions of these two, so they can be called from other ML code
Well, actually I am.:)
I didn’t find any good sources for them. At least for the VIC.
So that would be great!
8-bit assimilation
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

PM sent.
lordbubsy
Vic 20 Amateur
Posts: 45
Joined: Fri Nov 18, 2011 12:31 pm

Post by lordbubsy »

Thank you for the source and help!
It resulted in a stand-alone display routine for own purposes. (like a game etc.)
The source can be assembled with ACME
http://www.esw-heim.tu-clausthal.de/~ma ... brod/acme/
http://codebase64.org/doku.php?id=base:crossdev

Picture and loader has to be in the same directory.
The program has to be loaded with ,8,1 and started with “SYS8888
8-bit assimilation
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

Just a small remark about this section:
lordbubsy wrote:

Code: Select all

[...]
lda $10fe
sta $900e
[...]
The original code in MINIGRAFIK and in its executable pictures does a slightly more elaborate:

Code: Select all

LDA $900E
AND #$0F
ORA $10FE
STA $900E
MINIGRAFIK saves the contents of VIC register $900E (auxiliary colour and volume) with the bottom nibble zeroed out. When a picture is loaded again, these four instructions then serve to keep the current volume setting.
Post Reply