Programming in BASIC...
Programming in Assembler...
Manager 'plugins'...
IDE64 card detection method...
Calling simple BASIC commands through assembler...
Examples in assembler language...
How to fix games and programs for IDE64... Working document
CD "/BIN/GAMES",12
or
OPEN 1,12,15,"C:/BIN/GAMES":CLOSE 1
10 OPEN 1,12,15,"C:/BIN/GAMES"
20 CLOSE 1
There is also possible to use this syntax:
10 OPEN 1,12,15
20 PRINT#1,"C:/BIN/GAMES"
30 CLOSE 1
Create directory:
MKDIR "/BIN/GAMES",12
or
OPEN 1,12,15,"M:/BIN/GAMES":CLOSE 1
Remove (delete) file or directory:
RM "/BIN/GAMES",12
or
OPEN 1,12,15,"S:/BIN/GAMES":CLOSE 1
Open Files for Read or Write:
Read PRG file:
10 OPEN 1,12,0,"FILENAME"
20 GET#1, A$
...
XX CLOSE 1
Write PRG file:
10 OPEN 1,12,1,"FILENAME"
20 PRINT#1, A$
...
XX CLOSE 1
Read PRG, SEQ or USR file:
10 OPEN 1,12,2,"FILENAME,Type,R"
20 INPUT#1, A$
...
XX CLOSE 1
Write PRG, SEQ or USR file:
10 OPEN 1,12,2,"FILENAME,Type,W"
20 PRINT#1, A$
...
XX CLOSE 1
Type:
P = PRG file
S = SEQ file
U = USR file
It's possible open to six channels for read and one channel for write in the same time (for one device).
(IDE64 DOS V0.70 or higher)
Use the same syntax like in BASIC, see examples.
Do not use floppy speeders to access HDD, non KERNAL calls direct to serial BUS, device number fixed to device #8.
Do not call RESTOR ($FF8A/$FD15) routine. Do not assume that vectors at $0300 always pointing to the same place in $DE60-$DEFF, and do not replace them!
Do not use ACPTR ($FFA5/$EE13), CIOUT ($FFA8/$EDDD), LISTEN ($FFB1), SECOND ($FF93), TALK ($FFB4), TKSA ($FF96), UNLSN ($FFAE), UNTLK ($FFAB), these call are designed in the kernel for serial bus devices.
When fixing existing programs, watch for these calls, and replace them with IDE64 compatible ones. It would be nice that after fixing it could still be used with a simple floppy drive...
NONE of the IDEDOS calls break IRQ/NMI (possible to replace IRQloaders this way!), but IRQ/NMI can get delayed by 30-40 cycles (like VIC's bad lines) while executing IDE64 calls. This may cause "raster bugs" and similar, to avoid this do the raster interrupt a line earlyer, and then check $D012.
LOAD - $FFD5
It's possible to load from ~$0400 to $FFFF
(IDE64 switch $0001 memory configuration register automatically).
SAVE - $FFD8
It's possible to save RAM from ~$0400 to $9FFF (and $C000-$CFFF)
OPEN - $FFC0
CHKIN - $FFC6
CHRIN - $FFCF
GETIN - $FFE4
CHKOUT - $FFC9
CHROUT - $FFD2
CLOSE - $FFC3
CLALL - $FFE7
CLRCHN - $FFCC
Using the KERNAL extensions (most powerful) advantage:
READ - $DEF4
This call does not load under I/O. (eg. reading to $D800 will overwrite color ram)
WRITE - $DEF1
Not possible to save under I/O. (eg. saveing from $D800 will save color ram) To access ram under the BASIC and KERNAL ROM, set $0001 correctly.
These calls cannot be used on serial bus devices. In this case an error is returned (C=1), and the programmer should do the block operation manually using CHRIN/GETIN/CHROUT.
If you want your application using READ/WRITE make runnable on a not IDE64 equiped machine, check for IDE64 before calling these two calls, and use standard routines instead of, as described for serial drives. (imagine what happens at JSR $DEF4 if there's open I/O space at $DE00-$DEFF...)
A plugin has 2 entry points
-> $1000 and $1003 / the manager uses the second one to start it
$1000 - the entry which may asks for filename by running it alone and not under manager
$1003 - manager entry point
Do not destroy memory at $0000-$03FF, $0800-$0FFF!!! Don't forget to restore VIC before exiting. Not a bad idea to load the file first, and then change the screen.
------------------------------------- *= $1000 start = * jmp called_by_sys4096 ;called_by_manager jsr setnam lda #1 ldx $ba ldy #0 jsr setlfs jsr open ldx #1 jsr chkin read_file_loop = * jsr chrin ;... ;... ;... ldx $90 beq read_file_loop lda #$01 ;Close file and return jsr close ;to the FileManager jsr clall ;... ;Do some nice things... ;... rts ;return to manager ;-------------------------------------- called_by_sys4096 = * ;Ask for filename, display credits, etc. rts
This method can detect IDE64 card with IDE-DOS V0.88 and higher.
$de60-$de62 = $49,$44,$45 "IDE"
lda #$3f sta $00 lda #$37 sta $01 lda $de60 cmp $de60 bne noide64 cmp #$49 bne noide64 lda $de61 cmp $de61 bne noide64 cmp #$44 bne noide64 lda $de62 cmp $de62 bne noide64 cmp #$45 bne noide64 beq ide64found
This sourcecode demonstrates, how to call simple BASIC commands through machine code language.
;-------------------------------- lda #<restart sta $0302 lda #>restart sta $0303 lda #$f5 ;$F0 = LL; $F1 = DIR; $F5 = HDINIT sta $0200 lda #$00 sta $0201 lda #<$01ff sta $7a lda #>$01ff sta $7b jmp ($0308) restart = * ;--------------------------------