GRiD Compass
DisplayScreenInit
DCL ScreenPropsType LIT 'STRUCTURE
(commonProp BYTE,
length WORD,
width WORD,
height WORD,
commonPropEnd BYTE)';
struct ScreenPropsType {
uint8_t commonProp = 0xFE;
uint16_t length = 0x0004;
uint16_t width; // hardcoded as 320 in function. ignored in file???
uint16_t height; // determinded in function. ignored in file???
uint8_t commonPropEnd = 0xFF;
}
InterruptEntry:
POP BX ; get IP
POP ES ; get CS
POPF ; set flags
MOV AX, ES:[BX] ; get call #
@SystemErrors~Text~
struct floppy2_desc_t
ParameterStatus
#define keyboardIRQnum 2
#define keyboardHWaddress 0xDFFC0
#define dataPort 0
#define commandPort 1
void endIRQ(uint8_t irqNum);
void doKeyboardHandler();
void doWatchDogHandler();
void keyboardSendCommand(uint8_t ah, uint8_t al);
uint8_t readKeyboardPort(uint8_t portNum);
uint16_t keyboardStatusKey; // somewhere in global BIOS RAM area
uint8_t readKeyboardPort(uint8_t portNum) {
// do imaginary magic with 8086 real mode asm
// "in al, (keyboardHWaddress + portNum << 1)"
}
void keyboardIRQ() {
uint8_t al, ah;
endIRQ( keyboardIRQnum );
al = readKeyboardPort( dataPort );
ah = readKeyboardPort( commandPort );
if ( al == 0xFF ) {
return;
} else if ( al == 0xFE ) {
return;
} else if ( al == 0xFD ) {
keyboardSendCommand( 0x1, 0x10 ) //al = 0x10; ah = 0x01;
doWatchDogHandler();
} else {
keyboardStatusKey = ( ah << 8 ) | al ;
doKeyboardHandler();
}
}
Filename: FlakAttak~Run
Offset: 0x00000
Type: 0x6E
Size: 37 0x25
Record description: R-module Header Record
Module name: FLAKMAIN
Module type: 03 Load-Time Locatable module. It can be loaded anywhere with perhaps some base fixups to be performed.
Segment record count: 15 0F
Group record count: 3 03
Overlay record count: 0 00
Overlay Offset: 0 0x0000
Static Size: 808988979 0x30383133
Maximums Static Size: 538976310 0x20202036
Dynamic Size: 538976288 0x20202020
Maximum dynamic Size: 1428168736 0x55202020
xSum: 0x76 (OK)
Offset: 0x00028
Type: 0x98
Size: 12 0x0C
Record description: Segment Definition Record
ACBP RAW: 0xC0
Aligment: 6
Type: SEGDEF describes a load-time locatable (LTL), paragraph aligned LSEG if not member of any group
Combination: 0
LTL Data (RAW): 0x80
Flag: GROUP. Segment is part of group and should be loaded as part of the group
Max Segment Length: 14019 0x36C3
Group offset: 0 0x0000
Segment Length: 14019 0x36C3
Segment Name Index: 2 0x0002
Group Name Index: 2 0x0002
Overlay Name Index: 1 0x0001
xSum: 0x25 (OK)
uint8_t mode; // not used in this case
struct floppy2_desc_t {
uint8_t command; // command number (see below)
uint16_t connection; // unused in this protocol
uint32_t sectorNumber; // sector number!
uint16_t blockSize; // data size
uint8_t mode; // not used in this case
} __attribute__((packed));
Next2:
;
; Write
;
CMP AX,ddWrite
JNZ next3
LES DI,pPList
MOV CL,BYTE PTR ES:[DI].mode
CMP CL,ddSetStatus
JNE Next3
JMP SetStatus ; setStatus = ddWrite, mode 1
........
;
;
;
; Set Status
;
;
;
SetStatus:
PUSH DS
LES BX,pPList
LDS SI,ES:[BX].pBuffer ; buffer for setstatus data
MOV DI,OFFSET FStatus
MOV AX,SEG FStatus
MOV ES,AX
CLD ; direction flag
MOV CX,SetStatusLength
REP MOVSB
POP DS
MOV AX,FStatus.NumPages
SUB DX,DX
DIV FStatus.SectorsPerTrack
SUB DX,DX
DIV FStatus.TracksPerCylinder
MOV FStatus.NumCylinders,AX
MOV AX, eOk
JMP DONE
bool GPIO_passive(uint8_t pin) {
gpioSetMode(pin, PI_INPUT);
gpioSetPullUpDown(pin, PI_PUD_UP);
return (bool)gpioRead(pin);
}
void GPIO_active(uint8_t pin) {
gpioSetMode(pin, PI_OUTPUT);
gpioWrite(pin, state);
}
void GPIO_IF_writeDataByte(uint8_t data) {
for(uint8_t i = 0; i < 8; i++) {
bitRead(data,i) ? GPIO_IF_active() : GPIO__IF_passive();
}
}