1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-08 15:29:37 +00:00

Normalized coding style.

git-svn-id: svn://svn.cc65.org/cc65/trunk@5494 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
ol.sc 2012-02-07 22:37:13 +00:00
parent 286d5979a2
commit baa6c53dec
24 changed files with 1164 additions and 1169 deletions

View File

@ -11,91 +11,92 @@
; sectnum_t - 16bit ; sectnum_t - 16bit
; ;
.export _dio_phys_to_log .export _dio_phys_to_log
.export sectab_1541_l, sectab_1541_h ; for log_to_phys .export sectab_1541_l, sectab_1541_h ; for log_to_phys
.import popax,__oserror .import popax,__oserror
.importzp ptr1,ptr2,ptr3,tmp1,tmp2,tmp3,tmp4 .importzp ptr1,ptr2,ptr3,tmp1,tmp2,tmp3,tmp4
.include "dio.inc"
.include "geossym.inc"
.include "const.inc"
.proc _dio_phys_to_log .include "dio.inc"
sta ptr1 .include "geossym.inc"
stx ptr1+1 ; pointer to result .include "const.inc"
jsr popax _dio_phys_to_log:
sta ptr2 sta ptr1
stx ptr2+1 ; pointer to input structure stx ptr1+1 ; pointer to result
jsr popax jsr popax
sta ptr3 sta ptr2
stx ptr3+1 ; pointer to handle stx ptr2+1 ; pointer to input structure
ldy #sst_flag jsr popax
lda (ptr3),y sta ptr3
and #128 stx ptr3+1 ; pointer to handle
beq _inv_hand ; handle not open or invalid
ldy #sst_flag
lda (ptr3),y
ldy #diopp_head and #128
lda (ptr2),y beq _inv_hand ; handle not open or invalid
bne _inv_data ; there is only head 0
ldy #diopp_track
lda (ptr2),y ldy #diopp_head
beq _inv_data ; there is no track 0 lda (ptr2),y
sta tmp1 bne _inv_data ; there is only head 0
ldy #diopp_track
lda (ptr2),y
beq _inv_data ; there is no track 0
sta tmp1
iny iny
lda (ptr2),y lda (ptr2),y
bne _inv_data ; there are no more than 256 tracks bne _inv_data ; there are no more than 256 tracks
dec tmp1 ; normalize track to start from 0 dec tmp1 ; normalize track to start from 0
ldy #diopp_sector ldy #diopp_sector
lda (ptr2),y lda (ptr2),y
sta tmp2 sta tmp2
iny iny
lda (ptr2),y lda (ptr2),y
bne _inv_data ; there are no more than 256 sectors bne _inv_data ; there are no more than 256 sectors
; tmp1 (int) holds track+sector, translate it using device info ; tmp1 (int) holds track+sector, translate it using device info
ldy #sst_driveno ldy #sst_driveno
lda (ptr3),y lda (ptr3),y
tay tay
lda driveType,y lda driveType,y
and #%00000011 ; this is for RamDrive compatibility and #%00000011 ; this is for RamDrive compatibility
cmp #DRV_1541 cmp #DRV_1541
beq dio_cts1541 beq dio_cts1541
cmp #DRV_1571 cmp #DRV_1571
beq dio_cts1571 beq dio_cts1571
cmp #DRV_1581 cmp #DRV_1581
beq dio_cts1581 beq dio_cts1581
lda #DEV_NOT_FOUND ; unknown device lda #DEV_NOT_FOUND ; unknown device
ldx #0 ldx #0
beq ret beq ret
dio_ctsend: dio_ctsend:
ldy #1 ldy #1
lda tmp2 lda tmp2
sta (ptr1),y sta (ptr1),y
dey dey
lda tmp1 lda tmp1
sta (ptr1),y sta (ptr1),y
ldx #0 ldx #0
txa txa
ret: ret:
sta __oserror sta __oserror
rts ; return success rts ; return success
; errors ; errors
_inv_data: _inv_data:
lda #INV_TRACK lda #INV_TRACK
.byte $2c .byte $2c
_inv_hand: _inv_hand:
lda #INCOMPATIBLE lda #INCOMPATIBLE
ldx #0 ldx #0
beq ret beq ret
; device-depended stuff, tmp1=track-1, tmp2=sector ; device-depended stuff, tmp1=track-1, tmp2=sector
@ -145,23 +146,23 @@ dio_cts1581:
bcs _inv_data bcs _inv_data
; mul40 by Christian Groessler ; mul40 by Christian Groessler
sta tmp4 sta tmp4
asl a asl a
rol tmp3 rol tmp3
asl a asl a
rol tmp3 ; val * 4 rol tmp3 ; val * 4
adc tmp4 adc tmp4
bcc L1 bcc L1
inc tmp3 ; val * 5 inc tmp3 ; val * 5
L1: asl a L1: asl a
rol tmp3 ; val * 10 rol tmp3 ; val * 10
asl a asl a
rol tmp3 rol tmp3
asl a asl a
rol tmp3 ; val * 40 = AX rol tmp3 ; val * 40 = AX
ldx tmp3 ldx tmp3
sta tmp3 sta tmp3
stx tmp4 stx tmp4
_nomult: _nomult:
lda tmp2 lda tmp2
@ -173,19 +174,17 @@ _nomult:
sta tmp2 sta tmp2
jmp dio_ctsend jmp dio_ctsend
.endproc
.rodata .rodata
sectab_1541_l: sectab_1541_l:
.byte $00, $15, $2a, $3f, $54, $69, $7e, $93 .byte $00, $15, $2a, $3f, $54, $69, $7e, $93
.byte $a8, $bd, $d2, $e7, $fc, $11, $26, $3b .byte $a8, $bd, $d2, $e7, $fc, $11, $26, $3b
.byte $50, $65, $78, $8b, $9e, $b1, $c4, $d7 .byte $50, $65, $78, $8b, $9e, $b1, $c4, $d7
.byte $ea, $fc, $0e, $20, $32, $44, $56, $67 .byte $ea, $fc, $0e, $20, $32, $44, $56, $67
.byte $78, $89, $9a, $ab .byte $78, $89, $9a, $ab
sectab_1541_h: sectab_1541_h:
.byte $00, $00, $00, $00, $00, $00, $00, $00 .byte $00, $00, $00, $00, $00, $00, $00, $00
.byte $00, $00, $00, $00, $00, $01, $01, $01 .byte $00, $00, $00, $00, $00, $01, $01, $01
.byte $01, $01, $01, $01, $01, $01, $01, $01 .byte $01, $01, $01, $01, $01, $01, $01, $01
.byte $01, $01, $02, $02, $02, $02, $02, $02 .byte $01, $01, $02, $02, $02, $02, $02, $02
.byte $02, $02, $02, $02 .byte $02, $02, $02, $02

View File

@ -10,22 +10,23 @@
; dio_open sets given device as current and initializes disk ; dio_open sets given device as current and initializes disk
; dio_close does nothing special ; dio_close does nothing special
.export _dio_open, _dio_close .export _dio_open, _dio_close
.import __oserror, _OpenDisk .import __oserror, _OpenDisk
.importzp ptr1, tmp1 .importzp ptr1, tmp1
.include "dio.inc"
.include "jumptab.inc" .include "dio.inc"
.include "geossym.inc" .include "jumptab.inc"
.include "const.inc" .include "geossym.inc"
.include "const.inc"
.bss .bss
sectsizetab: sectsizetab:
.res 4 * sst_size ; this is hardcoded .res 4 * sst_size ; this is hardcoded
.code .code
.proc _dio_open _dio_open:
pha pha
tax tax
lda driveType,x ; check if there's a device lda driveType,x ; check if there's a device
@ -39,28 +40,28 @@ sectsizetab:
pla pla
tay ; drive # tay ; drive #
asl a ; make index from drive id asl a ; make index from drive id
asl a asl a
tax tax
lda #0 lda #0
sta sectsizetab+sst_sectsize,x sta sectsizetab+sst_sectsize,x
lda #128 lda #128
sta sectsizetab+sst_flag,x ; set flag that drive is "open" sta sectsizetab+sst_flag,x ; set flag that drive is "open"
lda #1 lda #1
sta sectsizetab+sst_sectsize+1,x sta sectsizetab+sst_sectsize+1,x
tya tya
sta sectsizetab+sst_driveno,x sta sectsizetab+sst_driveno,x
stx tmp1 stx tmp1
lda #<sectsizetab lda #<sectsizetab
clc clc
adc tmp1 adc tmp1
sta tmp1 sta tmp1
lda #>sectsizetab lda #>sectsizetab
adc #0 adc #0
tax tax
lda tmp1 lda tmp1
rts rts
@ -71,15 +72,12 @@ _inv_drive:
tax tax
rts rts
.endproc _dio_close:
sta ptr1
.proc _dio_close stx ptr1+1
sta ptr1 lda #0
stx ptr1+1 ldy #sst_flag
lda #0 sta (ptr1),y
ldy #sst_flag sta __oserror ; success
sta (ptr1),y
sta __oserror ; success
tax tax
rts ; return no error rts ; return no error
.endproc

View File

@ -5,19 +5,22 @@
; this function is used by dio_read and dio_write to fix parameters (secnum) ; this function is used by dio_read and dio_write to fix parameters (secnum)
; this function calls SetDevice so that more than one drive can be used at once ; this function calls SetDevice so that more than one drive can be used at once
.import popax,pushax,_dio_log_to_phys .import popax,pushax,_dio_log_to_phys
.importzp ptr1 .importzp ptr1
.export dio_params,dio_secnum .export dio_params,dio_secnum
.include "geossym.inc"
.include "jumptab.inc" .include "geossym.inc"
.include "dio.inc" .include "jumptab.inc"
.include "dio.inc"
.bss .bss
dio_secnum: .res 2
dio_secnum:
.res 2
.code .code
.proc dio_params
dio_params:
sta r4L sta r4L
stx r4H stx r4H
@ -47,5 +50,3 @@ dio_secnum: .res 2
lda #<r1L lda #<r1L
ldx #>r1H ldx #>r1H
jmp _dio_log_to_phys jmp _dio_log_to_phys
.endproc

View File

@ -9,17 +9,15 @@
; sectnum_t - 16bit ; sectnum_t - 16bit
; ;
.import dio_params, __oserror .import dio_params, __oserror
.export _dio_read .export _dio_read
.include "geossym.inc"
.include "jumptab.inc"
.proc _dio_read .include "geossym.inc"
.include "jumptab.inc"
_dio_read:
jsr dio_params jsr dio_params
jsr ReadBlock jsr ReadBlock
stx __oserror stx __oserror
txa txa
rts rts
.endproc

View File

@ -10,173 +10,171 @@
; sectnum_t - 16bit ; sectnum_t - 16bit
; ;
.export _dio_log_to_phys .export _dio_log_to_phys
.importzp ptr1,ptr2,ptr3,tmp1,tmp2 .importzp ptr1,ptr2,ptr3,tmp1,tmp2
.import popax,__oserror .import popax,__oserror
.import sectab_1541_l, sectab_1541_h .import sectab_1541_l, sectab_1541_h
.include "dio.inc"
.include "geossym.inc"
.include "const.inc"
.proc _dio_log_to_phys .include "dio.inc"
.include "geossym.inc"
.include "const.inc"
_dio_log_to_phys:
; check device type ; check device type
sta ptr1 sta ptr1
stx ptr1+1 ; pointer to result (struct dio_phys_pos) stx ptr1+1 ; pointer to result (struct dio_phys_pos)
jsr popax jsr popax
sta ptr2 sta ptr2
stx ptr2+1 ; pointer to input structure (pointer to int) stx ptr2+1 ; pointer to input structure (pointer to int)
jsr popax jsr popax
sta ptr3 sta ptr3
stx ptr3+1 ; pointer to handle stx ptr3+1 ; pointer to handle
ldy #sst_flag ldy #sst_flag
lda (ptr3),y lda (ptr3),y
and #128 and #128
beq _inv_hand ; handle not open or invalid beq _inv_hand ; handle not open or invalid
; fill in all we have ; fill in all we have
ldy #diopp_head ldy #diopp_head
lda #0 ; head 0 lda #0 ; head 0
sta (ptr1),y sta (ptr1),y
ldy #diopp_track+1 ldy #diopp_track+1
sta (ptr1),y ; track <256 sta (ptr1),y ; track <256
ldy #diopp_sector+1 ldy #diopp_sector+1
sta (ptr1),y ; sector <256 sta (ptr1),y ; sector <256
ldy #0 ldy #0
lda (ptr2),y lda (ptr2),y
sta tmp1 sta tmp1
iny iny
lda (ptr2),y lda (ptr2),y
sta tmp2 sta tmp2
; get drive info ; get drive info
ldy #sst_driveno ldy #sst_driveno
lda (ptr3),y lda (ptr3),y
tay tay
lda driveType,y lda driveType,y
and #%00000011 ; this is for RamDrive compatibility and #%00000011 ; this is for RamDrive compatibility
cmp #DRV_1541 cmp #DRV_1541
beq dio_stc1541 beq dio_stc1541
cmp #DRV_1571 cmp #DRV_1571
beq dio_stc1571 beq dio_stc1571
cmp #DRV_1581 cmp #DRV_1581
beq dio_stc1581 beq dio_stc1581
lda #DEV_NOT_FOUND ; unknown device lda #DEV_NOT_FOUND ; unknown device
ldx #0 ldx #0
beq _ret beq _ret
dio_stcend: dio_stcend:
ldy #diopp_track ldy #diopp_track
lda tmp1 lda tmp1
sta (ptr1),y sta (ptr1),y
ldy #diopp_sector ldy #diopp_sector
lda tmp2 lda tmp2
sta (ptr1),y sta (ptr1),y
ldx #0 ldx #0
txa txa
_ret: _ret:
sta __oserror sta __oserror
rts ; return success rts ; return success
; errors ; errors
_inv_data: _inv_data:
lda #INV_TRACK lda #INV_TRACK
.byte $2c .byte $2c
_inv_hand: _inv_hand:
lda #INCOMPATIBLE lda #INCOMPATIBLE
ldx #0 ldx #0
beq _ret beq _ret
dio_stc1541: dio_stc1541:
; if 1541: ; if 1541:
; - compare with table to find track ; - compare with table to find track
; - subtract and find sector ; - subtract and find sector
ldx #0 ; index=(track-1) ldx #0 ; index=(track-1)
_loop41: _loop41:
lda tmp2 lda tmp2
cmp sectab_1541_h+1,x cmp sectab_1541_h+1,x
bne _nxt bne _nxt
lda tmp1 lda tmp1
cmp sectab_1541_l+1,x cmp sectab_1541_l+1,x
bcc _found bcc _found
_nxt: inx _nxt: inx
cpx #35 cpx #35
bne _loop41 bne _loop41
beq _inv_data beq _inv_data
_found: _found:
lda tmp1 lda tmp1
sec sec
sbc sectab_1541_l,x sbc sectab_1541_l,x
sta tmp2 sta tmp2
_fndend: _fndend:
inx inx
stx tmp1 stx tmp1
jmp dio_stcend jmp dio_stcend
dio_stc1571: dio_stc1571:
; if 1571: ; if 1571:
; - check size, if too big - subtract and add 35 to track ; - check size, if too big - subtract and add 35 to track
; - fall down to 1541 ; - fall down to 1541
lda tmp2 lda tmp2
cmp #>683 cmp #>683
bne _cnt71 bne _cnt71
lda tmp1 lda tmp1
cmp #<683 cmp #<683
bcc dio_stc1541 bcc dio_stc1541
_cnt71: _cnt71:
lda tmp1 lda tmp1
sec sec
sbc #<683 sbc #<683
sta tmp1 sta tmp1
lda tmp2 lda tmp2
sbc #>683 sbc #>683
sta tmp2 sta tmp2
jsr dio_stc1541 ; will fall through here jsr dio_stc1541 ; will fall through here
ldy #diopp_track ldy #diopp_track
lda (ptr1),y lda (ptr1),y
clc clc
adc #35 adc #35
sta (ptr1),y sta (ptr1),y
lda #0 lda #0
beq _ret beq _ret
; if 1581: ; if 1581:
; - subtract 40 in loop (at most 80 times) to find track ; - subtract 40 in loop (at most 80 times) to find track
; - the remainder is sector ; - the remainder is sector
dio_stc1581: dio_stc1581:
ldx #0 ; index=(track-1) ldx #0 ; index=(track-1)
_loop81: _loop81:
lda tmp2 lda tmp2
bne _sub81 bne _sub81
lda tmp1 lda tmp1
cmp #40 cmp #40
bcc _got81 bcc _got81
_sub81: lda tmp1 _sub81: lda tmp1
sec sec
sbc #40 sbc #40
sta tmp1 sta tmp1
lda tmp2 lda tmp2
sbc #0 sbc #0
sta tmp2 sta tmp2
inx inx
cpx #81 cpx #81
bne _loop81 bne _loop81
beq _inv_data beq _inv_data
_got81: lda tmp1 _got81: lda tmp1
sta tmp2 sta tmp2
inx inx
stx tmp1 stx tmp1
jmp dio_stcend jmp dio_stcend
.endproc

View File

@ -9,15 +9,13 @@
; sectnum_t - 16bit ; sectnum_t - 16bit
; ;
.import dio_params, setoserror .import dio_params, setoserror
.export _dio_write .export _dio_write
.include "geossym.inc"
.include "jumptab.inc"
.proc _dio_write .include "geossym.inc"
.include "jumptab.inc"
_dio_write:
jsr dio_params jsr dio_params
jsr WriteBlock jsr WriteBlock
jmp setoserror jmp setoserror
.endproc

View File

@ -9,17 +9,15 @@
; sectnum_t - 16bit ; sectnum_t - 16bit
; ;
.import dio_params, __oserror .import dio_params, __oserror
.export _dio_write_verify .export _dio_write_verify
.include "geossym.inc"
.include "jumptab.inc"
.proc _dio_write_verify .include "geossym.inc"
.include "jumptab.inc"
_dio_write_verify:
jsr dio_params jsr dio_params
jsr VerWriteBlock jsr VerWriteBlock
stx __oserror stx __oserror
txa txa
rts rts
.endproc

View File

@ -10,89 +10,83 @@
; int __fastcall__ close (int fd); ; int __fastcall__ close (int fd);
; int __fastcall__ read (int fd, void* buf, unsigned count); ; int __fastcall__ read (int fd, void* buf, unsigned count);
FILEDES = 3 ; first free to use file descriptor FILEDES = 3 ; first free to use file descriptor
.include "geossym.inc" .importzp ptr1, ptr2, ptr3, tmp1
.include "const.inc" .import addysp, popax
.include "errno.inc" .import __oserror
.include "fcntl.inc" .import _FindFile, _ReadByte
.export _open, _close, _read
.importzp ptr1, ptr2, ptr3, tmp1 .include "geossym.inc"
.import addysp, popax .include "const.inc"
.import __oserror .include "errno.inc"
.import _FindFile, _ReadByte .include "fcntl.inc"
.export _open, _close, _read
;--------------------------------------------------------------------------
; _open
_open: _open:
cpy #4 ; correct # of arguments (bytes)?
cpy #4 ; correct # of arguments (bytes)? beq @parmok ; parameter count ok
beq @parmok ; parameter count ok tya ; parm count < 4 shouldn't be needed to be...
tya ; parm count < 4 shouldn't be needed to be... sec ; ...checked (it generates a c compiler warning)
sec ; ...checked (it generates a c compiler warning) sbc #4
sbc #4
tay tay
jsr addysp ; fix stack, throw away unused parameters jsr addysp ; fix stack, throw away unused parameters
; Parameters ok. Pop the flags and save them into tmp3 ; Parameters ok. Pop the flags and save them into tmp3
@parmok: @parmok:
jsr popax ; Get flags jsr popax ; Get flags
sta tmp1 sta tmp1
jsr popax ; Get name jsr popax ; Get name
sta ptr1 sta ptr1
stx ptr1+1 stx ptr1+1
lda filedesc ; is there a file already open? lda filedesc ; is there a file already open?
bne @alreadyopen bne @alreadyopen
lda tmp1 ; check open mode lda tmp1 ; check open mode
and #(O_RDWR | O_CREAT) and #(O_RDWR | O_CREAT)
cmp #O_RDONLY ; only O_RDONLY is valid cmp #O_RDONLY ; only O_RDONLY is valid
bne @badmode bne @badmode
lda ptr1 lda ptr1
ldx ptr1+1 ldx ptr1+1
jsr _FindFile ; try to find the file jsr _FindFile ; try to find the file
tax tax
bne @oserror bne @oserror
lda dirEntryBuf + OFF_DE_TR_SC ; tr&se for ReadByte (r1) lda dirEntryBuf + OFF_DE_TR_SC ; tr&se for ReadByte (r1)
sta f_track sta f_track
lda dirEntryBuf + OFF_DE_TR_SC + 1 lda dirEntryBuf + OFF_DE_TR_SC + 1
sta f_sector sta f_sector
lda #<diskBlkBuf ; buffer for ReadByte (r4) lda #<diskBlkBuf ; buffer for ReadByte (r4)
sta f_buffer sta f_buffer
lda #>diskBlkBuf lda #>diskBlkBuf
sta f_buffer+1 sta f_buffer+1
ldx #0 ; offset for ReadByte (r5) ldx #0 ; offset for ReadByte (r5)
stx f_offset stx f_offset
stx f_offset+1 stx f_offset+1
lda #0 ; clear errors lda #0 ; clear errors
sta __oserror sta __oserror
jsr __seterrno jsr __seterrno
lda #FILEDES ; return fd lda #FILEDES ; return fd
sta filedesc sta filedesc
rts rts
@badmode: @badmode:
lda #EINVAL ; invalid parameters - invalid open mode lda #EINVAL ; invalid parameters - invalid open mode
.byte $2c ; skip .byte $2c ; skip
@alreadyopen: @alreadyopen:
lda #EMFILE ; too many opened files (there can be only one) lda #EMFILE ; too many opened files (there can be only one)
jmp __directerrno ; set errno, clear oserror, return -1 jmp __directerrno ; set errno, clear oserror, return -1
@oserror: @oserror:
jmp __mappederrno ; set platform error code, return -1 jmp __mappederrno ; set platform error code, return -1
_close: _close:
lda #0 lda #0
sta __oserror sta __oserror
jsr __seterrno ; clear errors jsr __seterrno ; clear errors
lda #0 ; clear fd lda #0 ; clear fd
sta filedesc sta filedesc
tax tax
rts rts
@ -102,90 +96,96 @@ _read:
; popax - fd, must be == to the above one ; popax - fd, must be == to the above one
; return -1+__oserror or number of bytes read ; return -1+__oserror or number of bytes read
eor #$ff eor #$ff
sta ptr1 sta ptr1
txa txa
eor #$ff eor #$ff
sta ptr1+1 ; -(# of bytes to read)-1 sta ptr1+1 ; -(# of bytes to read)-1
jsr popax jsr popax
sta ptr2 sta ptr2
stx ptr2+1 ; buffer ptr stx ptr2+1 ; buffer ptr
jsr popax jsr popax
cmp #FILEDES ; lo-byte == FILEDES cmp #FILEDES ; lo-byte == FILEDES
bne @filenotopen bne @filenotopen
txa ; hi-byte == 0 txa ; hi-byte == 0
beq @fileok ; fd must be == FILEDES beq @fileok ; fd must be == FILEDES
@filenotopen: @filenotopen:
lda #EBADF lda #EBADF
jmp __directerrno ; Sets _errno, clears _oserror, returns -1 jmp __directerrno ; Sets _errno, clears _oserror, returns -1
@fileok: @fileok:
lda #0 lda #0
sta ptr3 sta ptr3
sta ptr3+1 ; put 0 into ptr3 (number of bytes read) sta ptr3+1 ; put 0 into ptr3 (number of bytes read)
sta __oserror ; clear error flags sta __oserror ; clear error flags
jsr __seterrno jsr __seterrno
lda f_track ; restore stuff for ReadByte lda f_track ; restore stuff for ReadByte
ldx f_sector ldx f_sector
sta r1L sta r1L
stx r1H stx r1H
lda f_buffer lda f_buffer
ldx f_buffer+1 ldx f_buffer+1
sta r4L sta r4L
stx r4H stx r4H
lda f_offset lda f_offset
ldx f_offset+1 ldx f_offset+1
sta r5L sta r5L
stx r5H stx r5H
clc clc
bcc @L3 ; branch always bcc @L3 ; branch always
@L0: jsr _ReadByte @L0: jsr _ReadByte
ldy #0 ; store the byte ldy #0 ; store the byte
sta (ptr2),y sta (ptr2),y
inc ptr2 ; increment target address inc ptr2 ; increment target address
bne @L1 bne @L1
inc ptr2+1 inc ptr2+1
@L1: inc ptr3 ; increment byte count @L1: inc ptr3 ; increment byte count
bne @L2 bne @L2
inc ptr3+1 inc ptr3+1
@L2: lda __oserror ; was there error ? @L2: lda __oserror ; was there error ?
beq @L3 beq @L3
cmp #BFR_OVERFLOW ; EOF? cmp #BFR_OVERFLOW ; EOF?
beq @done ; yes, we're done beq @done ; yes, we're done
jmp __mappederrno ; no, we're screwed jmp __mappederrno ; no, we're screwed
@L3: inc ptr1 ; decrement the count @L3: inc ptr1 ; decrement the count
bne @L0 bne @L0
inc ptr1+1 inc ptr1+1
bne @L0 bne @L0
@done: @done:
lda r1L ; preserve data for ReadByte lda r1L ; preserve data for ReadByte
ldx r1H ldx r1H
sta f_track sta f_track
stx f_sector stx f_sector
lda r4L lda r4L
ldx r4H ldx r4H
sta f_buffer sta f_buffer
stx f_buffer+1 stx f_buffer+1
lda r5L lda r5L
ldx r5H ldx r5H
sta f_offset sta f_offset
stx f_offset+1 stx f_offset+1
lda ptr3 ; return byte count lda ptr3 ; return byte count
ldx ptr3+1 ldx ptr3+1
rts rts
.bss .bss
filedesc: .res 1 ; file open flag - 0 (no file opened) or 1
f_track: .res 1 ; values preserved for ReadByte filedesc:
f_sector: .res 1 .res 1 ; file open flag - 0 (no file opened) or 1
f_offset: .res 2 f_track:
f_buffer: .res 2 .res 1 ; values preserved for ReadByte
f_sector:
.res 1
f_offset:
.res 2
f_buffer:
.res 2

View File

@ -5,53 +5,49 @@
; Ullrich von Bassewitz, 2002-12-20 ; Ullrich von Bassewitz, 2002-12-20
; ;
.include "zeropage.inc" .include "zeropage.inc"
.include "joy-kernel.inc"
.include "joy-kernel.inc" .include "joy-error.inc"
.include "joy-error.inc" .include "geossym.inc"
.include "geossym.inc"
.macpack generic
.macpack generic
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; Header. Includes jump table ; Header. Includes jump table
.segment "JUMPTABLE" .segment "JUMPTABLE"
; Driver signature ; Driver signature
.byte $6A, $6F, $79 ; "joy" .byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number .byte JOY_API_VERSION ; Driver API version number
; Button state masks (8 values) ; Button state masks (8 values)
.byte $01 ; JOY_UP .byte $01 ; JOY_UP
.byte $02 ; JOY_DOWN .byte $02 ; JOY_DOWN
.byte $04 ; JOY_LEFT .byte $04 ; JOY_LEFT
.byte $08 ; JOY_RIGHT .byte $08 ; JOY_RIGHT
.byte $10 ; JOY_FIRE .byte $10 ; JOY_FIRE
.byte $00 ; Future expansion .byte $00 ; Future expansion
.byte $00 ; Future expansion .byte $00 ; Future expansion
.byte $00 ; Future expansion .byte $00 ; Future expansion
; Jump table. ; Jump table.
.word INSTALL .word INSTALL
.word UNINSTALL .word UNINSTALL
.word COUNT .word COUNT
.word READ .word READ
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; Constants ; Constants
JOY_COUNT = 2 ; Number of joysticks we support JOY_COUNT = 2 ; Number of joysticks we support
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; Data. ; Data.
.code .code
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
@ -62,9 +58,9 @@ JOY_COUNT = 2 ; Number of joysticks we support
; ;
INSTALL: INSTALL:
lda #<JOY_ERR_OK lda #<JOY_ERR_OK
ldx #>JOY_ERR_OK ldx #>JOY_ERR_OK
; rts ; Run into UNINSTALL instead ; rts ; Run into UNINSTALL instead
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; UNINSTALL routine. Is called before the driver is removed from memory. ; UNINSTALL routine. Is called before the driver is removed from memory.
@ -72,7 +68,7 @@ INSTALL:
; ;
UNINSTALL: UNINSTALL:
rts rts
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
@ -80,9 +76,9 @@ UNINSTALL:
; ;
COUNT: COUNT:
lda #<JOY_COUNT lda #<JOY_COUNT
ldx #>JOY_COUNT ldx #>JOY_COUNT
rts rts
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; READ: Read a particular joystick passed in A. ; READ: Read a particular joystick passed in A.
@ -91,36 +87,36 @@ COUNT:
READ: READ:
tax tax
php php
sei ; disable IRQ sei ; disable IRQ
lda $01 lda $01
pha pha
lda #$35 lda #$35
sta $01 ; enable I/O sta $01 ; enable I/O
txa ; Joystick number into X txa ; Joystick number into X
bne joy2 bne joy2
; Read joystick 1 ; Read joystick 1
joy1: joy1:
lda #$7F lda #$7F
sta cia1base sta cia1base
lda cia1base+1 lda cia1base+1
back: tay back: tay
pla pla
sta $01 sta $01
plp plp
tya tya
and #$1F and #$1F
eor #$1F eor #$1F
rts rts
; Read joystick 2 ; Read joystick 2
joy2: ldx #0 joy2: ldx #0
lda #$E0 lda #$E0
ldy #$FF ldy #$FF
sta cia1base+2 sta cia1base+2
lda cia1base+1 lda cia1base+1
sty cia1base+2 sty cia1base+2
jmp back jmp back

View File

@ -3,77 +3,75 @@
; 2010-08-17, Maciej 'YTM/Elysium' Witkowiak <ytm@elysium.pl> ; 2010-08-17, Maciej 'YTM/Elysium' Witkowiak <ytm@elysium.pl>
; 2010-08-18, Greg King ; 2010-08-18, Greg King
.include "zeropage.inc" .include "zeropage.inc"
.include "tgi-kernel.inc"
.include "tgi-kernel.inc" .include "tgi-error.inc"
.include "tgi-error.inc" .include "const.inc"
.include "jumptab.inc"
.include "const.inc" .include "geossym.inc"
.include "jumptab.inc" .include "geossym2.inc"
.include "geossym.inc"
.include "geossym2.inc" .macpack generic
.macpack generic
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; Constants ; Constants
VDC_ADDR_REG := $D600 ; VDC address VDC_ADDR_REG := $D600 ; VDC address
VDC_DATA_REG := $D601 ; VDC data VDC_DATA_REG := $D601 ; VDC data
VDC_DSP_HI = 12 ; registers used VDC_DSP_HI = 12 ; registers used
VDC_DSP_LO = 13 VDC_DSP_LO = 13
VDC_DATA_HI = 18 VDC_DATA_HI = 18
VDC_DATA_LO = 19 VDC_DATA_LO = 19
VDC_VSCROLL = 24 VDC_VSCROLL = 24
VDC_HSCROLL = 25 VDC_HSCROLL = 25
VDC_COLORS = 26 VDC_COLORS = 26
VDC_CSET = 28 VDC_CSET = 28
VDC_COUNT = 30 VDC_COUNT = 30
VDC_DATA = 31 VDC_DATA = 31
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; Header. Includes jump table and constants. ; Header. Includes jump table and constants.
.segment "JUMPTABLE" .segment "JUMPTABLE"
; First part of the header is a structure that has a magic signature, ; First part of the header is a structure that has a magic signature,
; and defines the capabilities of the driver. ; and defines the capabilities of the driver.
.byte $74, $67, $69 ; "tgi" .byte $74, $67, $69 ; "tgi"
.byte TGI_API_VERSION ; TGI API version number .byte TGI_API_VERSION ; TGI API version number
xres: .word 320 ; X resolution xres: .word 320 ; X resolution
yres: .word 200 ; Y resolution yres: .word 200 ; Y resolution
.byte 2 ; Number of drawing colors .byte 2 ; Number of drawing colors
pages: .byte 1 ; Number of screens available pages: .byte 1 ; Number of screens available
.byte 8 ; System font X size .byte 8 ; System font X size
.byte 8 ; System font Y size .byte 8 ; System font Y size
aspect: .word $00D4 ; Aspect ratio (based on 4/3 display) aspect: .word $00D4 ; Aspect ratio (based on 4/3 display)
.byte 0 ; TGI driver flags .byte 0 ; TGI driver flags
; Next comes the jump table. With the exception of IRQ, all entries must be ; Next comes the jump table. With the exception of IRQ, all entries must be
; valid, and may point to an RTS for test versions (function not implemented). ; valid, and may point to an RTS for test versions (function not implemented).
.addr INSTALL .addr INSTALL
.addr UNINSTALL .addr UNINSTALL
.addr INIT .addr INIT
.addr DONE .addr DONE
.addr GETERROR .addr GETERROR
.addr CONTROL .addr CONTROL
.addr CLEAR .addr CLEAR
.addr SETVIEWPAGE .addr SETVIEWPAGE
.addr SETDRAWPAGE .addr SETDRAWPAGE
.addr SETCOLOR .addr SETCOLOR
.addr SETPALETTE .addr SETPALETTE
.addr GETPALETTE .addr GETPALETTE
.addr GETDEFPALETTE .addr GETDEFPALETTE
.addr SETPIXEL .addr SETPIXEL
.addr GETPIXEL .addr GETPIXEL
.addr LINE .addr LINE
.addr BAR .addr BAR
.addr TEXTSTYLE .addr TEXTSTYLE
.addr OUTTEXT .addr OUTTEXT
.addr 0 ; IRQ entry is unused .addr 0 ; IRQ entry is unused
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; Data. ; Data.
@ -81,40 +79,50 @@ aspect: .word $00D4 ; Aspect ratio (based on 4/3 display)
; Variables mapped to the zero-page segment variables. Some of these are ; Variables mapped to the zero-page segment variables. Some of these are
; used for passing parameters to the driver. ; used for passing parameters to the driver.
X1 = ptr1 X1 = ptr1
Y1 = ptr2 Y1 = ptr2
X2 = ptr3 X2 = ptr3
Y2 = ptr4 Y2 = ptr4
; Absolute variables used in the code ; Absolute variables used in the code
.bss .bss
SCRBASE: .res 1 ; High byte of screen base (64k VDC only) SCRBASE:
.res 1 ; High byte of screen base (64k VDC only)
ERROR: .res 1 ; Error code ERROR:
PALETTE: .res 2 ; The current palette .res 1 ; Error code
PALETTE:
.res 2 ; The current palette
BITMASK: .res 1 ; $00 = clear, $01 = set pixels BITMASK:
.res 1 ; $00 = clear, $01 = set pixels
OLDCOLOR: .res 1 ; colors before entering gfx mode OLDCOLOR:
.res 1 ; colors before entering gfx mode
; Text output stuff ; Text output stuff
TEXTMAGX: .res 1 TEXTMAGX:
TEXTMAGY: .res 1 .res 1
TEXTDIR: .res 1 TEXTMAGY:
.res 1
TEXTDIR:
.res 1
; Constants and tables ; Constants and tables
.rodata .rodata
DEFPALETTE: .byte $00, $0f ; White on black DEFPALETTE:
.byte $00, $0f ; White on black
PALETTESIZE = * - DEFPALETTE PALETTESIZE = * - DEFPALETTE
; color translation table (indexed by VIC color) ; color translation table (indexed by VIC color)
COLTRANS: .byte $00, $0f, $08, $06, $0a, $04, $02, $0c COLTRANS:
.byte $0d, $0b, $09, $01, $0e, $05, $03, $07 .byte $00, $0f, $08, $06, $0a, $04, $02, $0c
; colors BROWN and GRAY3 are wrong .byte $0d, $0b, $09, $01, $0e, $05, $03, $07
; colors BROWN and GRAY3 are wrong
.code .code
@ -133,8 +141,8 @@ INSTALL:
beq @L40 beq @L40
lda c128Flag ; at least GEOS 2.0, but we're on C128? lda c128Flag ; at least GEOS 2.0, but we're on C128?
bpl @L40 bpl @L40
lda graphMode ; GEOS 2.0, C128, but is 80 column screen enabled? lda graphMode ; GEOS 2.0, C128, but is 80 column screen enabled?
bmi @L80 bmi @L80
@L40: rts ; leave default values for 40 column screen @L40: rts ; leave default values for 40 column screen
; check for VDC version and update register $19 value ; check for VDC version and update register $19 value
@ -142,82 +150,82 @@ INSTALL:
@L80: @L80:
; double the x resolution and halve the aspect ratio ; double the x resolution and halve the aspect ratio
asl xres asl xres
rol xres+1 rol xres+1
lsr aspect+1 lsr aspect+1
ror aspect ror aspect
; update number of available screens ; update number of available screens
ldx #VDC_CSET ; determine size of RAM... ldx #VDC_CSET ; determine size of RAM...
jsr VDCReadReg jsr VDCReadReg
sta tmp1 sta tmp1
ora #%00010000 ora #%00010000
jsr VDCWriteReg ; turn on 64k jsr VDCWriteReg ; turn on 64k
jsr settestadr1 ; save original value of test byte jsr settestadr1 ; save original value of test byte
jsr VDCReadByte jsr VDCReadByte
sta tmp2 sta tmp2
lda #$55 ; write $55 here lda #$55 ; write $55 here
ldy #ptr1 ldy #ptr1
jsr test64k ; read it here and there jsr test64k ; read it here and there
lda #$aa ; write $aa here lda #$aa ; write $aa here
ldy #ptr2 ldy #ptr2
jsr test64k ; read it here and there jsr test64k ; read it here and there
jsr settestadr1 jsr settestadr1
lda tmp2 lda tmp2
jsr VDCWriteByte ; restore original value of test byte jsr VDCWriteByte ; restore original value of test byte
lda ptr1 ; do bytes match? lda ptr1 ; do bytes match?
cmp ptr1+1 cmp ptr1+1
bne @have64k bne @have64k
lda ptr2 lda ptr2
cmp ptr2+1 cmp ptr2+1
bne @have64k bne @have64k
ldx #VDC_CSET ldx #VDC_CSET
lda tmp1 lda tmp1
jsr VDCWriteReg ; restore 16/64k flag jsr VDCWriteReg ; restore 16/64k flag
jmp @endok ; and leave default values for 16k jmp @endok ; and leave default values for 16k
@have64k: @have64k:
lda #4 lda #4
sta pages sta pages
@endok: @endok:
lda #0 lda #0
sta SCRBASE ; draw page 0 as default sta SCRBASE ; draw page 0 as default
rts rts
test64k: test64k:
sta tmp1 sta tmp1
sty ptr3 sty ptr3
lda #0 lda #0
sta ptr3+1 sta ptr3+1
jsr settestadr1 jsr settestadr1
lda tmp1 lda tmp1
jsr VDCWriteByte ; write $55 jsr VDCWriteByte ; write $55
jsr settestadr1 jsr settestadr1
jsr VDCReadByte ; read here jsr VDCReadByte ; read here
pha pha
jsr settestadr2 jsr settestadr2
jsr VDCReadByte ; and there jsr VDCReadByte ; and there
ldy #1 ldy #1
sta (ptr3),y sta (ptr3),y
pla pla
dey dey
sta (ptr3),y sta (ptr3),y
rts rts
settestadr1: settestadr1:
ldy #$02 ; test page 2 (here) ldy #$02 ; test page 2 (here)
.byte $2c .byte $2c
settestadr2: settestadr2:
ldy #$42 ; or page 64+2 (there) ldy #$42 ; or page 64+2 (there)
lda #0 lda #0
jmp VDCSetSourceAddr jmp VDCSetSourceAddr
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; UNINSTALL routine. Is called before the driver is removed from memory. May ; UNINSTALL routine. Is called before the driver is removed from memory. May
@ -227,7 +235,7 @@ settestadr2:
; ;
UNINSTALL: UNINSTALL:
rts rts
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
@ -252,8 +260,8 @@ INIT:
lda #ST_WR_FORE ; write only on foreground lda #ST_WR_FORE ; write only on foreground
sta dispBufferOn sta dispBufferOn
lda graphMode lda graphMode
bmi @L80 bmi @L80
; Remember current color value (40 columns) ; Remember current color value (40 columns)
lda screencolors lda screencolors
@ -268,9 +276,9 @@ INIT:
; Done, reset the error code ; Done, reset the error code
lda #TGI_ERR_OK lda #TGI_ERR_OK
sta ERROR sta ERROR
rts rts
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; DONE: Will be called to switch the graphics device back into text mode. ; DONE: Will be called to switch the graphics device back into text mode.
@ -306,10 +314,10 @@ DONE:
; GETERROR: Return the error code in A and clear it. ; GETERROR: Return the error code in A and clear it.
GETERROR: GETERROR:
ldx #TGI_ERR_OK ldx #TGI_ERR_OK
lda ERROR lda ERROR
stx ERROR stx ERROR
rts rts
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; CONTROL: Platform/driver specific entry point. ; CONTROL: Platform/driver specific entry point.
@ -318,9 +326,9 @@ GETERROR:
; ;
CONTROL: CONTROL:
lda #TGI_ERR_INV_FUNC lda #TGI_ERR_INV_FUNC
sta ERROR sta ERROR
rts rts
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; CLEAR: Clears the screen. ; CLEAR: Clears the screen.
@ -329,29 +337,29 @@ CONTROL:
; ;
CLEAR: CLEAR:
lda curPattern lda curPattern
pha pha
lda #0 lda #0
jsr SetPattern jsr SetPattern
ldx #0 ldx #0
stx r3L stx r3L
stx r3H stx r3H
stx r2L stx r2L
lda #199 lda #199
sta r2H sta r2H
lda graphMode lda graphMode
bpl @L40 bpl @L40
lda #>639 ; 80 columns lda #>639 ; 80 columns
ldx #<639 ldx #<639
bne @L99 bne @L99
@L40: lda #>319 ; 40 columns @L40: lda #>319 ; 40 columns
ldx #<319 ldx #<319
@L99: sta r4H @L99: sta r4H
stx r4L stx r4L
jsr Rectangle jsr Rectangle
pla pla
sta curPattern sta curPattern
rts rts
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; SETVIEWPAGE: Set the visible page. Called with the new page in A (0..n). ; SETVIEWPAGE: Set the visible page. Called with the new page in A (0..n).
@ -368,8 +376,8 @@ SETVIEWPAGE:
ror ror
ror ror
ror ror
ldx #VDC_DSP_HI ldx #VDC_DSP_HI
jmp VDCWriteReg jmp VDCWriteReg
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; SETDRAWPAGE: Set the drawable page. Called with the new page in A (0..n). ; SETDRAWPAGE: Set the drawable page. Called with the new page in A (0..n).
@ -386,7 +394,7 @@ SETDRAWPAGE:
ror ror
ror ror
ror ror
sta SCRBASE sta SCRBASE
rts rts
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
@ -397,11 +405,11 @@ SETDRAWPAGE:
; ;
SETCOLOR: SETCOLOR:
tax tax
beq @L1 beq @L1
lda #1 lda #1
@L1: sta BITMASK @L1: sta BITMASK
jmp SetPattern ; need to have either 0 or 1 jmp SetPattern ; need to have either 0 or 1
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; SETPALETTE: Set the palette (not available with all drivers/hardware). ; SETPALETTE: Set the palette (not available with all drivers/hardware).
@ -412,46 +420,46 @@ SETCOLOR:
; ;
SETPALETTE: SETPALETTE:
jsr GETERROR ; clear error (if any) jsr GETERROR ; clear error (if any)
ldy #PALETTESIZE - 1 ldy #PALETTESIZE - 1
@L1: lda (ptr1),y ; Copy the palette @L1: lda (ptr1),y ; Copy the palette
and #$0F ; Make a valid color and #$0F ; Make a valid color
sta PALETTE,y sta PALETTE,y
dey dey
bpl @L1 bpl @L1
; Put colors from palette into screen ; Put colors from palette into screen
lda graphMode lda graphMode
bmi @L80 bmi @L80
lda PALETTE+1 ; foreground lda PALETTE+1 ; foreground
asl a asl a
asl a asl a
asl a asl a
asl a asl a
ora PALETTE ; background ora PALETTE ; background
ldx #0 ldx #0
@L2: sta COLOR_MATRIX,x @L2: sta COLOR_MATRIX,x
sta COLOR_MATRIX+$0100,x sta COLOR_MATRIX+$0100,x
sta COLOR_MATRIX+$0200,x sta COLOR_MATRIX+$0200,x
sta COLOR_MATRIX+1000-256,x sta COLOR_MATRIX+1000-256,x
inx inx
bne @L2 bne @L2
rts rts
@L80: ldy PALETTE+1 ; Foreground color @L80: ldy PALETTE+1 ; Foreground color
lda COLTRANS,y lda COLTRANS,y
asl a asl a
asl a asl a
asl a asl a
asl a asl a
ldy PALETTE ; Background color ldy PALETTE ; Background color
ora COLTRANS,y ora COLTRANS,y
ldx #VDC_COLORS ldx #VDC_COLORS
jmp VDCWriteReg jmp VDCWriteReg
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; GETPALETTE: Return the current palette in A/X. Even drivers that cannot ; GETPALETTE: Return the current palette in A/X. Even drivers that cannot
@ -462,9 +470,9 @@ SETPALETTE:
; ;
GETPALETTE: GETPALETTE:
lda #<PALETTE lda #<PALETTE
ldx #>PALETTE ldx #>PALETTE
rts rts
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; GETDEFPALETTE: Return the default palette for the driver in A/X. All ; GETDEFPALETTE: Return the default palette for the driver in A/X. All
@ -476,9 +484,9 @@ GETPALETTE:
; ;
GETDEFPALETTE: GETDEFPALETTE:
lda #<DEFPALETTE lda #<DEFPALETTE
ldx #>DEFPALETTE ldx #>DEFPALETTE
rts rts
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; SETPIXEL: Draw one pixel at X1/Y1 = ptr1/ptr2 with the current drawing ; SETPIXEL: Draw one pixel at X1/Y1 = ptr1/ptr2 with the current drawing
@ -489,18 +497,18 @@ GETDEFPALETTE:
; ;
SETPIXEL: SETPIXEL:
lda X1 lda X1
ldx X1+1 ldx X1+1
ldy Y1 ldy Y1
sta r3L sta r3L
stx r3H stx r3H
sty r11L sty r11L
sec sec
lda BITMASK ; set or clear C flag lda BITMASK ; set or clear C flag
bne @L1 bne @L1
clc clc
@L1: lda #0 @L1: lda #0
jmp DrawPoint jmp DrawPoint
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; GETPIXEL: Read the color value of a pixel and return it in A/X. The ; GETPIXEL: Read the color value of a pixel and return it in A/X. The
@ -509,18 +517,18 @@ SETPIXEL:
GETPIXEL: GETPIXEL:
lda X1 lda X1
ldx X1+1 ldx X1+1
ldy Y1 ldy Y1
sta r3L sta r3L
stx r3H stx r3H
sty r11L sty r11L
jsr TestPoint jsr TestPoint
ldx #0 ldx #0
bcc @L1 bcc @L1
inx inx
@L1: txa @L1: txa
ldx #0 ldx #0
rts rts
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
@ -531,24 +539,24 @@ GETPIXEL:
; ;
LINE: LINE:
lda X1 lda X1
ldx X1+1 ldx X1+1
ldy Y1 ldy Y1
sta r3L sta r3L
stx r3H stx r3H
sty r11L sty r11L
lda X2 lda X2
ldx X2+1 ldx X2+1
ldy Y2 ldy Y2
sta r4L sta r4L
stx r4H stx r4H
sty r11H sty r11H
sec sec
lda BITMASK ; set or clear C flag lda BITMASK ; set or clear C flag
bne @L1 bne @L1
clc clc
@L1: lda #0 @L1: lda #0
jmp DrawLine jmp DrawLine
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; BAR: Draw a filled rectangle with the corners X1/Y1, X2/Y2, where ; BAR: Draw a filled rectangle with the corners X1/Y1, X2/Y2, where
@ -567,19 +575,19 @@ LINE:
; ;
BAR: BAR:
lda X1 lda X1
ldx X1+1 ldx X1+1
ldy Y1 ldy Y1
sta r3L sta r3L
stx r3H stx r3H
sty r2L sty r2L
lda X2 lda X2
ldx X2+1 ldx X2+1
ldy Y2 ldy Y2
sta r4L sta r4L
stx r4H stx r4H
sty r2H sty r2H
jmp Rectangle jmp Rectangle
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; TEXTSTYLE: Set the style used when calling OUTTEXT. Text scaling in X and Y ; TEXTSTYLE: Set the style used when calling OUTTEXT. Text scaling in X and Y
@ -589,10 +597,10 @@ BAR:
; ;
TEXTSTYLE: TEXTSTYLE:
stx TEXTMAGX stx TEXTMAGX
sty TEXTMAGY sty TEXTMAGY
sta TEXTDIR sta TEXTDIR
rts rts
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
@ -604,41 +612,41 @@ TEXTSTYLE:
; ;
OUTTEXT: OUTTEXT:
lda TEXTDIR lda TEXTDIR
; cmp #TGI_TEXT_HORIZONTAL ; this is equal 0 ; cmp #TGI_TEXT_HORIZONTAL ; this is equal 0
bne @vertical bne @vertical
lda X1 ; horizontal text output lda X1 ; horizontal text output
ldx X1+1 ldx X1+1
ldy Y1 ldy Y1
sta r11L sta r11L
stx r11H stx r11H
sty r1H sty r1H
lda ptr3 lda ptr3
ldx ptr3+1 ldx ptr3+1
sta r0L sta r0L
stx r0H stx r0H
jmp PutString jmp PutString
@vertical: @vertical:
lda X1 ; vertical text output lda X1 ; vertical text output
ldx X1+1 ldx X1+1
ldy Y1 ldy Y1
sta r11L sta r11L
stx r11H stx r11H
sty r1H sty r1H
ldy #0 ldy #0
lda (ptr3),y lda (ptr3),y
beq @end beq @end
jsr PutChar jsr PutChar
inc ptr3 inc ptr3
bne @L1 bne @L1
inc ptr3+1 inc ptr3+1
@L1: lda Y1 @L1: lda Y1
clc clc
adc #8 adc #8
sta Y1 sta Y1
bne @vertical bne @vertical
@end: rts @end: rts
;------------- ;-------------
@ -647,27 +655,26 @@ OUTTEXT:
VDCSetSourceAddr: VDCSetSourceAddr:
pha pha
tya tya
ldx #VDC_DATA_HI ldx #VDC_DATA_HI
jsr VDCWriteReg jsr VDCWriteReg
pla pla
ldx #VDC_DATA_LO ldx #VDC_DATA_LO
bne VDCWriteReg bne VDCWriteReg
VDCReadByte: VDCReadByte:
ldx #VDC_DATA ldx #VDC_DATA
VDCReadReg: VDCReadReg:
stx VDC_ADDR_REG stx VDC_ADDR_REG
@L0: bit VDC_ADDR_REG @L0: bit VDC_ADDR_REG
bpl @L0 bpl @L0
lda VDC_DATA_REG lda VDC_DATA_REG
rts rts
VDCWriteByte: VDCWriteByte:
ldx #VDC_DATA ldx #VDC_DATA
VDCWriteReg: VDCWriteReg:
stx VDC_ADDR_REG stx VDC_ADDR_REG
@L0: bit VDC_ADDR_REG @L0: bit VDC_ADDR_REG
bpl @L0 bpl @L0
sta VDC_DATA_REG sta VDC_DATA_REG
rts rts

View File

@ -5,58 +5,57 @@
; Maciej 'YTM/Elysium' Witkowiak <ytm@elysium.pl> ; Maciej 'YTM/Elysium' Witkowiak <ytm@elysium.pl>
; 06,20,25.12.2002 ; 06,20,25.12.2002
.include "zeropage.inc" .include "zeropage.inc"
.include "em-kernel.inc"
.include "em-kernel.inc" .include "em-error.inc"
.include "em-error.inc"
.macpack generic
.macpack generic
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; Header. Includes jump table ; Header. Includes jump table
.segment "JUMPTABLE" .segment "JUMPTABLE"
; Driver signature ; Driver signature
.byte $65, $6d, $64 ; "emd" .byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number .byte EMD_API_VERSION ; EM API version number
; Jump table. ; Jump table.
.word INSTALL .word INSTALL
.word UNINSTALL .word UNINSTALL
.word PAGECOUNT .word PAGECOUNT
.word MAP .word MAP
.word USE .word USE
.word COMMIT .word COMMIT
.word COPYFROM .word COPYFROM
.word COPYTO .word COPYTO
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; Constants ; Constants
VDC_ADDR_REG = $D600 ; VDC address VDC_ADDR_REG = $D600 ; VDC address
VDC_DATA_REG = $D601 ; VDC data VDC_DATA_REG = $D601 ; VDC data
VDC_DATA_HI = 18 ; used registers VDC_DATA_HI = 18 ; used registers
VDC_DATA_LO = 19 VDC_DATA_LO = 19
VDC_CSET = 28 VDC_CSET = 28
VDC_DATA = 31 VDC_DATA = 31
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; Data. ; Data.
.data .data
pagecount: .word 64 ; $0000-$3fff as 16k default pagecount:
curpage: .word $ffff ; currently mapped-in page (invalid) .word 64 ; $0000-$3fff as 16k default
curpage:
.word $ffff ; currently mapped-in page (invalid)
.bss .bss
window: .res 256 ; memory window window: .res 256 ; memory window
.code .code
@ -72,84 +71,84 @@ INSTALL:
php php
sei sei
lda $01 lda $01
pha pha
lda #$35 lda #$35
sta $01 sta $01
ldx #VDC_CSET ; determine size of RAM... ldx #VDC_CSET ; determine size of RAM...
jsr vdcgetreg jsr vdcgetreg
sta tmp1 sta tmp1
ora #%00010000 ora #%00010000
jsr vdcputreg ; turn on 64k jsr vdcputreg ; turn on 64k
jsr settestadr1 ; save original value of test byte jsr settestadr1 ; save original value of test byte
jsr vdcgetbyte jsr vdcgetbyte
sta tmp2 sta tmp2
lda #$55 ; write $55 here lda #$55 ; write $55 here
ldy #ptr1 ldy #ptr1
jsr test64k ; read it here and there jsr test64k ; read it here and there
lda #$aa ; write $aa here lda #$aa ; write $aa here
ldy #ptr2 ldy #ptr2
jsr test64k ; read it here and there jsr test64k ; read it here and there
jsr settestadr1 jsr settestadr1
lda tmp2 lda tmp2
jsr vdcputbyte ; restore original value of test byte jsr vdcputbyte ; restore original value of test byte
lda ptr1 ; do bytes match? lda ptr1 ; do bytes match?
cmp ptr1+1 cmp ptr1+1
bne @have64k bne @have64k
lda ptr2 lda ptr2
cmp ptr2+1 cmp ptr2+1
bne @have64k bne @have64k
ldx #VDC_CSET ldx #VDC_CSET
lda tmp1 lda tmp1
jsr vdcputreg ; restore 16/64k flag jsr vdcputreg ; restore 16/64k flag
jmp @endok ; and leave default values for 16k jmp @endok ; and leave default values for 16k
@have64k: @have64k:
lda #<256 lda #<256
ldx #>256 ldx #>256
sta pagecount sta pagecount
stx pagecount+1 stx pagecount+1
@endok: @endok:
pla pla
sta $01 sta $01
plp plp
lda #<EM_ERR_OK lda #<EM_ERR_OK
ldx #>EM_ERR_OK ldx #>EM_ERR_OK
rts rts
test64k: test64k:
sta tmp1 sta tmp1
sty ptr3 sty ptr3
lda #0 lda #0
sta ptr3+1 sta ptr3+1
jsr settestadr1 jsr settestadr1
lda tmp1 lda tmp1
jsr vdcputbyte ; write $55 jsr vdcputbyte ; write $55
jsr settestadr1 jsr settestadr1
jsr vdcgetbyte ; read here jsr vdcgetbyte ; read here
pha pha
jsr settestadr2 jsr settestadr2
jsr vdcgetbyte ; and there jsr vdcgetbyte ; and there
ldy #1 ldy #1
sta (ptr3),y sta (ptr3),y
pla pla
dey dey
sta (ptr3),y sta (ptr3),y
rts rts
settestadr1: settestadr1:
ldy #$02 ; test page 2 (here) ldy #$02 ; test page 2 (here)
.byte $2c .byte $2c
settestadr2: settestadr2:
ldy #$42 ; or page 64+2 (there) ldy #$42 ; or page 64+2 (there)
lda #0 lda #0
jmp vdcsetsrcaddr jmp vdcsetsrcaddr
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; UNINSTALL routine. Is called before the driver is removed from memory. ; UNINSTALL routine. Is called before the driver is removed from memory.
@ -157,17 +156,17 @@ settestadr2:
; ;
UNINSTALL: UNINSTALL:
;on C128 restore font and clear the screen? ;on C128 restore font and clear the screen?
rts rts
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; PAGECOUNT: Return the total number of available pages in a/x. ; PAGECOUNT: Return the total number of available pages in a/x.
; ;
PAGECOUNT: PAGECOUNT:
lda pagecount lda pagecount
ldx pagecount+1 ldx pagecount+1
rts rts
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; MAP: Map the page in a/x into memory and return a pointer to the page in ; MAP: Map the page in a/x into memory and return a pointer to the page in
@ -175,21 +174,21 @@ PAGECOUNT:
; by the driver. ; by the driver.
; ;
MAP: sta curpage MAP: sta curpage
stx curpage+1 stx curpage+1
sta ptr1+1 sta ptr1+1
ldy #0 ldy #0
sty ptr1 sty ptr1
lda #<window lda #<window
sta ptr2 sta ptr2
lda #>window lda #>window
sta ptr2+1 sta ptr2+1
jsr transferin jsr transferin
lda #<window lda #<window
ldx #>window ldx #>window
rts rts
; copy a single page from (ptr1):VDCRAM to (ptr2):RAM ; copy a single page from (ptr1):VDCRAM to (ptr2):RAM
@ -197,54 +196,54 @@ MAP: sta curpage
transferin: transferin:
php php
sei sei
lda $01 lda $01
pha pha
lda #$35 lda #$35
sta $01 sta $01
lda ptr1 lda ptr1
ldy ptr1+1 ldy ptr1+1
jsr vdcsetsrcaddr ; set source address in VDC jsr vdcsetsrcaddr ; set source address in VDC
ldy #0 ldy #0
ldx #VDC_DATA ldx #VDC_DATA
stx VDC_ADDR_REG stx VDC_ADDR_REG
@L0: bit VDC_ADDR_REG @L0: bit VDC_ADDR_REG
bpl @L0 bpl @L0
lda VDC_DATA_REG ; get 2 bytes at a time to speed-up lda VDC_DATA_REG ; get 2 bytes at a time to speed-up
sta (ptr2),y ; (in fact up to 8 bytes could be fetched with special VDC config) sta (ptr2),y ; (in fact up to 8 bytes could be fetched with special VDC config)
iny iny
lda VDC_DATA_REG lda VDC_DATA_REG
sta (ptr2),y sta (ptr2),y
iny iny
bne @L0 bne @L0
pla pla
sta $01 sta $01
plp plp
rts rts
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; USE: Tell the driver that the window is now associated with a given page. ; USE: Tell the driver that the window is now associated with a given page.
USE: sta curpage USE: sta curpage
stx curpage+1 ; Remember the page stx curpage+1 ; Remember the page
lda #<window lda #<window
ldx #>window ; Return the window ldx #>window ; Return the window
done: rts done: rts
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; COMMIT: Commit changes in the memory window to extended storage. ; COMMIT: Commit changes in the memory window to extended storage.
COMMIT: COMMIT:
lda curpage ; jump if no page mapped lda curpage ; jump if no page mapped
ldx curpage+1 ldx curpage+1
bmi done bmi done
sta ptr1+1 sta ptr1+1
ldy #0 ldy #0
sty ptr1 sty ptr1
lda #<window lda #<window
sta ptr2 sta ptr2
lda #>window lda #>window
sta ptr2+1 sta ptr2+1
; fall through to transferout ; fall through to transferout
@ -253,24 +252,24 @@ COMMIT:
transferout: transferout:
php php
sei sei
lda $01 lda $01
pha pha
lda #$35 lda #$35
sta $01 sta $01
lda ptr1 lda ptr1
ldy ptr1+1 ldy ptr1+1
jsr vdcsetsrcaddr ; set source address in VDC jsr vdcsetsrcaddr ; set source address in VDC
ldy #0 ldy #0
ldx #VDC_DATA ldx #VDC_DATA
stx VDC_ADDR_REG stx VDC_ADDR_REG
@L0: bit VDC_ADDR_REG @L0: bit VDC_ADDR_REG
bpl @L0 bpl @L0
lda (ptr2),y ; speedup does not work for writing lda (ptr2),y ; speedup does not work for writing
sta VDC_DATA_REG sta VDC_DATA_REG
iny iny
bne @L0 bne @L0
pla pla
sta $01 sta $01
plp plp
rts rts
@ -281,40 +280,40 @@ transferout:
; ;
COPYFROM: COPYFROM:
jsr setup jsr setup
beq @L2 ; Skip if no full pages beq @L2 ; Skip if no full pages
; Copy full pages ; Copy full pages
@L1: jsr transferin @L1: jsr transferin
inc ptr1+1 inc ptr1+1
inc ptr2+1 inc ptr2+1
dec tmp1 dec tmp1
bne @L1 bne @L1
; Copy the remainder of the page ; Copy the remainder of the page
@L2: ldy #EM_COPY::COUNT @L2: ldy #EM_COPY::COUNT
lda (ptr3),y ; Get bytes in last page lda (ptr3),y ; Get bytes in last page
beq @L4 beq @L4
sta tmp1 sta tmp1
; Transfer the bytes in the last page ; Transfer the bytes in the last page
php php
sei sei
lda $01 lda $01
pha pha
lda #$35 lda #$35
sta $01 sta $01
ldy #0 ldy #0
@L3: jsr vdcgetbyte @L3: jsr vdcgetbyte
sta (ptr2),y sta (ptr2),y
iny iny
dec tmp1 dec tmp1
lda tmp1 lda tmp1
bne @L3 bne @L3
pla pla
sta $01 sta $01
plp plp
@L4: rts @L4: rts
@ -325,40 +324,40 @@ COPYFROM:
; ;
COPYTO: COPYTO:
jsr setup jsr setup
beq @L2 ; Skip if no full pages beq @L2 ; Skip if no full pages
; Copy full pages ; Copy full pages
@L1: jsr transferout @L1: jsr transferout
inc ptr1+1 inc ptr1+1
inc ptr2+1 inc ptr2+1
dec tmp1 dec tmp1
bne @L1 bne @L1
; Copy the remainder of the page ; Copy the remainder of the page
@L2: ldy #EM_COPY::COUNT @L2: ldy #EM_COPY::COUNT
lda (ptr3),y ; Get bytes in last page lda (ptr3),y ; Get bytes in last page
beq @L4 beq @L4
sta tmp1 sta tmp1
; Transfer the bytes in the last page ; Transfer the bytes in the last page
php php
sei sei
lda $01 lda $01
pha pha
lda #$35 lda #$35
sta $01 sta $01
ldy #0 ldy #0
@L3: lda (ptr2),y @L3: lda (ptr2),y
jsr vdcputbyte jsr vdcputbyte
iny iny
dec tmp1 dec tmp1
lda tmp1 lda tmp1
bne @L3 bne @L3
pla pla
sta $01 sta $01
plp plp
@L4: rts @L4: rts
@ -367,33 +366,33 @@ COPYTO:
; ;
vdcsetsrcaddr: vdcsetsrcaddr:
ldx #VDC_DATA_LO ldx #VDC_DATA_LO
stx VDC_ADDR_REG stx VDC_ADDR_REG
@L0: bit VDC_ADDR_REG @L0: bit VDC_ADDR_REG
bpl @L0 bpl @L0
sta VDC_DATA_REG sta VDC_DATA_REG
dex dex
tya tya
stx VDC_ADDR_REG stx VDC_ADDR_REG
sta VDC_DATA_REG sta VDC_DATA_REG
rts rts
vdcgetbyte: vdcgetbyte:
ldx #VDC_DATA ldx #VDC_DATA
vdcgetreg: vdcgetreg:
stx VDC_ADDR_REG stx VDC_ADDR_REG
@L0: bit VDC_ADDR_REG @L0: bit VDC_ADDR_REG
bpl @L0 bpl @L0
lda VDC_DATA_REG lda VDC_DATA_REG
rts rts
vdcputbyte: vdcputbyte:
ldx #VDC_DATA ldx #VDC_DATA
vdcputreg: vdcputreg:
stx VDC_ADDR_REG stx VDC_ADDR_REG
@L0: bit VDC_ADDR_REG @L0: bit VDC_ADDR_REG
bpl @L0 bpl @L0
sta VDC_DATA_REG sta VDC_DATA_REG
rts rts
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
@ -402,25 +401,24 @@ vdcputreg:
; ;
setup: setup:
sta ptr3 sta ptr3
stx ptr3+1 ; Save the passed em_copy pointer stx ptr3+1 ; Save the passed em_copy pointer
ldy #EM_COPY::OFFS ldy #EM_COPY::OFFS
lda (ptr3),y lda (ptr3),y
sta ptr1 sta ptr1
ldy #EM_COPY::PAGE ldy #EM_COPY::PAGE
lda (ptr3),y lda (ptr3),y
sta ptr1+1 ; From sta ptr1+1 ; From
ldy #EM_COPY::BUF ldy #EM_COPY::BUF
lda (ptr3),y lda (ptr3),y
sta ptr2 sta ptr2
iny iny
lda (ptr3),y lda (ptr3),y
sta ptr2+1 ; To sta ptr2+1 ; To
ldy #EM_COPY::COUNT+1 ldy #EM_COPY::COUNT+1
lda (ptr3),y ; Get number of pages lda (ptr3),y ; Get number of pages
sta tmp1 sta tmp1
rts rts

View File

@ -6,9 +6,10 @@
; const char joy_stddrv[]; ; const char joy_stddrv[];
; ;
.export _joy_stddrv .export _joy_stddrv
.rodata .rodata
_joy_stddrv: .asciiz "geos-stdjoy.joy" _joy_stddrv:
.asciiz "geos-stdjoy.joy"

View File

@ -5,7 +5,10 @@
; ;
; const char mouse_stddrv[]; ; const char mouse_stddrv[];
; ;
.export _mouse_stddrv
.rodata .export _mouse_stddrv
_mouse_stddrv: .asciiz "geos-stdmou.mou"
.rodata
_mouse_stddrv:
.asciiz "geos-stdmou.mou"

View File

@ -2,7 +2,7 @@
; Target-specific black & white values, for use by the target-shared TGI kernel ; Target-specific black & white values, for use by the target-shared TGI kernel
; ;
.include "tgi-kernel.inc" .include "tgi-kernel.inc"
tgi_color_black = $00 tgi_color_black = $00
tgi_color_white = $01 tgi_color_white = $01

View File

@ -6,8 +6,9 @@
; const char tgi_stddrv[]; ; const char tgi_stddrv[];
; ;
.export _tgi_stddrv .export _tgi_stddrv
.rodata .rodata
_tgi_stddrv: .asciiz "geos-tgi.tgi" _tgi_stddrv:
.asciiz "geos-tgi.tgi"

View File

@ -13,5 +13,5 @@
.include "geossym.inc" .include "geossym.inc"
_FetchRAM: _FetchRAM:
jsr REURegs jsr REURegs
jmp FetchRAM jmp FetchRAM

View File

@ -11,11 +11,11 @@
.include "geossym.inc" .include "geossym.inc"
REURegs: REURegs:
jsr DoublePop jsr DoublePop
jsr popax jsr popax
sta r2L sta r2L
stx r2H stx r2H
jsr popa jsr popa
sta r3L sta r3L
rts rts

View File

@ -13,5 +13,5 @@
.include "geossym.inc" .include "geossym.inc"
_StashRAM: _StashRAM:
jsr REURegs jsr REURegs
jmp StashRAM jmp StashRAM

View File

@ -14,5 +14,5 @@
.include "geossym.inc" .include "geossym.inc"
_SwapRAM: _SwapRAM:
jsr REURegs jsr REURegs
jmp SwapRAM jmp SwapRAM

View File

@ -13,8 +13,8 @@
.include "geossym.inc" .include "geossym.inc"
_VerifyRAM: _VerifyRAM:
jsr REURegs jsr REURegs
jsr VerifyRAM jsr VerifyRAM
txa txa
ldx #0 ldx #0
rts rts

View File

@ -13,7 +13,7 @@
; char (example: for ASCII, this must be $E0). ; char (example: for ASCII, this must be $E0).
.export __cdiff .export __cdiff
__cdiff: __cdiff:
.byte $e0 .byte $e0
@ -47,19 +47,19 @@ __cdiff:
; The table is taken from Craig S. Bruce technical docs for the ACE os ; The table is taken from Craig S. Bruce technical docs for the ACE os
.export __ctype .export __ctype
__ctype: __ctype:
.byte $10 ; 0/00 ___rvs_@___ .byte $10 ; 0/00 ___rvs_@___
.byte $10 ; 1/01 ___rvs_a___ .byte $10 ; 1/01 ___rvs_a___
.byte $10 ; 2/02 ___rvs_b___ .byte $10 ; 2/02 ___rvs_b___
.byte $10 ; 3/03 ___rvs_c___ .byte $10 ; 3/03 ___rvs_c___
.byte $10 ; 4/04 ___rvs_d___ .byte $10 ; 4/04 ___rvs_d___
.byte $10 ; 5/05 ___rvs_e___ .byte $10 ; 5/05 ___rvs_e___
.byte $10 ; 6/06 ___rvs_f___ .byte $10 ; 6/06 ___rvs_f___
.byte $10 ; 7/07 _BEL/rvs_g_ .byte $10 ; 7/07 _BEL/rvs_g_
.byte $10 ; 8/08 ___rvs_h___ .byte $10 ; 8/08 ___rvs_h___
.byte $D0 ; 9/09 _TAB/rvs_i_ .byte $D0 ; 9/09 _TAB/rvs_i_
.byte $50 ; 10/0a _BOL/rvs_j_ .byte $50 ; 10/0a _BOL/rvs_j_
.byte $10 ; 11/0b ___rvs_k___ .byte $10 ; 11/0b ___rvs_k___
.byte $10 ; 12/0c ___rvs_l___ .byte $10 ; 12/0c ___rvs_l___
@ -82,10 +82,10 @@ __ctype:
.byte $10 ; 29/1d ___rvs_]___ .byte $10 ; 29/1d ___rvs_]___
.byte $10 ; 30/1e ___rvs_^___ .byte $10 ; 30/1e ___rvs_^___
.byte $10 ; 31/1f _rvs_under_ .byte $10 ; 31/1f _rvs_under_
.byte $A0 ; 32/20 ___SPACE___ .byte $A0 ; 32/20 ___SPACE___
.byte $00 ; 33/21 _____!_____ .byte $00 ; 33/21 _____!_____
.byte $00 ; 34/22 _____"_____ .byte $00 ; 34/22 _____"_____
.byte $00 ; 35/23 _____#_____ .byte $00 ; 35/23 _____#_____
.byte $00 ; 36/24 _____$_____ .byte $00 ; 36/24 _____$_____
.byte $00 ; 37/25 _____%_____ .byte $00 ; 37/25 _____%_____
.byte $00 ; 38/26 _____&_____ .byte $00 ; 38/26 _____&_____
@ -95,9 +95,9 @@ __ctype:
.byte $00 ; 42/2a _____*_____ .byte $00 ; 42/2a _____*_____
.byte $00 ; 43/2b _____+_____ .byte $00 ; 43/2b _____+_____
.byte $00 ; 44/2c _____,_____ .byte $00 ; 44/2c _____,_____
.byte $00 ; 45/2d _____-_____ .byte $00 ; 45/2d _____-_____
.byte $00 ; 46/2e _____._____ .byte $00 ; 46/2e _____._____
.byte $00 ; 47/2f _____/_____ .byte $00 ; 47/2f _____/_____
.byte $0C ; 48/30 _____0_____ .byte $0C ; 48/30 _____0_____
.byte $0C ; 49/31 _____1_____ .byte $0C ; 49/31 _____1_____
.byte $0C ; 50/32 _____2_____ .byte $0C ; 50/32 _____2_____
@ -116,33 +116,33 @@ __ctype:
.byte $00 ; 63/3f _____?_____ .byte $00 ; 63/3f _____?_____
.byte $00 ; 64/40 _____@_____ .byte $00 ; 64/40 _____@_____
.byte $09 ; 65/41 _____a_____ .byte $09 ; 65/41 _____a_____
.byte $09 ; 66/42 _____b_____ .byte $09 ; 66/42 _____b_____
.byte $09 ; 67/43 _____c_____ .byte $09 ; 67/43 _____c_____
.byte $09 ; 68/44 _____d_____ .byte $09 ; 68/44 _____d_____
.byte $09 ; 69/45 _____e_____ .byte $09 ; 69/45 _____e_____
.byte $09 ; 70/46 _____f_____ .byte $09 ; 70/46 _____f_____
.byte $01 ; 71/47 _____g_____ .byte $01 ; 71/47 _____g_____
.byte $01 ; 72/48 _____h_____ .byte $01 ; 72/48 _____h_____
.byte $01 ; 73/49 _____i_____ .byte $01 ; 73/49 _____i_____
.byte $01 ; 74/4a _____j_____ .byte $01 ; 74/4a _____j_____
.byte $01 ; 75/4b _____k_____ .byte $01 ; 75/4b _____k_____
.byte $01 ; 76/4c _____l_____ .byte $01 ; 76/4c _____l_____
.byte $01 ; 77/4d _____m_____ .byte $01 ; 77/4d _____m_____
.byte $01 ; 78/4e _____n_____ .byte $01 ; 78/4e _____n_____
.byte $01 ; 79/4f _____o_____ .byte $01 ; 79/4f _____o_____
.byte $01 ; 80/50 _____p_____ .byte $01 ; 80/50 _____p_____
.byte $01 ; 81/51 _____q_____ .byte $01 ; 81/51 _____q_____
.byte $01 ; 82/52 _____r_____ .byte $01 ; 82/52 _____r_____
.byte $01 ; 83/53 _____s_____ .byte $01 ; 83/53 _____s_____
.byte $01 ; 84/54 _____t_____ .byte $01 ; 84/54 _____t_____
.byte $01 ; 85/55 _____u_____ .byte $01 ; 85/55 _____u_____
.byte $01 ; 86/56 _____v_____ .byte $01 ; 86/56 _____v_____
.byte $01 ; 87/57 _____w_____ .byte $01 ; 87/57 _____w_____
.byte $01 ; 88/58 _____x_____ .byte $01 ; 88/58 _____x_____
.byte $01 ; 89/59 _____y_____ .byte $01 ; 89/59 _____y_____
.byte $01 ; 90/5a _____z_____ .byte $01 ; 90/5a _____z_____
.byte $00 ; 91/5b _____[_____ .byte $00 ; 91/5b _____[_____
.byte $00 ; 92/5c _____\_____ .byte $00 ; 92/5c _____\_____
.byte $00 ; 93/5d _____]_____ .byte $00 ; 93/5d _____]_____
.byte $00 ; 94/5e _____^_____ .byte $00 ; 94/5e _____^_____
@ -176,7 +176,7 @@ __ctype:
.byte $02 ; 121/79 _U`_grave__ .byte $02 ; 121/79 _U`_grave__
.byte $02 ; 122/7a _U'_acute__ .byte $02 ; 122/7a _U'_acute__
.byte $00 ; 123/7b _U^_circum_ .byte $00 ; 123/7b _U^_circum_
.byte $00 ; 124/7c _U"_dieres_ .byte $00 ; 124/7c _U"_dieres_
.byte $00 ; 125/7d _Y'_acute__ .byte $00 ; 125/7d _Y'_acute__
.byte $00 ; 126/7e _cap_thorn_ .byte $00 ; 126/7e _cap_thorn_
.byte $00 ; 127/7f _Es-sed_B__ .byte $00 ; 127/7f _Es-sed_B__
@ -188,7 +188,7 @@ __ctype:
.byte $00 ; 132/84 _tl_corner_ .byte $00 ; 132/84 _tl_corner_
.byte $00 ; 133/85 _tr_corner_ .byte $00 ; 133/85 _tr_corner_
.byte $00 ; 134/86 _bl_corner_ .byte $00 ; 134/86 _bl_corner_
.byte $00 ; 135/87 _br_corner_ .byte $00 ; 135/87 _br_corner_
.byte $00 ; 136/88 ___l_tee___ .byte $00 ; 136/88 ___l_tee___
.byte $00 ; 137/89 ___r_tee___ .byte $00 ; 137/89 ___r_tee___
.byte $00 ; 138/8a ___t_tee___ .byte $00 ; 138/8a ___t_tee___
@ -221,7 +221,7 @@ __ctype:
.byte $00 ; 165/a5 ____yen____ .byte $00 ; 165/a5 ____yen____
.byte $00 ; 166/a6 _|_broken__ .byte $00 ; 166/a6 _|_broken__
.byte $00 ; 167/a7 __section__ .byte $00 ; 167/a7 __section__
.byte $00 ; 168/a8 __umulaut__ .byte $00 ; 168/a8 __umulaut__
.byte $00 ; 169/a9 _copyright_ .byte $00 ; 169/a9 _copyright_
.byte $00 ; 170/aa __fem_ord__ .byte $00 ; 170/aa __fem_ord__
.byte $00 ; 171/ab _l_ang_quo_ .byte $00 ; 171/ab _l_ang_quo_
@ -233,7 +233,7 @@ __ctype:
.byte $00 ; 177/b1 ____+/-____ .byte $00 ; 177/b1 ____+/-____
.byte $00 ; 178/b2 _2_supersc_ .byte $00 ; 178/b2 _2_supersc_
.byte $00 ; 179/b3 _3_supersc_ .byte $00 ; 179/b3 _3_supersc_
.byte $00 ; 180/b4 ___acute___ .byte $00 ; 180/b4 ___acute___
.byte $00 ; 181/b5 ____mu_____ .byte $00 ; 181/b5 ____mu_____
.byte $00 ; 182/b6 _paragraph_ .byte $00 ; 182/b6 _paragraph_
.byte $00 ; 183/b7 __mid_dot__ .byte $00 ; 183/b7 __mid_dot__
@ -266,7 +266,7 @@ __ctype:
.byte $00 ; 209/d1 _____Q_____ .byte $00 ; 209/d1 _____Q_____
.byte $00 ; 210/d2 _____R_____ .byte $00 ; 210/d2 _____R_____
.byte $00 ; 211/d3 _____S_____ .byte $00 ; 211/d3 _____S_____
.byte $00 ; 212/d4 _____T_____ .byte $00 ; 212/d4 _____T_____
.byte $00 ; 213/d5 _____U_____ .byte $00 ; 213/d5 _____U_____
.byte $00 ; 214/d6 _____V_____ .byte $00 ; 214/d6 _____V_____
.byte $00 ; 215/d7 _____W_____ .byte $00 ; 215/d7 _____W_____
@ -278,7 +278,7 @@ __ctype:
.byte $00 ; 221/dd _____}_____ .byte $00 ; 221/dd _____}_____
.byte $00 ; 222/de _____~_____ .byte $00 ; 222/de _____~_____
.byte $00 ; 223/df ___HOUSE___ .byte $00 ; 223/df ___HOUSE___
.byte $00 ; 224/e0 _a`_grave__ .byte $00 ; 224/e0 _a`_grave__
.byte $00 ; 225/e1 _a'_acute__ .byte $00 ; 225/e1 _a'_acute__
.byte $00 ; 226/e2 _a^_circum_ .byte $00 ; 226/e2 _a^_circum_
.byte $00 ; 227/e3 _a~_tilde__ .byte $00 ; 227/e3 _a~_tilde__
@ -310,4 +310,3 @@ __ctype:
.byte $00 ; 253/fd _y'_acute__ .byte $00 ; 253/fd _y'_acute__
.byte $00 ; 254/fe _sm_thorn__ .byte $00 ; 254/fe _sm_thorn__
.byte $00 ; 255/ff _y"_dieres_ .byte $00 ; 255/ff _y"_dieres_

View File

@ -20,74 +20,74 @@
.include "geossym2.inc" .include "geossym2.inc"
_get_ostype: _get_ostype:
ldx #0 ldx #0
lda version lda version
cmp #$a9 cmp #$a9
beq geos11 beq geos11
and #%11110000 and #%11110000
cmp #$10 cmp #$10
beq geos10 beq geos10
lda c128Flag ; we're on at least 2.0 lda c128Flag ; we're on at least 2.0
cmp #$18 cmp #$18
beq geos_on_plus4 beq geos_on_plus4
ora version ora version
rts rts
geos10: geos10:
lda version lda version
rts rts
geos11: geos11:
lda #$11 lda #$11
rts rts
geos_on_plus4: geos_on_plus4:
lda #$04 lda #$04
rts rts
_get_tv: _get_tv:
jsr _get_ostype jsr _get_ostype
cmp #$04 cmp #$04
beq plus4_get_tv beq plus4_get_tv
bpl only40 ; C64 with 40 columns only bpl only40 ; C64 with 40 columns only
lda graphMode lda graphMode
bpl only40 ; C128 but currently on 40 columns bpl only40 ; C128 but currently on 40 columns
ldx #1 ; COLUMNS80 ldx #1 ; COLUMNS80
bne tvmode bne tvmode
only40: ldx #0 ; COLUMNS40 only40: ldx #0 ; COLUMNS40
tvmode: ; PAL/NTSC check here, result in A tvmode: ; PAL/NTSC check here, result in A
php php
sei ; disable interrupts sei ; disable interrupts
lda CPU_DATA ; this is for C64 lda CPU_DATA ; this is for C64
pha pha
lda #IO_IN ; enable access to I/O lda #IO_IN ; enable access to I/O
sta CPU_DATA sta CPU_DATA
bit rasreg bit rasreg
bpl tvmode ; wait for rasterline 127<x<256 bpl tvmode ; wait for rasterline 127<x<256
lda #24 ; (rasterline now >=256!) lda #24 ; (rasterline now >=256!)
modelp: modelp:
cmp rasreg ; wait for rasterline = 24 (or 280 on PAL) cmp rasreg ; wait for rasterline = 24 (or 280 on PAL)
bne modelp bne modelp
lda grcntrl1 ; 24 or 280 ? lda grcntrl1 ; 24 or 280 ?
bpl ntsc bpl ntsc
lda #0 ; PAL lda #0 ; PAL
beq modeend beq modeend
ntsc: ntsc:
lda #$80 ; NTSC lda #$80 ; NTSC
modeend: modeend:
stx tmp1 stx tmp1
ora tmp1 ora tmp1
sta tmp1 sta tmp1
ldx #0 ldx #0
pla pla
sta CPU_DATA ; restore memory config sta CPU_DATA ; restore memory config
plp ; restore interrupt state plp ; restore interrupt state
lda tmp1 lda tmp1
rts rts
plus4_get_tv: plus4_get_tv:
ldx #1 ; Assume PAL ldx #1 ; Assume PAL
bit $FF07 ; Test bit 6 bit $FF07 ; Test bit 6
bvc plus4pal bvc plus4pal
dex ; NTSC dex ; NTSC
plus4pal: plus4pal:
txa txa
ldx #0 ldx #0
rts rts

View File

@ -11,6 +11,6 @@
.include "jumptab.inc" .include "jumptab.inc"
_InitForIO = InitForIO _InitForIO = InitForIO
_DoneWithIO = DoneWithIO _DoneWithIO = DoneWithIO

View File

@ -10,4 +10,4 @@
.include "jumptab.inc" .include "jumptab.inc"
_ToBASIC = ToBASIC _ToBASIC = ToBASIC